ebpf_dcstat.h 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. // SPDX-License-Identifier: GPL-3.0-or-later
  2. #ifndef NETDATA_EBPF_DCSTAT_H
  3. #define NETDATA_EBPF_DCSTAT_H 1
  4. // charts
  5. #define NETDATA_DC_HIT_CHART "dc_hit_ratio"
  6. #define NETDATA_DC_REFERENCE_CHART "dc_reference"
  7. #define NETDATA_DC_REQUEST_NOT_CACHE_CHART "dc_not_cache"
  8. #define NETDATA_DC_REQUEST_NOT_FOUND_CHART "dc_not_found"
  9. #define NETDATA_DIRECTORY_CACHE_SUBMENU "directory cache (eBPF)"
  10. #define NETDATA_DIRECTORY_FILESYSTEM_SUBMENU "Directory Cache (eBPF)"
  11. // configuration file
  12. #define NETDATA_DIRECTORY_DCSTAT_CONFIG_FILE "dcstat.conf"
  13. #define NETDATA_LATENCY_DCSTAT_SLEEP_MS 700000ULL
  14. enum directory_cache_indexes {
  15. NETDATA_DCSTAT_IDX_RATIO,
  16. NETDATA_DCSTAT_IDX_REFERENCE,
  17. NETDATA_DCSTAT_IDX_SLOW,
  18. NETDATA_DCSTAT_IDX_MISS,
  19. // Keep this as last and don't skip numbers as it is used as element counter
  20. NETDATA_DCSTAT_IDX_END
  21. };
  22. enum directory_cache_tables {
  23. NETDATA_DCSTAT_GLOBAL_STATS,
  24. NETDATA_DCSTAT_PID_STATS
  25. };
  26. // variables
  27. enum directory_cache_counters {
  28. NETDATA_KEY_DC_REFERENCE,
  29. NETDATA_KEY_DC_SLOW,
  30. NETDATA_KEY_DC_MISS,
  31. // Keep this as last and don't skip numbers as it is used as element counter
  32. NETDATA_DIRECTORY_CACHE_END
  33. };
  34. typedef struct netdata_publish_dcstat_pid {
  35. uint64_t cache_access;
  36. uint64_t file_system;
  37. uint64_t not_found;
  38. } netdata_dcstat_pid_t;
  39. typedef struct netdata_publish_dcstat {
  40. long long ratio;
  41. long long cache_access;
  42. netdata_dcstat_pid_t curr;
  43. netdata_dcstat_pid_t prev;
  44. } netdata_publish_dcstat_t;
  45. extern void *ebpf_dcstat_thread(void *ptr);
  46. extern void ebpf_dcstat_create_apps_charts(struct ebpf_module *em, void *ptr);
  47. extern void clean_dcstat_pid_structures();
  48. extern struct config dcstat_config;
  49. #endif // NETDATA_EBPF_DCSTAT_H