stats.h 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  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 cache_set;
  34. struct cached_dev;
  35. struct bcache_device;
  36. void bch_cache_accounting_init(struct cache_accounting *acc,
  37. struct closure *parent);
  38. int bch_cache_accounting_add_kobjs(struct cache_accounting *acc,
  39. struct kobject *parent);
  40. void bch_cache_accounting_clear(struct cache_accounting *acc);
  41. void bch_cache_accounting_destroy(struct cache_accounting *acc);
  42. void bch_mark_cache_accounting(struct cache_set *, struct bcache_device *,
  43. bool, bool);
  44. void bch_mark_cache_readahead(struct cache_set *, struct bcache_device *);
  45. void bch_mark_cache_miss_collision(struct cache_set *, struct bcache_device *);
  46. void bch_mark_sectors_bypassed(struct cache_set *, struct cached_dev *, int);
  47. #endif /* _BCACHE_STATS_H_ */