mm_event.h 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. #undef TRACE_SYSTEM
  2. #define TRACE_SYSTEM mm_event
  3. #if !defined(_TRACE_MM_EVENT_H) || defined(TRACE_HEADER_MULTI_READ)
  4. #define _TRACE_MM_EVENT_H
  5. #include <linux/types.h>
  6. #include <linux/tracepoint.h>
  7. #include <linux/mm.h>
  8. #include <linux/mm_event.h>
  9. struct mm_event_task;
  10. struct mm_event_vmstat;
  11. #define show_mm_event_type(type) \
  12. __print_symbolic(type, \
  13. { MM_MIN_FAULT, "min_flt" }, \
  14. { MM_MAJ_FAULT, "maj_flt" }, \
  15. { MM_READ_IO, "read_io" }, \
  16. { MM_COMPACTION, "compaction" }, \
  17. { MM_RECLAIM, "reclaim" }, \
  18. { MM_SWP_FAULT, "swp_flt" }, \
  19. { MM_KERN_ALLOC, "kern_alloc" })
  20. TRACE_EVENT(mm_event_record,
  21. TP_PROTO(enum mm_event_type type, struct mm_event_task *record),
  22. TP_ARGS(type, record),
  23. TP_STRUCT__entry(
  24. __field(enum mm_event_type, type)
  25. __field(unsigned int, count)
  26. __field(unsigned int, avg_lat)
  27. __field(unsigned int, max_lat)
  28. ),
  29. TP_fast_assign(
  30. __entry->type = type;
  31. __entry->count = record->count;
  32. __entry->avg_lat = record->accm_lat / record->count;
  33. __entry->max_lat = record->max_lat;
  34. ),
  35. TP_printk("%s count=%d avg_lat=%u max_lat=%u",
  36. show_mm_event_type(__entry->type),
  37. __entry->count, __entry->avg_lat,
  38. __entry->max_lat)
  39. );
  40. TRACE_EVENT(mm_event_vmstat_record,
  41. TP_PROTO(struct mm_event_vmstat *vmstat),
  42. TP_ARGS(vmstat),
  43. TP_STRUCT__entry(
  44. __field(unsigned long, free)
  45. __field(unsigned long, file)
  46. __field(unsigned long, anon)
  47. __field(unsigned long, ion)
  48. __field(unsigned long, slab)
  49. __field(unsigned long, ws_refault)
  50. __field(unsigned long, ws_activate)
  51. __field(unsigned long, mapped)
  52. __field(unsigned long, pgin)
  53. __field(unsigned long, pgout)
  54. __field(unsigned long, swpin)
  55. __field(unsigned long, swpout)
  56. __field(unsigned long, reclaim_steal)
  57. __field(unsigned long, reclaim_scan)
  58. __field(unsigned long, compact_scan)
  59. ),
  60. TP_fast_assign(
  61. __entry->free = vmstat->free;
  62. __entry->file = vmstat->file;
  63. __entry->anon = vmstat->anon;
  64. __entry->ion = vmstat->ion;
  65. __entry->slab = vmstat->slab;
  66. __entry->ws_refault = vmstat->ws_refault;
  67. __entry->ws_activate = vmstat->ws_activate;
  68. __entry->mapped = vmstat->mapped;
  69. __entry->pgin = vmstat->pgin;
  70. __entry->pgout = vmstat->pgout;
  71. __entry->swpin = vmstat->swpin;
  72. __entry->swpout = vmstat->swpout;
  73. __entry->reclaim_steal = vmstat->reclaim_steal;
  74. __entry->reclaim_scan = vmstat->reclaim_scan;
  75. __entry->compact_scan = vmstat->compact_scan;
  76. ),
  77. TP_printk("free=%lu file=%lu anon=%lu ion=%lu slab=%lu ws_refault=%lu "
  78. "ws_activate=%lu mapped=%lu pgin=%lu pgout=%lu swpin=%lu "
  79. "swpout=%lu reclaim_steal=%lu reclaim_scan=%lu compact_scan=%lu",
  80. __entry->free, __entry->file,
  81. __entry->anon, __entry->ion, __entry->slab,
  82. __entry->ws_refault, __entry->ws_activate,
  83. __entry->mapped, __entry->pgin, __entry->pgout,
  84. __entry->swpin, __entry->swpout,
  85. __entry->reclaim_steal, __entry->reclaim_scan,
  86. __entry->compact_scan)
  87. );
  88. #endif /* _TRACE_MM_EVENT_H */
  89. /* This part must be outside protection */
  90. #include <trace/define_trace.h>