1 /* 2 * coda_statis.h 3 * 4 * CODA operation statistics 5 * 6 * (c) March, 1998 7 * by Michihiro Kuramochi, Zhenyu Xia and Zhanyong Wan 8 * zhanyong.wan@yale.edu 9 * 10 */ 11 12 #ifndef _CODA_PROC_H 13 #define _CODA_PROC_H 14 15 void coda_sysctl_init(void); 16 void coda_sysctl_clean(void); 17 void coda_upcall_stats(int opcode, unsigned long jiffies); 18 19 #include <linux/sysctl.h> 20 #include <linux/coda_fs_i.h> 21 #include <linux/coda.h> 22 23 /* these four files are presented to show the result of the statistics: 24 * 25 * /proc/fs/coda/vfs_stats 26 * upcall_stats 27 * permission_stats 28 * cache_inv_stats 29 * 30 * these four files are presented to reset the statistics to 0: 31 * 32 * /proc/sys/coda/vfs_stats 33 * upcall_stats 34 * permission_stats 35 * cache_inv_stats 36 */ 37 38 /* VFS operation statistics */ 39 struct coda_vfs_stats 40 { 41 /* file operations */ 42 int open; 43 int flush; 44 int release; 45 int fsync; 46 47 /* dir operations */ 48 int readdir; 49 50 /* inode operations */ 51 int create; 52 int lookup; 53 int link; 54 int unlink; 55 int symlink; 56 int mkdir; 57 int rmdir; 58 int rename; 59 int permission; 60 61 /* symlink operatoins*/ 62 int follow_link; 63 int readlink; 64 }; 65 66 struct coda_upcall_stats_entry 67 { 68 int count; 69 unsigned long time_sum; 70 unsigned long time_squared_sum; 71 }; 72 73 74 75 /* cache hits for permissions statistics */ 76 struct coda_permission_stats 77 { 78 int count; 79 int hit_count; 80 }; 81 82 /* cache invalidation statistics */ 83 struct coda_cache_inv_stats 84 { 85 int flush; 86 int purge_user; 87 int zap_dir; 88 int zap_file; 89 int zap_vnode; 90 int purge_fid; 91 int replace; 92 }; 93 94 /* these global variables hold the actual statistics data */ 95 extern struct coda_vfs_stats coda_vfs_stat; 96 extern struct coda_permission_stats coda_permission_stat; 97 extern struct coda_cache_inv_stats coda_cache_inv_stat; 98 extern int coda_upcall_timestamping; 99 100 /* reset statistics to 0 */ 101 void reset_coda_vfs_stats( void ); 102 void reset_coda_upcall_stats( void ); 103 void reset_coda_permission_stats( void ); 104 void reset_coda_cache_inv_stats( void ); 105 106 /* some utitlities to make it easier for you to do statistics for time */ 107 void do_time_stats( struct coda_upcall_stats_entry * pentry, 108 unsigned long jiffy ); 109 /* 110 double get_time_average( const struct coda_upcall_stats_entry * pentry ); 111 double get_time_std_deviation( const struct coda_upcall_stats_entry * pentry ); 112 */ 113 unsigned long get_time_average( const struct coda_upcall_stats_entry * pentry ); 114 unsigned long get_time_std_deviation( const struct coda_upcall_stats_entry * pentry ); 115 116 /* like coda_dointvec, these functions are to be registered in the ctl_table 117 * data structure for /proc/sys/... files 118 */ 119 int do_reset_coda_vfs_stats( ctl_table * table, int write, struct file * filp, 120 void * buffer, size_t * lenp ); 121 int do_reset_coda_upcall_stats( ctl_table * table, int write, 122 struct file * filp, void * buffer, 123 size_t * lenp ); 124 int do_reset_coda_permission_stats( ctl_table * table, int write, 125 struct file * filp, void * buffer, 126 size_t * lenp ); 127 int do_reset_coda_cache_inv_stats( ctl_table * table, int write, 128 struct file * filp, void * buffer, 129 size_t * lenp ); 130 131 /* these functions are called to form the content of /proc/fs/coda/... files */ 132 int coda_vfs_stats_get_info( char * buffer, char ** start, off_t offset, 133 int length); 134 int coda_upcall_stats_get_info( char * buffer, char ** start, off_t offset, 135 int length); 136 int coda_permission_stats_get_info( char * buffer, char ** start, off_t offset, 137 int length); 138 int coda_cache_inv_stats_get_info( char * buffer, char ** start, off_t offset, 139 int length); 140 141 142 #endif /* _CODA_PROC_H */ 143