summaryrefslogtreecommitdiffstats
path: root/tools/perf/builtin-kmem.c
diff options
context:
space:
mode:
Diffstat (limited to 'tools/perf/builtin-kmem.c')
-rw-r--r--tools/perf/builtin-kmem.c29
1 files changed, 16 insertions, 13 deletions
diff --git a/tools/perf/builtin-kmem.c b/tools/perf/builtin-kmem.c
index 9e5e60898083..b5682beaad72 100644
--- a/tools/perf/builtin-kmem.c
+++ b/tools/perf/builtin-kmem.c
@@ -2,6 +2,7 @@
2#include "builtin.h" 2#include "builtin.h"
3#include "perf.h" 3#include "perf.h"
4 4
5#include "util/dso.h"
5#include "util/evlist.h" 6#include "util/evlist.h"
6#include "util/evsel.h" 7#include "util/evsel.h"
7#include "util/config.h" 8#include "util/config.h"
@@ -14,6 +15,7 @@
14#include "util/callchain.h" 15#include "util/callchain.h"
15#include "util/time-utils.h" 16#include "util/time-utils.h"
16 17
18#include <subcmd/pager.h>
17#include <subcmd/parse-options.h> 19#include <subcmd/parse-options.h>
18#include "util/trace-event.h" 20#include "util/trace-event.h"
19#include "util/data.h" 21#include "util/data.h"
@@ -166,7 +168,7 @@ static int insert_caller_stat(unsigned long call_site,
166 return 0; 168 return 0;
167} 169}
168 170
169static int perf_evsel__process_alloc_event(struct perf_evsel *evsel, 171static int perf_evsel__process_alloc_event(struct evsel *evsel,
170 struct perf_sample *sample) 172 struct perf_sample *sample)
171{ 173{
172 unsigned long ptr = perf_evsel__intval(evsel, sample, "ptr"), 174 unsigned long ptr = perf_evsel__intval(evsel, sample, "ptr"),
@@ -185,7 +187,7 @@ static int perf_evsel__process_alloc_event(struct perf_evsel *evsel,
185 return 0; 187 return 0;
186} 188}
187 189
188static int perf_evsel__process_alloc_node_event(struct perf_evsel *evsel, 190static int perf_evsel__process_alloc_node_event(struct evsel *evsel,
189 struct perf_sample *sample) 191 struct perf_sample *sample)
190{ 192{
191 int ret = perf_evsel__process_alloc_event(evsel, sample); 193 int ret = perf_evsel__process_alloc_event(evsel, sample);
@@ -229,7 +231,7 @@ static struct alloc_stat *search_alloc_stat(unsigned long ptr,
229 return NULL; 231 return NULL;
230} 232}
231 233
232static int perf_evsel__process_free_event(struct perf_evsel *evsel, 234static int perf_evsel__process_free_event(struct evsel *evsel,
233 struct perf_sample *sample) 235 struct perf_sample *sample)
234{ 236{
235 unsigned long ptr = perf_evsel__intval(evsel, sample, "ptr"); 237 unsigned long ptr = perf_evsel__intval(evsel, sample, "ptr");
@@ -381,7 +383,7 @@ static int build_alloc_func_list(void)
381 * Find first non-memory allocation function from callchain. 383 * Find first non-memory allocation function from callchain.
382 * The allocation functions are in the 'alloc_func_list'. 384 * The allocation functions are in the 'alloc_func_list'.
383 */ 385 */
384static u64 find_callsite(struct perf_evsel *evsel, struct perf_sample *sample) 386static u64 find_callsite(struct evsel *evsel, struct perf_sample *sample)
385{ 387{
386 struct addr_location al; 388 struct addr_location al;
387 struct machine *machine = &kmem_session->machines.host; 389 struct machine *machine = &kmem_session->machines.host;
@@ -728,7 +730,7 @@ static char *compact_gfp_string(unsigned long gfp_flags)
728 return NULL; 730 return NULL;
729} 731}
730 732
731static int parse_gfp_flags(struct perf_evsel *evsel, struct perf_sample *sample, 733static int parse_gfp_flags(struct evsel *evsel, struct perf_sample *sample,
732 unsigned int gfp_flags) 734 unsigned int gfp_flags)
733{ 735{
734 struct tep_record record = { 736 struct tep_record record = {
@@ -749,7 +751,8 @@ static int parse_gfp_flags(struct perf_evsel *evsel, struct perf_sample *sample,
749 } 751 }
750 752
751 trace_seq_init(&seq); 753 trace_seq_init(&seq);
752 tep_event_info(&seq, evsel->tp_format, &record); 754 tep_print_event(evsel->tp_format->tep,
755 &seq, &record, "%s", TEP_PRINT_INFO);
753 756
754 str = strtok_r(seq.buffer, " ", &pos); 757 str = strtok_r(seq.buffer, " ", &pos);
755 while (str) { 758 while (str) {
@@ -779,7 +782,7 @@ static int parse_gfp_flags(struct perf_evsel *evsel, struct perf_sample *sample,
779 return 0; 782 return 0;
780} 783}
781 784
782static int perf_evsel__process_page_alloc_event(struct perf_evsel *evsel, 785static int perf_evsel__process_page_alloc_event(struct evsel *evsel,
783 struct perf_sample *sample) 786 struct perf_sample *sample)
784{ 787{
785 u64 page; 788 u64 page;
@@ -852,7 +855,7 @@ static int perf_evsel__process_page_alloc_event(struct perf_evsel *evsel,
852 return 0; 855 return 0;
853} 856}
854 857
855static int perf_evsel__process_page_free_event(struct perf_evsel *evsel, 858static int perf_evsel__process_page_free_event(struct evsel *evsel,
856 struct perf_sample *sample) 859 struct perf_sample *sample)
857{ 860{
858 u64 page; 861 u64 page;
@@ -930,13 +933,13 @@ static bool perf_kmem__skip_sample(struct perf_sample *sample)
930 return false; 933 return false;
931} 934}
932 935
933typedef int (*tracepoint_handler)(struct perf_evsel *evsel, 936typedef int (*tracepoint_handler)(struct evsel *evsel,
934 struct perf_sample *sample); 937 struct perf_sample *sample);
935 938
936static int process_sample_event(struct perf_tool *tool __maybe_unused, 939static int process_sample_event(struct perf_tool *tool __maybe_unused,
937 union perf_event *event, 940 union perf_event *event,
938 struct perf_sample *sample, 941 struct perf_sample *sample,
939 struct perf_evsel *evsel, 942 struct evsel *evsel,
940 struct machine *machine) 943 struct machine *machine)
941{ 944{
942 int err = 0; 945 int err = 0;
@@ -1363,8 +1366,8 @@ static void sort_result(void)
1363static int __cmd_kmem(struct perf_session *session) 1366static int __cmd_kmem(struct perf_session *session)
1364{ 1367{
1365 int err = -EINVAL; 1368 int err = -EINVAL;
1366 struct perf_evsel *evsel; 1369 struct evsel *evsel;
1367 const struct perf_evsel_str_handler kmem_tracepoints[] = { 1370 const struct evsel_str_handler kmem_tracepoints[] = {
1368 /* slab allocator */ 1371 /* slab allocator */
1369 { "kmem:kmalloc", perf_evsel__process_alloc_event, }, 1372 { "kmem:kmalloc", perf_evsel__process_alloc_event, },
1370 { "kmem:kmem_cache_alloc", perf_evsel__process_alloc_event, }, 1373 { "kmem:kmem_cache_alloc", perf_evsel__process_alloc_event, },
@@ -1967,7 +1970,7 @@ int cmd_kmem(int argc, const char **argv)
1967 } 1970 }
1968 1971
1969 if (kmem_page) { 1972 if (kmem_page) {
1970 struct perf_evsel *evsel; 1973 struct evsel *evsel;
1971 1974
1972 evsel = perf_evlist__find_tracepoint_by_name(session->evlist, 1975 evsel = perf_evlist__find_tracepoint_by_name(session->evlist,
1973 "kmem:mm_page_alloc"); 1976 "kmem:mm_page_alloc");