aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/util
diff options
context:
space:
mode:
authorIngo Molnar <mingo@kernel.org>2014-01-16 03:34:01 -0500
committerIngo Molnar <mingo@kernel.org>2014-01-16 03:34:01 -0500
commit3e7e09dbd1080de5dcf10092830e39bc2e2932ec (patch)
tree546c99c62fd8a37511cafeb38e9532fda4b150fd /tools/perf/util
parent860fc2f2640ec348b9520ca4649b1bfd23d91bc2 (diff)
parent0e9e79a13ab9d56b86db6538305babc23b1445cc (diff)
Merge tag 'perf-core-for-mingo' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux into perf/core
Pull perf/core updates from Arnaldo Carvalho de Melo: Changes in user visible interfaces: * Rename 'record's --no-delay option to --no-buffering, better reflecting its purpose and freeing up '--delay' to take the place of '--initial-delay', so that 'record' and 'stat' are consistent. Refactorings: * Get rid of die() and friends (good riddance!) in libtraceevent (Namhyung Kim) Infrastructure enhancements: * Fix cross build problems related to pkgconfig and CROSS_COMPILE not being propagated to the feature tests, leading to features being tested in the host and then being enabled on the target. (Mark Rutland) * Fix pointer-integer size mismatch in some libtraceevent plugins (Mark Rutland) * Fix build error due to zfree() cast (Namhyung Kim) Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com> Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'tools/perf/util')
-rw-r--r--tools/perf/util/callchain.c23
-rw-r--r--tools/perf/util/callchain.h6
-rw-r--r--tools/perf/util/evsel.c2
-rw-r--r--tools/perf/util/hist.c22
-rw-r--r--tools/perf/util/machine.c2
-rw-r--r--tools/perf/util/srcline.c4
-rw-r--r--tools/perf/util/strlist.c2
-rw-r--r--tools/perf/util/trace-event.c2
8 files changed, 45 insertions, 18 deletions
diff --git a/tools/perf/util/callchain.c b/tools/perf/util/callchain.c
index e3970e3eaacf..9eb4f57f8663 100644
--- a/tools/perf/util/callchain.c
+++ b/tools/perf/util/callchain.c
@@ -17,6 +17,8 @@
17 17
18#include "hist.h" 18#include "hist.h"
19#include "util.h" 19#include "util.h"
20#include "sort.h"
21#include "machine.h"
20#include "callchain.h" 22#include "callchain.h"
21 23
22__thread struct callchain_cursor callchain_cursor; 24__thread struct callchain_cursor callchain_cursor;
@@ -531,3 +533,24 @@ int callchain_cursor_append(struct callchain_cursor *cursor,
531 533
532 return 0; 534 return 0;
533} 535}
536
537int sample__resolve_callchain(struct perf_sample *sample, struct symbol **parent,
538 struct perf_evsel *evsel, struct addr_location *al,
539 int max_stack)
540{
541 if (sample->callchain == NULL)
542 return 0;
543
544 if (symbol_conf.use_callchain || sort__has_parent) {
545 return machine__resolve_callchain(al->machine, evsel, al->thread,
546 sample, parent, al, max_stack);
547 }
548 return 0;
549}
550
551int hist_entry__append_callchain(struct hist_entry *he, struct perf_sample *sample)
552{
553 if (!symbol_conf.use_callchain)
554 return 0;
555 return callchain_append(he->callchain, &callchain_cursor, sample->period);
556}
diff --git a/tools/perf/util/callchain.h b/tools/perf/util/callchain.h
index 08b25af9eea1..8ad97e9b119f 100644
--- a/tools/perf/util/callchain.h
+++ b/tools/perf/util/callchain.h
@@ -145,10 +145,16 @@ static inline void callchain_cursor_advance(struct callchain_cursor *cursor)
145} 145}
146 146
147struct option; 147struct option;
148struct hist_entry;
148 149
149int record_parse_callchain(const char *arg, struct record_opts *opts); 150int record_parse_callchain(const char *arg, struct record_opts *opts);
150int record_parse_callchain_opt(const struct option *opt, const char *arg, int unset); 151int record_parse_callchain_opt(const struct option *opt, const char *arg, int unset);
151int record_callchain_opt(const struct option *opt, const char *arg, int unset); 152int record_callchain_opt(const struct option *opt, const char *arg, int unset);
152 153
154int sample__resolve_callchain(struct perf_sample *sample, struct symbol **parent,
155 struct perf_evsel *evsel, struct addr_location *al,
156 int max_stack);
157int hist_entry__append_callchain(struct hist_entry *he, struct perf_sample *sample);
158
153extern const char record_callchain_help[]; 159extern const char record_callchain_help[];
154#endif /* __PERF_CALLCHAIN_H */ 160#endif /* __PERF_CALLCHAIN_H */
diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c
index cd4630abfa43..22e18a26b7e6 100644
--- a/tools/perf/util/evsel.c
+++ b/tools/perf/util/evsel.c
@@ -627,7 +627,7 @@ void perf_evsel__config(struct perf_evsel *evsel, struct record_opts *opts)
627 if (opts->sample_address) 627 if (opts->sample_address)
628 perf_evsel__set_sample_bit(evsel, DATA_SRC); 628 perf_evsel__set_sample_bit(evsel, DATA_SRC);
629 629
630 if (opts->no_delay) { 630 if (opts->no_buffering) {
631 attr->watermark = 0; 631 attr->watermark = 0;
632 attr->wakeup_events = 1; 632 attr->wakeup_events = 1;
633 } 633 }
diff --git a/tools/perf/util/hist.c b/tools/perf/util/hist.c
index 4ed3e883240d..e4e6249b87d4 100644
--- a/tools/perf/util/hist.c
+++ b/tools/perf/util/hist.c
@@ -181,21 +181,21 @@ void hists__output_recalc_col_len(struct hists *hists, int max_rows)
181 } 181 }
182} 182}
183 183
184static void hist_entry__add_cpumode_period(struct hist_entry *he, 184static void he_stat__add_cpumode_period(struct he_stat *he_stat,
185 unsigned int cpumode, u64 period) 185 unsigned int cpumode, u64 period)
186{ 186{
187 switch (cpumode) { 187 switch (cpumode) {
188 case PERF_RECORD_MISC_KERNEL: 188 case PERF_RECORD_MISC_KERNEL:
189 he->stat.period_sys += period; 189 he_stat->period_sys += period;
190 break; 190 break;
191 case PERF_RECORD_MISC_USER: 191 case PERF_RECORD_MISC_USER:
192 he->stat.period_us += period; 192 he_stat->period_us += period;
193 break; 193 break;
194 case PERF_RECORD_MISC_GUEST_KERNEL: 194 case PERF_RECORD_MISC_GUEST_KERNEL:
195 he->stat.period_guest_sys += period; 195 he_stat->period_guest_sys += period;
196 break; 196 break;
197 case PERF_RECORD_MISC_GUEST_USER: 197 case PERF_RECORD_MISC_GUEST_USER:
198 he->stat.period_guest_us += period; 198 he_stat->period_guest_us += period;
199 break; 199 break;
200 default: 200 default:
201 break; 201 break;
@@ -222,10 +222,10 @@ static void he_stat__add_stat(struct he_stat *dest, struct he_stat *src)
222 dest->weight += src->weight; 222 dest->weight += src->weight;
223} 223}
224 224
225static void hist_entry__decay(struct hist_entry *he) 225static void he_stat__decay(struct he_stat *he_stat)
226{ 226{
227 he->stat.period = (he->stat.period * 7) / 8; 227 he_stat->period = (he_stat->period * 7) / 8;
228 he->stat.nr_events = (he->stat.nr_events * 7) / 8; 228 he_stat->nr_events = (he_stat->nr_events * 7) / 8;
229 /* XXX need decay for weight too? */ 229 /* XXX need decay for weight too? */
230} 230}
231 231
@@ -236,7 +236,7 @@ static bool hists__decay_entry(struct hists *hists, struct hist_entry *he)
236 if (prev_period == 0) 236 if (prev_period == 0)
237 return true; 237 return true;
238 238
239 hist_entry__decay(he); 239 he_stat__decay(&he->stat);
240 240
241 if (!he->filtered) 241 if (!he->filtered)
242 hists->stats.total_period -= prev_period - he->stat.period; 242 hists->stats.total_period -= prev_period - he->stat.period;
@@ -402,7 +402,7 @@ static struct hist_entry *add_hist_entry(struct hists *hists,
402 rb_link_node(&he->rb_node_in, parent, p); 402 rb_link_node(&he->rb_node_in, parent, p);
403 rb_insert_color(&he->rb_node_in, hists->entries_in); 403 rb_insert_color(&he->rb_node_in, hists->entries_in);
404out: 404out:
405 hist_entry__add_cpumode_period(he, al->cpumode, period); 405 he_stat__add_cpumode_period(&he->stat, al->cpumode, period);
406 return he; 406 return he;
407} 407}
408 408
diff --git a/tools/perf/util/machine.c b/tools/perf/util/machine.c
index 0130279aac51..ded74590b92f 100644
--- a/tools/perf/util/machine.c
+++ b/tools/perf/util/machine.c
@@ -1314,8 +1314,6 @@ static int machine__resolve_callchain_sample(struct machine *machine,
1314 *root_al = al; 1314 *root_al = al;
1315 callchain_cursor_reset(&callchain_cursor); 1315 callchain_cursor_reset(&callchain_cursor);
1316 } 1316 }
1317 if (!symbol_conf.use_callchain)
1318 break;
1319 } 1317 }
1320 1318
1321 err = callchain_cursor_append(&callchain_cursor, 1319 err = callchain_cursor_append(&callchain_cursor,
diff --git a/tools/perf/util/srcline.c b/tools/perf/util/srcline.c
index 7e67879ebd25..f3e4bc5fe5d2 100644
--- a/tools/perf/util/srcline.c
+++ b/tools/perf/util/srcline.c
@@ -129,7 +129,7 @@ static struct a2l_data *addr2line_init(const char *path)
129 129
130out: 130out:
131 if (a2l) { 131 if (a2l) {
132 zfree((void **)&a2l->input); 132 zfree((char **)&a2l->input);
133 free(a2l); 133 free(a2l);
134 } 134 }
135 bfd_close(abfd); 135 bfd_close(abfd);
@@ -140,7 +140,7 @@ static void addr2line_cleanup(struct a2l_data *a2l)
140{ 140{
141 if (a2l->abfd) 141 if (a2l->abfd)
142 bfd_close(a2l->abfd); 142 bfd_close(a2l->abfd);
143 zfree((void **)&a2l->input); 143 zfree((char **)&a2l->input);
144 zfree(&a2l->syms); 144 zfree(&a2l->syms);
145 free(a2l); 145 free(a2l);
146} 146}
diff --git a/tools/perf/util/strlist.c b/tools/perf/util/strlist.c
index 61a90bf24b4d..71f9d102b96f 100644
--- a/tools/perf/util/strlist.c
+++ b/tools/perf/util/strlist.c
@@ -39,7 +39,7 @@ out_delete:
39static void str_node__delete(struct str_node *snode, bool dupstr) 39static void str_node__delete(struct str_node *snode, bool dupstr)
40{ 40{
41 if (dupstr) 41 if (dupstr)
42 zfree((void **)&snode->s); 42 zfree((char **)&snode->s);
43 free(snode); 43 free(snode);
44} 44}
45 45
diff --git a/tools/perf/util/trace-event.c b/tools/perf/util/trace-event.c
index d9f5f6137ab3..6322d37164c5 100644
--- a/tools/perf/util/trace-event.c
+++ b/tools/perf/util/trace-event.c
@@ -34,8 +34,8 @@ int trace_event__init(struct trace_event *t)
34 34
35void trace_event__cleanup(struct trace_event *t) 35void trace_event__cleanup(struct trace_event *t)
36{ 36{
37 traceevent_unload_plugins(t->plugin_list, t->pevent);
37 pevent_free(t->pevent); 38 pevent_free(t->pevent);
38 traceevent_unload_plugins(t->plugin_list);
39} 39}
40 40
41static struct event_format* 41static struct event_format*