trace_stat.h 992 B

12345678910111213141516171819202122232425262728293031323334
  1. // SPDX-License-Identifier: GPL-2.0
  2. #ifndef __TRACE_STAT_H
  3. #define __TRACE_STAT_H
  4. #include <linux/seq_file.h>
  5. /*
  6. * If you want to provide a stat file (one-shot statistics), fill
  7. * an iterator with stat_start/stat_next and a stat_show callbacks.
  8. * The others callbacks are optional.
  9. */
  10. struct tracer_stat {
  11. /* The name of your stat file */
  12. const char *name;
  13. /* Iteration over statistic entries */
  14. void *(*stat_start)(struct tracer_stat *trace);
  15. void *(*stat_next)(void *prev, int idx);
  16. /* Compare two entries for stats sorting */
  17. cmp_func_t stat_cmp;
  18. /* Print a stat entry */
  19. int (*stat_show)(struct seq_file *s, void *p);
  20. /* Release an entry */
  21. void (*stat_release)(void *stat);
  22. /* Print the headers of your stat entries */
  23. int (*stat_headers)(struct seq_file *s);
  24. };
  25. /*
  26. * Destroy or create a stat file
  27. */
  28. extern int register_stat_tracer(struct tracer_stat *trace);
  29. extern void unregister_stat_tracer(struct tracer_stat *trace);
  30. #endif /* __TRACE_STAT_H */