diff options
| author | Eduard - Gabriel Munteanu <eduard.munteanu@linux360.ro> | 2009-03-23 09:12:24 -0400 |
|---|---|---|
| committer | Ingo Molnar <mingo@elte.hu> | 2009-04-03 06:23:06 -0400 |
| commit | ca2b84cb3c4a0d4d2143b46ec072cdff5d1b3b87 (patch) | |
| tree | 7163bac040f11c444b24cab53c4a784df73fa4f3 /include/trace | |
| parent | ac44021fccd8f1f2b267b004f23a2e8d7ef05f7b (diff) | |
kmemtrace: use tracepoints
kmemtrace now uses tracepoints instead of markers. We no longer need to
use format specifiers to pass arguments.
Signed-off-by: Eduard - Gabriel Munteanu <eduard.munteanu@linux360.ro>
[ folded: Use the new TP_PROTO and TP_ARGS to fix the build. ]
[ folded: fix build when CONFIG_KMEMTRACE is disabled. ]
[ folded: define tracepoints when CONFIG_TRACEPOINTS is enabled. ]
Signed-off-by: Pekka Enberg <penberg@cs.helsinki.fi>
LKML-Reference: <ae61c0f37156db8ec8dc0d5778018edde60a92e3.1237813499.git.eduard.munteanu@linux360.ro>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'include/trace')
| -rw-r--r-- | include/trace/kmemtrace.h | 92 |
1 files changed, 40 insertions, 52 deletions
diff --git a/include/trace/kmemtrace.h b/include/trace/kmemtrace.h index ad8b7857855a..28ee69f9cd46 100644 --- a/include/trace/kmemtrace.h +++ b/include/trace/kmemtrace.h | |||
| @@ -9,65 +9,53 @@ | |||
| 9 | 9 | ||
| 10 | #ifdef __KERNEL__ | 10 | #ifdef __KERNEL__ |
| 11 | 11 | ||
| 12 | #include <linux/tracepoint.h> | ||
| 12 | #include <linux/types.h> | 13 | #include <linux/types.h> |
| 13 | #include <linux/marker.h> | ||
| 14 | |||
| 15 | enum kmemtrace_type_id { | ||
| 16 | KMEMTRACE_TYPE_KMALLOC = 0, /* kmalloc() or kfree(). */ | ||
| 17 | KMEMTRACE_TYPE_CACHE, /* kmem_cache_*(). */ | ||
| 18 | KMEMTRACE_TYPE_PAGES, /* __get_free_pages() and friends. */ | ||
| 19 | }; | ||
| 20 | 14 | ||
| 21 | #ifdef CONFIG_KMEMTRACE | 15 | #ifdef CONFIG_KMEMTRACE |
| 22 | |||
| 23 | extern void kmemtrace_init(void); | 16 | extern void kmemtrace_init(void); |
| 24 | 17 | #else | |
| 25 | extern void kmemtrace_mark_alloc_node(enum kmemtrace_type_id type_id, | ||
| 26 | unsigned long call_site, | ||
| 27 | const void *ptr, | ||
| 28 | size_t bytes_req, | ||
| 29 | size_t bytes_alloc, | ||
| 30 | gfp_t gfp_flags, | ||
| 31 | int node); | ||
| 32 | |||
| 33 | extern void kmemtrace_mark_free(enum kmemtrace_type_id type_id, | ||
| 34 | unsigned long call_site, | ||
| 35 | const void *ptr); | ||
| 36 | |||
| 37 | #else /* CONFIG_KMEMTRACE */ | ||
| 38 | |||
| 39 | static inline void kmemtrace_init(void) | 18 | static inline void kmemtrace_init(void) |
| 40 | { | 19 | { |
| 41 | } | 20 | } |
| 42 | 21 | #endif | |
| 43 | static inline void kmemtrace_mark_alloc_node(enum kmemtrace_type_id type_id, | 22 | |
| 44 | unsigned long call_site, | 23 | DECLARE_TRACE(kmalloc, |
| 45 | const void *ptr, | 24 | TP_PROTO(unsigned long call_site, |
| 46 | size_t bytes_req, | 25 | const void *ptr, |
| 47 | size_t bytes_alloc, | 26 | size_t bytes_req, |
| 48 | gfp_t gfp_flags, | 27 | size_t bytes_alloc, |
| 49 | int node) | 28 | gfp_t gfp_flags), |
| 50 | { | 29 | TP_ARGS(call_site, ptr, bytes_req, bytes_alloc, gfp_flags)); |
| 51 | } | 30 | DECLARE_TRACE(kmem_cache_alloc, |
| 52 | 31 | TP_PROTO(unsigned long call_site, | |
| 53 | static inline void kmemtrace_mark_free(enum kmemtrace_type_id type_id, | 32 | const void *ptr, |
| 54 | unsigned long call_site, | 33 | size_t bytes_req, |
| 55 | const void *ptr) | 34 | size_t bytes_alloc, |
| 56 | { | 35 | gfp_t gfp_flags), |
| 57 | } | 36 | TP_ARGS(call_site, ptr, bytes_req, bytes_alloc, gfp_flags)); |
| 58 | 37 | DECLARE_TRACE(kmalloc_node, | |
| 59 | #endif /* CONFIG_KMEMTRACE */ | 38 | TP_PROTO(unsigned long call_site, |
| 60 | 39 | const void *ptr, | |
| 61 | static inline void kmemtrace_mark_alloc(enum kmemtrace_type_id type_id, | 40 | size_t bytes_req, |
| 62 | unsigned long call_site, | 41 | size_t bytes_alloc, |
| 63 | const void *ptr, | 42 | gfp_t gfp_flags, |
| 64 | size_t bytes_req, | 43 | int node), |
| 65 | size_t bytes_alloc, | 44 | TP_ARGS(call_site, ptr, bytes_req, bytes_alloc, gfp_flags, node)); |
| 66 | gfp_t gfp_flags) | 45 | DECLARE_TRACE(kmem_cache_alloc_node, |
| 67 | { | 46 | TP_PROTO(unsigned long call_site, |
| 68 | kmemtrace_mark_alloc_node(type_id, call_site, ptr, | 47 | const void *ptr, |
| 69 | bytes_req, bytes_alloc, gfp_flags, -1); | 48 | size_t bytes_req, |
| 70 | } | 49 | size_t bytes_alloc, |
| 50 | gfp_t gfp_flags, | ||
| 51 | int node), | ||
| 52 | TP_ARGS(call_site, ptr, bytes_req, bytes_alloc, gfp_flags, node)); | ||
| 53 | DECLARE_TRACE(kfree, | ||
| 54 | TP_PROTO(unsigned long call_site, const void *ptr), | ||
| 55 | TP_ARGS(call_site, ptr)); | ||
| 56 | DECLARE_TRACE(kmem_cache_free, | ||
| 57 | TP_PROTO(unsigned long call_site, const void *ptr), | ||
| 58 | TP_ARGS(call_site, ptr)); | ||
| 71 | 59 | ||
| 72 | #endif /* __KERNEL__ */ | 60 | #endif /* __KERNEL__ */ |
| 73 | 61 | ||
