00001 #ifndef VM_STATS_H 00002 #define VM_STATS_H 00003 00004 /* UW specific code - This won't be needed or used until assignment 3 */ 00005 00006 /* belongs in kern/include/uw-vmstat.h */ 00007 00008 /* ----------------------------------------------------------------------- */ 00009 /* Virtual memory stats */ 00010 /* Tracks stats on user programs */ 00011 00012 /* NOTE !!!!!! WARNING !!!!! 00013 * All of the functions (except vmstats_print) whose names begin with '_' 00014 * assume that atomicity is ensured elsewhere 00015 * (i.e., outside of these routines) by acquiring stats_lock. 00016 * All of the functions whose names do not begin 00017 * with '_' ensure atomicity locally (except vmstats_print). 00018 * 00019 * Generally you will use the functions whose names 00020 * do not begin with '_'. 00021 */ 00022 00023 00024 /* These are the different stats that get tracked. 00025 * See vmstats.c for strings corresponding to each stat. 00026 */ 00027 00028 /* DO NOT ADD OR CHANGE WITHOUT ALSO CHANGING vmstats.h */ 00029 #define VMSTAT_TLB_FAULT (0) 00030 #define VMSTAT_TLB_FAULT_FREE (1) 00031 #define VMSTAT_TLB_FAULT_REPLACE (2) 00032 #define VMSTAT_TLB_INVALIDATE (3) 00033 #define VMSTAT_TLB_RELOAD (4) 00034 #define VMSTAT_PAGE_FAULT_ZERO (5) 00035 #define VMSTAT_PAGE_FAULT_DISK (6) 00036 #define VMSTAT_ELF_FILE_READ (7) 00037 #define VMSTAT_SWAP_FILE_READ (8) 00038 #define VMSTAT_SWAP_FILE_WRITE (9) 00039 #define VMSTAT_COUNT (10) 00040 00041 /* ----------------------------------------------------------------------- */ 00042 00043 /* Initialize the statistics: must be called before using */ 00044 void vmstats_init(void); /* uses locking */ 00045 void _vmstats_init(void); /* atomicity must be ensured elsewhere */ 00046 00047 /* Increment the specified count 00048 * Example use: 00049 * vmstats_inc(VMSTAT_TLB_FAULT); 00050 * vmstats_inc(VMSTAT_PAGE_FAULT_ZERO); 00051 */ 00052 void vmstats_inc(unsigned int index); /* uses locking */ 00053 void _vmstats_inc(unsigned int index); /* atomicity must be ensured elsewhere */ 00054 00055 /* Print the statistics: assumes that at least vmstats_init has been called */ 00056 void vmstats_print(void); /* Does NOT use locking */ 00057 00058 #endif /* VM_STATS_H */