aboutsummaryrefslogtreecommitdiffstats
path: root/tools/lib/traceevent/plugin_sched_switch.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2018-08-26 14:25:21 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2018-08-26 14:25:21 -0400
commitd207ea8e74ff45be0838afa12bdd2492fa9dc8bc (patch)
tree97cfb3ed5c1bb42790e98e62b823526f61000b9f /tools/lib/traceevent/plugin_sched_switch.c
parent2a8a2b7c49d6eb5f3348892c4676267376cfd40b (diff)
parent66e5db4a1ccc64f278653bc69dc406d184dc750a (diff)
Merge branch 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull perf updates from Thomas Gleixner: "Kernel: - Improve kallsyms coverage - Add x86 entry trampolines to kcore - Fix ARM SPE handling - Correct PPC event post processing Tools: - Make the build system more robust - Small fixes and enhancements all over the place - Update kernel ABI header copies - Preparatory work for converting libtraceevnt to a shared library - License cleanups" * 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (100 commits) tools arch: Update arch/x86/lib/memcpy_64.S copy used in 'perf bench mem memcpy' tools arch x86: Update tools's copy of cpufeatures.h perf python: Fix pyrf_evlist__read_on_cpu() interface perf mmap: Store real cpu number in 'struct perf_mmap' perf tools: Remove ext from struct kmod_path perf tools: Add gzip_is_compressed function perf tools: Add lzma_is_compressed function perf tools: Add is_compressed callback to compressions array perf tools: Move the temp file processing into decompress_kmodule perf tools: Use compression id in decompress_kmodule() perf tools: Store compression id into struct dso perf tools: Add compression id into 'struct kmod_path' perf tools: Make is_supported_compression() static perf tools: Make decompress_to_file() function static perf tools: Get rid of dso__needs_decompress() call in __open_dso() perf tools: Get rid of dso__needs_decompress() call in symbol__disassemble() perf tools: Get rid of dso__needs_decompress() call in read_object_code() tools lib traceevent: Change to SPDX License format perf llvm: Allow passing options to llc in addition to clang perf parser: Improve error message for PMU address filters ...
Diffstat (limited to 'tools/lib/traceevent/plugin_sched_switch.c')
-rw-r--r--tools/lib/traceevent/plugin_sched_switch.c60
1 files changed, 30 insertions, 30 deletions
diff --git a/tools/lib/traceevent/plugin_sched_switch.c b/tools/lib/traceevent/plugin_sched_switch.c
index ec30c2fcbac0..eecb4bd95c11 100644
--- a/tools/lib/traceevent/plugin_sched_switch.c
+++ b/tools/lib/traceevent/plugin_sched_switch.c
@@ -45,7 +45,7 @@ static void write_state(struct trace_seq *s, int val)
45} 45}
46 46
47static void write_and_save_comm(struct format_field *field, 47static void write_and_save_comm(struct format_field *field,
48 struct pevent_record *record, 48 struct tep_record *record,
49 struct trace_seq *s, int pid) 49 struct trace_seq *s, int pid)
50{ 50{
51 const char *comm; 51 const char *comm;
@@ -61,100 +61,100 @@ static void write_and_save_comm(struct format_field *field,
61 comm = &s->buffer[len]; 61 comm = &s->buffer[len];
62 62
63 /* Help out the comm to ids. This will handle dups */ 63 /* Help out the comm to ids. This will handle dups */
64 pevent_register_comm(field->event->pevent, comm, pid); 64 tep_register_comm(field->event->pevent, comm, pid);
65} 65}
66 66
67static int sched_wakeup_handler(struct trace_seq *s, 67static int sched_wakeup_handler(struct trace_seq *s,
68 struct pevent_record *record, 68 struct tep_record *record,
69 struct event_format *event, void *context) 69 struct event_format *event, void *context)
70{ 70{
71 struct format_field *field; 71 struct format_field *field;
72 unsigned long long val; 72 unsigned long long val;
73 73
74 if (pevent_get_field_val(s, event, "pid", record, &val, 1)) 74 if (tep_get_field_val(s, event, "pid", record, &val, 1))
75 return trace_seq_putc(s, '!'); 75 return trace_seq_putc(s, '!');
76 76
77 field = pevent_find_any_field(event, "comm"); 77 field = tep_find_any_field(event, "comm");
78 if (field) { 78 if (field) {
79 write_and_save_comm(field, record, s, val); 79 write_and_save_comm(field, record, s, val);
80 trace_seq_putc(s, ':'); 80 trace_seq_putc(s, ':');
81 } 81 }
82 trace_seq_printf(s, "%lld", val); 82 trace_seq_printf(s, "%lld", val);
83 83
84 if (pevent_get_field_val(s, event, "prio", record, &val, 0) == 0) 84 if (tep_get_field_val(s, event, "prio", record, &val, 0) == 0)
85 trace_seq_printf(s, " [%lld]", val); 85 trace_seq_printf(s, " [%lld]", val);
86 86
87 if (pevent_get_field_val(s, event, "success", record, &val, 1) == 0) 87 if (tep_get_field_val(s, event, "success", record, &val, 1) == 0)
88 trace_seq_printf(s, " success=%lld", val); 88 trace_seq_printf(s, " success=%lld", val);
89 89
90 if (pevent_get_field_val(s, event, "target_cpu", record, &val, 0) == 0) 90 if (tep_get_field_val(s, event, "target_cpu", record, &val, 0) == 0)
91 trace_seq_printf(s, " CPU:%03llu", val); 91 trace_seq_printf(s, " CPU:%03llu", val);
92 92
93 return 0; 93 return 0;
94} 94}
95 95
96static int sched_switch_handler(struct trace_seq *s, 96static int sched_switch_handler(struct trace_seq *s,
97 struct pevent_record *record, 97 struct tep_record *record,
98 struct event_format *event, void *context) 98 struct event_format *event, void *context)
99{ 99{
100 struct format_field *field; 100 struct format_field *field;
101 unsigned long long val; 101 unsigned long long val;
102 102
103 if (pevent_get_field_val(s, event, "prev_pid", record, &val, 1)) 103 if (tep_get_field_val(s, event, "prev_pid", record, &val, 1))
104 return trace_seq_putc(s, '!'); 104 return trace_seq_putc(s, '!');
105 105
106 field = pevent_find_any_field(event, "prev_comm"); 106 field = tep_find_any_field(event, "prev_comm");
107 if (field) { 107 if (field) {
108 write_and_save_comm(field, record, s, val); 108 write_and_save_comm(field, record, s, val);
109 trace_seq_putc(s, ':'); 109 trace_seq_putc(s, ':');
110 } 110 }
111 trace_seq_printf(s, "%lld ", val); 111 trace_seq_printf(s, "%lld ", val);
112 112
113 if (pevent_get_field_val(s, event, "prev_prio", record, &val, 0) == 0) 113 if (tep_get_field_val(s, event, "prev_prio", record, &val, 0) == 0)
114 trace_seq_printf(s, "[%d] ", (int) val); 114 trace_seq_printf(s, "[%d] ", (int) val);
115 115
116 if (pevent_get_field_val(s, event, "prev_state", record, &val, 0) == 0) 116 if (tep_get_field_val(s, event, "prev_state", record, &val, 0) == 0)
117 write_state(s, val); 117 write_state(s, val);
118 118
119 trace_seq_puts(s, " ==> "); 119 trace_seq_puts(s, " ==> ");
120 120
121 if (pevent_get_field_val(s, event, "next_pid", record, &val, 1)) 121 if (tep_get_field_val(s, event, "next_pid", record, &val, 1))
122 return trace_seq_putc(s, '!'); 122 return trace_seq_putc(s, '!');
123 123
124 field = pevent_find_any_field(event, "next_comm"); 124 field = tep_find_any_field(event, "next_comm");
125 if (field) { 125 if (field) {
126 write_and_save_comm(field, record, s, val); 126 write_and_save_comm(field, record, s, val);
127 trace_seq_putc(s, ':'); 127 trace_seq_putc(s, ':');
128 } 128 }
129 trace_seq_printf(s, "%lld", val); 129 trace_seq_printf(s, "%lld", val);
130 130
131 if (pevent_get_field_val(s, event, "next_prio", record, &val, 0) == 0) 131 if (tep_get_field_val(s, event, "next_prio", record, &val, 0) == 0)
132 trace_seq_printf(s, " [%d]", (int) val); 132 trace_seq_printf(s, " [%d]", (int) val);
133 133
134 return 0; 134 return 0;
135} 135}
136 136
137int PEVENT_PLUGIN_LOADER(struct pevent *pevent) 137int TEP_PLUGIN_LOADER(struct tep_handle *pevent)
138{ 138{
139 pevent_register_event_handler(pevent, -1, "sched", "sched_switch", 139 tep_register_event_handler(pevent, -1, "sched", "sched_switch",
140 sched_switch_handler, NULL); 140 sched_switch_handler, NULL);
141 141
142 pevent_register_event_handler(pevent, -1, "sched", "sched_wakeup", 142 tep_register_event_handler(pevent, -1, "sched", "sched_wakeup",
143 sched_wakeup_handler, NULL); 143 sched_wakeup_handler, NULL);
144 144
145 pevent_register_event_handler(pevent, -1, "sched", "sched_wakeup_new", 145 tep_register_event_handler(pevent, -1, "sched", "sched_wakeup_new",
146 sched_wakeup_handler, NULL); 146 sched_wakeup_handler, NULL);
147 return 0; 147 return 0;
148} 148}
149 149
150void PEVENT_PLUGIN_UNLOADER(struct pevent *pevent) 150void TEP_PLUGIN_UNLOADER(struct tep_handle *pevent)
151{ 151{
152 pevent_unregister_event_handler(pevent, -1, "sched", "sched_switch", 152 tep_unregister_event_handler(pevent, -1, "sched", "sched_switch",
153 sched_switch_handler, NULL); 153 sched_switch_handler, NULL);
154 154
155 pevent_unregister_event_handler(pevent, -1, "sched", "sched_wakeup", 155 tep_unregister_event_handler(pevent, -1, "sched", "sched_wakeup",
156 sched_wakeup_handler, NULL); 156 sched_wakeup_handler, NULL);
157 157
158 pevent_unregister_event_handler(pevent, -1, "sched", "sched_wakeup_new", 158 tep_unregister_event_handler(pevent, -1, "sched", "sched_wakeup_new",
159 sched_wakeup_handler, NULL); 159 sched_wakeup_handler, NULL);
160} 160}