latencytop.h 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  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 <[email protected]>
  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_tsk_latency_tracing(struct task_struct *p);
  31. #else
  32. static inline void
  33. account_scheduler_latency(struct task_struct *task, int usecs, int inter)
  34. {
  35. }
  36. static inline void clear_tsk_latency_tracing(struct task_struct *p)
  37. {
  38. }
  39. #endif
  40. #endif