/* [<][>][^][v][top][bottom][index][help] */
1 #ifndef VM_STATS_H
2 #define VM_STATS_H
3
4 /* UW specific code - This won't be needed or used until assignment 3 */
5
6 /* belongs in kern/include/uw-vmstat.h */
7
8 /* ----------------------------------------------------------------------- */
9 /* Virtual memory stats */
10 /* Tracks stats on user programs */
11
12 /* NOTE !!!!!! WARNING !!!!!
13 * All of the functions (except vmstats_print) whose names begin with '_'
14 * assume that atomicity is ensured elsewhere
15 * (i.e., outside of these routines) by acquiring stats_lock.
16 * All of the functions whose names do not begin
17 * with '_' ensure atomicity locally (except vmstats_print).
18 *
19 * Generally you will use the functions whose names
20 * do not begin with '_'.
21 */
22
23
24 /* These are the different stats that get tracked.
25 * See vmstats.c for strings corresponding to each stat.
26 */
27
28 /* DO NOT ADD OR CHANGE WITHOUT ALSO CHANGING vmstats.h */
29 #define VMSTAT_TLB_FAULT (0)
30 #define VMSTAT_TLB_FAULT_FREE (1)
31 #define VMSTAT_TLB_FAULT_REPLACE (2)
32 #define VMSTAT_TLB_INVALIDATE (3)
33 #define VMSTAT_TLB_RELOAD (4)
34 #define VMSTAT_PAGE_FAULT_ZERO (5)
35 #define VMSTAT_PAGE_FAULT_DISK (6)
36 #define VMSTAT_ELF_FILE_READ (7)
37 #define VMSTAT_SWAP_FILE_READ (8)
38 #define VMSTAT_SWAP_FILE_WRITE (9)
39 #define VMSTAT_COUNT (10)
40
41 /* ----------------------------------------------------------------------- */
42
43 /* Initialize the statistics: must be called before using */
44 void vmstats_init(void); /* uses locking */
45 void _vmstats_init(void); /* atomicity must be ensured elsewhere */
46
47 /* Increment the specified count
48 * Example use:
49 * vmstats_inc(VMSTAT_TLB_FAULT);
50 * vmstats_inc(VMSTAT_PAGE_FAULT_ZERO);
51 */
52 void vmstats_inc(unsigned int index); /* uses locking */
53 void _vmstats_inc(unsigned int index); /* atomicity must be ensured elsewhere */
54
55 /* Print the statistics: assumes that at least vmstats_init has been called */
56 void vmstats_print(void); /* Does NOT use locking */
57
58 #endif /* VM_STATS_H */