uw-vmstats.h 2.0 KB

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