stats.h 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. #ifndef _BCACHE_STATS_H_
  2. #define _BCACHE_STATS_H_
  3. struct cache_stat_collector {
  4. atomic_t cache_hits;
  5. atomic_t cache_misses;
  6. atomic_t cache_bypass_hits;
  7. atomic_t cache_bypass_misses;
  8. atomic_t cache_readaheads;
  9. atomic_t cache_miss_collisions;
  10. atomic_t sectors_bypassed;
  11. };
  12. struct cache_stats {
  13. struct kobject kobj;
  14. unsigned long cache_hits;
  15. unsigned long cache_misses;
  16. unsigned long cache_bypass_hits;
  17. unsigned long cache_bypass_misses;
  18. unsigned long cache_readaheads;
  19. unsigned long cache_miss_collisions;
  20. unsigned long sectors_bypassed;
  21. unsigned rescale;
  22. };
  23. struct cache_accounting {
  24. struct closure cl;
  25. struct timer_list timer;
  26. atomic_t closing;
  27. struct cache_stat_collector collector;
  28. struct cache_stats total;
  29. struct cache_stats five_minute;
  30. struct cache_stats hour;
  31. struct cache_stats day;
  32. };
  33. struct search;
  34. void bch_cache_accounting_init(struct cache_accounting *acc,
  35. struct closure *parent);
  36. int bch_cache_accounting_add_kobjs(struct cache_accounting *acc,
  37. struct kobject *parent);
  38. void bch_cache_accounting_clear(struct cache_accounting *acc);
  39. void bch_cache_accounting_destroy(struct cache_accounting *acc);
  40. void bch_mark_cache_accounting(struct search *s, bool hit, bool bypass);
  41. void bch_mark_cache_readahead(struct search *s);
  42. void bch_mark_cache_miss_collision(struct search *s);
  43. void bch_mark_sectors_bypassed(struct search *s, int sectors);
  44. #endif /* _BCACHE_STATS_H_ */