DCMD_FSYS_STATISTICS, DCMD_FSYS_STATISTICS_CLR

Get filesystem statistics

Synopsis:

#include <sys/dcmd_blk.h>

#define DCMD_FSYS_STATISTICS       __DIOF(_DCMD_FSYS,  11, struct fs_stats)
#define DCMD_FSYS_STATISTICS_CLR   __DIOF(_DCMD_FSYS,  12, struct fs_stats)

Arguments to devctl():

Argument Value
filedes A file descriptor that you obtained by opening the device.
dcmd DCMD_FSYS_STATISTICS or DCMD_FSYS_STATISTICS_CLR
dev_data_ptr A pointer to a struct fs_stats
n_bytes sizeof(struct fs_stats)
dev_info_ptr NULL

Description:

These commands get statistics about the filesystem associated with the given file descriptor. DCMD_FSYS_STATISTICS_CLR sets the counters to zero after returning their values. The fsysinfo utility is a front end for DCMD_FSYS_STATISTICS.

In order to use these commands, your process needs to have the vfs/stats-clear (BLK_ABILITY_STATSCLEAR) custom ability enabled. For more information, see procmgr_ability() and procmgr_ability_lookup() in the C Library Reference.

Input:

None.

Output:

A filled-in struct fs_stats, which is defined in <sys/fs_stats.h> as follows:

struct fs_stats {
    /* Version and Time statistics */
    uint32_t    s_version;              /* Lib version (BLKIO_VERSION)   */
    uint32_t    s_fsys_flags;           /* Fsys mount flags (_MOUNT_*)   */
    uint32_t    s_time_mount;           /* Time that file system mounted */
    uint32_t    s_time_clr;             /* Time that statistics cleared  */

    /* Buffer/DiskIO statistics    */
    uint64_t    s_buf_rphys;            /* Physical reads from disk    */
    uint64_t    s_buf_wphys;            /* Physical writes to disk     */
    uint64_t    s_buf_readahead;        /* Physical predictive reads   */
    uint64_t    s_buf_direct;           /* Physical direct-io accesses */
    uint64_t    s_buf_badblks;          /* Physical IO errors          */
    uint64_t    s_buf_rcache;           /* Cache reads (read hits)     */
    uint64_t    s_buf_wcache;           /* Cache writes (write-behind) */
    uint64_t    s_buf_mru;              /* MRU cache kB (GLOBAL)       */
    uint64_t    s_buf_mfu;              /* MFU cache kB (GLOBAL)       */

    /* Name cache statistics       */
    uint64_t    s_name_poshits;         /* Positive hits (usable hit)        */
    uint64_t    s_name_neghits;         /* Negative hits (usable hit)        */
    uint64_t    s_name_misses;          /* Misses (not in cache)             */
    uint64_t    s_name_uncacheable;     /* Names not considered (long/ambig) */
    uint64_t    s_name_stale;           /* Stale hits (GLOBAL)               */

    /* System call API statistics  */
    uint64_t    s_syscall_open;         /* Number of open()s        */
    uint64_t    s_syscall_stat;         /* Number of stat()s        */
    uint64_t    s_syscall_namei;        /* Number of name lookups   */
    uint64_t    s_syscall_read;         /* Number of read() calls   */
    uint64_t    s_syscall_write;        /* Number of write() calls  */
    uint64_t    s_syscall_devctl;       /* Number of devctl() calls */
    uint64_t    s_syscall_create;       /* Number of file creations */
    uint64_t    s_syscall_unlink;       /* Number of file deletions */

    /* Mapping cache statistics    */
    uint64_t    s_map_hits;             /* Usable hits           */
    uint64_t    s_map_misses;           /* Misses (not in cache) */

    /* Vnode statistics            */
    uint64_t    s_vnode_create;         /* Created vnode (unique file) */
    uint64_t    s_vnode_hits;           /* Usable vnode hit            */
    uint64_t    s_vnode_lock;           /* Vnodes locked               */
    uint64_t    s_vnode_recycle;        /* Reused vnode (GLOBAL)       */

    /* Slab/memory statistics      */
    uint64_t    s_slab_pg_map;          /* Memory pages mapped (GLOBAL)   */
    uint64_t    s_slab_pg_unmap;        /* Memory pages unmapped (GLOBAL) */

    /* Thread pool statistics      */
    uint64_t    s_tid_pool_create;      /* Threads created (GLOBAL)   */
    uint64_t    s_tid_pool_destroy;     /* Threads destroyed (GLOBAL) */

    /* New statistics added June, 2011 */
    uint64_t    s_buf_rcache_bytes;     /* Bytes read from the cache        */
    uint64_t    s_buf_wcache_bytes;     /* Bytes written into the cache     */
    uint64_t    s_buf_rphys_bytes;      /* Physical bytes read from disk    */
    uint64_t    s_buf_wphys_bytes;      /* Physical bytes written to disk   */
    uint64_t    s_buf_readahead_bytes;  /* Physical bytes from read ahead   */
    uint64_t    s_buf_direct_bytes;     /* Physical bytes R/W direct-io     */
    uint64_t    s_buf_io_count;         /* Count of IO requests created     */
    uint64_t    s_buf_io_bytes;         /* Total bytes of io requests       */

    uint64_t    s_syscall_read_bytes;   /* Number of bytes read via read()  */
    uint64_t    s_syscall_write_bytes;  /* Number of bytes wrote via write()*/

    uint64_t    s_syscall_trunc;        /* Number of truncate() calls       */
    uint64_t    s_syscall_rename;       /* Number of rename() calls         */
    uint64_t    s_syscall_owner;        /* chown/chgrp calls                */
    uint64_t    s_syscall_modes;        /* chmod calls                      */
    uint64_t    s_syscall_sync;         /* Number of sync() calls           */

    uint64_t    s_vfs_relearn;          /* Count of relearn events          */
    uint64_t    s_vfs_periodic;         /* Periodic call count into the fs  */

    uint64_t    s_msg_resume;           /* Number of message resume ops     */

    /* Spares (new statistics)     */
    uint64_t    s_spare[13];
};
Note: The s_time_mount and s_time_clr members are specified as 32-bit time fields for backwards compatibility and are subject to rollover in 2038.

See also:

devctl() in the QNX Neutrino C Library Reference

fsysinfo in the QNX Neutrino Utilities Reference