X-Git-Url: http://git.liburcu.org/?a=blobdiff_plain;f=instrumentation%2Fevents%2Flttng-module%2Fcompaction.h;h=7914e234c471631fe927ef9ec9c301aa22e2c2e3;hb=b2e8674f96ff516d52f49e27e5e9d8bfccac27da;hp=1b237fa45ab069141e2e8b6db745daa6edb9f9bb;hpb=b87700e318c27267890cbd6fb5e50b687279131b;p=lttng-modules.git diff --git a/instrumentation/events/lttng-module/compaction.h b/instrumentation/events/lttng-module/compaction.h index 1b237fa4..7914e234 100644 --- a/instrumentation/events/lttng-module/compaction.h +++ b/instrumentation/events/lttng-module/compaction.h @@ -1,14 +1,69 @@ #undef TRACE_SYSTEM #define TRACE_SYSTEM compaction -#if !defined(_TRACE_COMPACTION_H) || defined(TRACE_HEADER_MULTI_READ) -#define _TRACE_COMPACTION_H +#if !defined(LTTNG_TRACE_COMPACTION_H) || defined(TRACE_HEADER_MULTI_READ) +#define LTTNG_TRACE_COMPACTION_H +#include "../../../probes/lttng-tracepoint-event.h" #include -#include +#include #include -DECLARE_EVENT_CLASS(mm_compaction_isolate_template, +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,0,0) + +LTTNG_TRACEPOINT_EVENT_CLASS(mm_compaction_isolate_template, + + TP_PROTO(unsigned long start_pfn, + unsigned long end_pfn, + unsigned long nr_scanned, + unsigned long nr_taken), + + TP_ARGS(start_pfn, end_pfn, nr_scanned, nr_taken), + + TP_STRUCT__entry( + __field(unsigned long, start_pfn) + __field(unsigned long, end_pfn) + __field(unsigned long, nr_scanned) + __field(unsigned long, nr_taken) + ), + + TP_fast_assign( + tp_assign(start_pfn, start_pfn) + tp_assign(end_pfn, end_pfn) + tp_assign(nr_scanned, nr_scanned) + tp_assign(nr_taken, nr_taken) + ), + + TP_printk("range=(0x%lx ~ 0x%lx) nr_scanned=%lu nr_taken=%lu", + __entry->start_pfn, + __entry->end_pfn, + __entry->nr_scanned, + __entry->nr_taken) +) + +LTTNG_TRACEPOINT_EVENT_INSTANCE(mm_compaction_isolate_template, mm_compaction_isolate_migratepages, + + TP_PROTO(unsigned long start_pfn, + unsigned long end_pfn, + unsigned long nr_scanned, + unsigned long nr_taken), + + TP_ARGS(start_pfn, end_pfn, nr_scanned, nr_taken) +) + +LTTNG_TRACEPOINT_EVENT_INSTANCE(mm_compaction_isolate_template, mm_compaction_isolate_freepages, + + TP_PROTO(unsigned long start_pfn, + unsigned long end_pfn, + unsigned long nr_scanned, + unsigned long nr_taken), + + TP_ARGS(start_pfn, end_pfn, nr_scanned, nr_taken) +) + +#else /* #if LINUX_VERSION_CODE >= KERNEL_VERSION(4,0,0) */ + +LTTNG_TRACEPOINT_EVENT_CLASS(mm_compaction_isolate_template, TP_PROTO(unsigned long nr_scanned, unsigned long nr_taken), @@ -30,7 +85,7 @@ DECLARE_EVENT_CLASS(mm_compaction_isolate_template, __entry->nr_taken) ) -DEFINE_EVENT(mm_compaction_isolate_template, mm_compaction_isolate_migratepages, +LTTNG_TRACEPOINT_EVENT_INSTANCE(mm_compaction_isolate_template, mm_compaction_isolate_migratepages, TP_PROTO(unsigned long nr_scanned, unsigned long nr_taken), @@ -38,14 +93,60 @@ DEFINE_EVENT(mm_compaction_isolate_template, mm_compaction_isolate_migratepages, TP_ARGS(nr_scanned, nr_taken) ) -DEFINE_EVENT(mm_compaction_isolate_template, mm_compaction_isolate_freepages, +LTTNG_TRACEPOINT_EVENT_INSTANCE(mm_compaction_isolate_template, mm_compaction_isolate_freepages, TP_PROTO(unsigned long nr_scanned, unsigned long nr_taken), TP_ARGS(nr_scanned, nr_taken) ) -TRACE_EVENT(mm_compaction_migratepages, +#endif /* #else #if LINUX_VERSION_CODE >= KERNEL_VERSION(4,0,0) */ + +#if LTTNG_KERNEL_RANGE(3,12,30, 3,13,0) || \ + LTTNG_KERNEL_RANGE(3,14,25, 3,15,0) || \ + (LINUX_VERSION_CODE >= KERNEL_VERSION(3,16,0)) +LTTNG_TRACEPOINT_EVENT(mm_compaction_migratepages, + + TP_PROTO(unsigned long nr_all, + int migrate_rc, + struct list_head *migratepages), + + TP_ARGS(nr_all, migrate_rc, migratepages), + + TP_STRUCT__entry( + __field(unsigned long, nr_migrated) + __field(unsigned long, nr_failed) + ), + + TP_fast_assign( + tp_assign(nr_migrated, + nr_all - + (migrate_rc >= 0 ? migrate_rc : + ({ + unsigned long nr_failed = 0; + struct list_head *page_lru; + + list_for_each(page_lru, migratepages) + nr_failed++; + nr_failed; + }))) + tp_assign(nr_failed, + ({ + unsigned long nr_failed = 0; + struct list_head *page_lru; + + list_for_each(page_lru, migratepages) + nr_failed++; + nr_failed; + })) + ), + + TP_printk("nr_migrated=%lu nr_failed=%lu", + __entry->nr_migrated, + __entry->nr_failed) +) +#else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,16,0)) */ +LTTNG_TRACEPOINT_EVENT(mm_compaction_migratepages, TP_PROTO(unsigned long nr_migrated, unsigned long nr_failed), @@ -66,9 +167,9 @@ TRACE_EVENT(mm_compaction_migratepages, __entry->nr_migrated, __entry->nr_failed) ) +#endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,16,0)) */ - -#endif /* _TRACE_COMPACTION_H */ +#endif /* LTTNG_TRACE_COMPACTION_H */ /* This part must be outside protection */ #include "../../../probes/define_trace.h"