From: Matti Aarnio Subject: Filesystem statistics APIs/counters ? Date: Wed, 25 Jun 2003 17:34:22 +0300 Sender: linux-fsdevel-owner@vger.kernel.org Message-ID: <20030625143422.GE28900@mea-ext.zmailer.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Received: from mail.zmailer.org ([62.240.94.4]:1479 "EHLO mail.zmailer.org") by vger.kernel.org with ESMTP id S264496AbTFYOUN (ORCPT ); Wed, 25 Jun 2003 10:20:13 -0400 Received: (mea@mea-ext) by mail.zmailer.org id S266664AbTFYOeX (ORCPT ); Wed, 25 Jun 2003 17:34:23 +0300 To: linux-fsdevel@vger.kernel.org Content-Disposition: inline List-Id: linux-fsdevel.vger.kernel.org To be able to compare software performance in different systems, I would like to periodically collect filesystem counters to see how much activity there is, e.g. in case I am running several hundred parallel activity processes, each doing their things in the filesystem (I am essentially using the filesystem as a database.) I would like to know at least: - Disk writes (requests and blocks) - Disk reads - i-node updates - Directory accesses, modifications - File accesses for read, read/write, write - Counts of direct IOs - Locking requests (internal, and application) I don't think those counters need to be absolute truth, that is, they can be mere volatile, not atomic_t things. I think unsigned 32 bits should always be enough, if things wrap around so that once a minute RRD polling can't keep up, then I need to poll quicker... Reading 2.5 sources, I see that XFS has some performance counters. Are they shared by all XFS filesystems in the box, or one for each mounted system, that is unclear. The /proc/stat shows a bit of disk_io: data, but that is low-level stuff of partition access. Solaris 8 with "sar -A 10" shows this header: 17:21:31 %usr %sys %wio %idle device %busy avque r+w/s blks/s avwait avserv runq-sz %runocc swpq-sz %swpocc bread/s lread/s %rcache bwrit/s lwrit/s %wcache pread/s pwrit/s swpin/s bswin/s swpot/s bswot/s pswch/s scall/s sread/s swrit/s fork/s exec/s rchar/s wchar/s iget/s namei/s dirbk/s rawch/s canch/s outch/s rcvin/s xmtin/s mdmin/s proc-sz ov inod-sz ov file-sz ov lock-sz msg/s sema/s atch/s pgin/s ppgin/s pflt/s vflt/s slock/s pgout/s ppgout/s pgfree/s pgscan/s %ufs_ipf freemem freeswap sml_mem alloc fail lg_mem alloc fail ovsz_alloc fail Still this is far from what I really would like to have access to. (Directory IOPs data, etc.) How to implement the access to these things per mounted filesystem ? - Thru some fcntl()/ioctl() on any file handle in the system ? (e.g. opendir() -> dirfd() of mountpoint ?) - Thru some magically named /proc/ objects ? E.g: /proc/mount//mountpoint (as symlink ?) /proc/mount//fs-stats etc. ? (recalling that we already have /proc/mounts "file".) Any thoughts ? /Matti Aarnio