latencytop.h 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. /*
  3. * latencytop.h: Infrastructure for displaying latency
  4. *
  5. * (C) Copyright 2008 Intel Corporation
  6. * Author: Arjan van de Ven <arjan@linux.intel.com>
  7. *
  8. */
  9. #ifndef _INCLUDE_GUARD_LATENCYTOP_H_
  10. #define _INCLUDE_GUARD_LATENCYTOP_H_
  11. #include <linux/compiler.h>
  12. struct task_struct;
  13. #ifdef CONFIG_LATENCYTOP
  14. #define LT_SAVECOUNT 32
  15. #define LT_BACKTRACEDEPTH 12
  16. struct latency_record {
  17. unsigned long backtrace[LT_BACKTRACEDEPTH];
  18. unsigned int count;
  19. unsigned long time;
  20. unsigned long max;
  21. };
  22. extern int latencytop_enabled;
  23. void __account_scheduler_latency(struct task_struct *task, int usecs, int inter);
  24. static inline void
  25. account_scheduler_latency(struct task_struct *task, int usecs, int inter)
  26. {
  27. if (unlikely(latencytop_enabled))
  28. __account_scheduler_latency(task, usecs, inter);
  29. }
  30. void clear_all_latency_tracing(struct task_struct *p);
  31. extern int sysctl_latencytop(struct ctl_table *table, int write,
  32. void __user *buffer, size_t *lenp, loff_t *ppos);
  33. #else
  34. static inline void
  35. account_scheduler_latency(struct task_struct *task, int usecs, int inter)
  36. {
  37. }
  38. static inline void clear_all_latency_tracing(struct task_struct *p)
  39. {
  40. }
  41. #endif
  42. #endif