diff options
| author | Linus Torvalds <torvalds@linux-foundation.org> | 2012-10-12 21:20:11 -0400 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-10-12 21:20:11 -0400 |
| commit | ade0899b298ba2c43bfd6abd8cbc2545944cde0c (patch) | |
| tree | a448dfb440b3b958b6306bb43620cd5d76f504bf /tools/perf/ui/stdio | |
| parent | 871a0596cb2f51b57dc583d1a7c4be0186582fe7 (diff) | |
| parent | 95cf59ea72331d0093010543b8951bb43f262cac (diff) | |
Merge branch 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull perf updates from Ingo Molnar:
"This tree includes some late late perf items that missed the first
round:
tools:
- Bash auto completion improvements, now we can auto complete the
tools long options, tracepoint event names, etc, from Namhyung Kim.
- Look up thread using tid instead of pid in 'perf sched'.
- Move global variables into a perf_kvm struct, from David Ahern.
- Hists refactorings, preparatory for improved 'diff' command, from
Jiri Olsa.
- Hists refactorings, preparatory for event group viewieng work, from
Namhyung Kim.
- Remove double negation on optional feature macro definitions, from
Namhyung Kim.
- Remove several cases of needless global variables, on most
builtins.
- misc fixes
kernel:
- sysfs support for IBS on AMD CPUs, from Robert Richter.
- Support for an upcoming Intel CPU, the Xeon-Phi / Knights Corner
HPC blade PMU, from Vince Weaver.
- misc fixes"
* 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (46 commits)
perf: Fix perf_cgroup_switch for sw-events
perf: Clarify perf_cpu_context::active_pmu usage by renaming it to ::unique_pmu
perf/AMD/IBS: Add sysfs support
perf hists: Add more helpers for hist entry stat
perf hists: Move he->stat.nr_events initialization to a template
perf hists: Introduce struct he_stat
perf diff: Removing the total_period argument from output code
perf tool: Add hpp interface to enable/disable hpp column
perf tools: Removing hists pair argument from output path
perf hists: Separate overhead and baseline columns
perf diff: Refactor diff displacement possition info
perf hists: Add struct hists pointer to struct hist_entry
perf tools: Complete tracepoint event names
perf/x86: Add support for Intel Xeon-Phi Knights Corner PMU
perf evlist: Remove some unused methods
perf evlist: Introduce add_newtp method
perf kvm: Move global variables into a perf_kvm struct
perf tools: Convert to BACKTRACE_SUPPORT
perf tools: Long option completion support for each subcommands
perf tools: Complete long option names of perf command
...
Diffstat (limited to 'tools/perf/ui/stdio')
| -rw-r--r-- | tools/perf/ui/stdio/hist.c | 45 |
1 files changed, 16 insertions, 29 deletions
diff --git a/tools/perf/ui/stdio/hist.c b/tools/perf/ui/stdio/hist.c index 882461a42830..fbd4e32d0743 100644 --- a/tools/perf/ui/stdio/hist.c +++ b/tools/perf/ui/stdio/hist.c | |||
| @@ -271,7 +271,7 @@ static size_t hist_entry_callchain__fprintf(struct hist_entry *he, | |||
| 271 | { | 271 | { |
| 272 | switch (callchain_param.mode) { | 272 | switch (callchain_param.mode) { |
| 273 | case CHAIN_GRAPH_REL: | 273 | case CHAIN_GRAPH_REL: |
| 274 | return callchain__fprintf_graph(fp, &he->sorted_chain, he->period, | 274 | return callchain__fprintf_graph(fp, &he->sorted_chain, he->stat.period, |
| 275 | left_margin); | 275 | left_margin); |
| 276 | break; | 276 | break; |
| 277 | case CHAIN_GRAPH_ABS: | 277 | case CHAIN_GRAPH_ABS: |
| @@ -292,9 +292,10 @@ static size_t hist_entry_callchain__fprintf(struct hist_entry *he, | |||
| 292 | 292 | ||
| 293 | static size_t hist_entry__callchain_fprintf(struct hist_entry *he, | 293 | static size_t hist_entry__callchain_fprintf(struct hist_entry *he, |
| 294 | struct hists *hists, | 294 | struct hists *hists, |
| 295 | u64 total_period, FILE *fp) | 295 | FILE *fp) |
| 296 | { | 296 | { |
| 297 | int left_margin = 0; | 297 | int left_margin = 0; |
| 298 | u64 total_period = hists->stats.total_period; | ||
| 298 | 299 | ||
| 299 | if (sort__first_dimension == SORT_COMM) { | 300 | if (sort__first_dimension == SORT_COMM) { |
| 300 | struct sort_entry *se = list_first_entry(&hist_entry__sort_list, | 301 | struct sort_entry *se = list_first_entry(&hist_entry__sort_list, |
| @@ -307,17 +308,13 @@ static size_t hist_entry__callchain_fprintf(struct hist_entry *he, | |||
| 307 | } | 308 | } |
| 308 | 309 | ||
| 309 | static int hist_entry__fprintf(struct hist_entry *he, size_t size, | 310 | static int hist_entry__fprintf(struct hist_entry *he, size_t size, |
| 310 | struct hists *hists, struct hists *pair_hists, | 311 | struct hists *hists, FILE *fp) |
| 311 | long displacement, u64 total_period, FILE *fp) | ||
| 312 | { | 312 | { |
| 313 | char bf[512]; | 313 | char bf[512]; |
| 314 | int ret; | 314 | int ret; |
| 315 | struct perf_hpp hpp = { | 315 | struct perf_hpp hpp = { |
| 316 | .buf = bf, | 316 | .buf = bf, |
| 317 | .size = size, | 317 | .size = size, |
| 318 | .total_period = total_period, | ||
| 319 | .displacement = displacement, | ||
| 320 | .ptr = pair_hists, | ||
| 321 | }; | 318 | }; |
| 322 | bool color = !symbol_conf.field_sep; | 319 | bool color = !symbol_conf.field_sep; |
| 323 | 320 | ||
| @@ -330,22 +327,17 @@ static int hist_entry__fprintf(struct hist_entry *he, size_t size, | |||
| 330 | ret = fprintf(fp, "%s\n", bf); | 327 | ret = fprintf(fp, "%s\n", bf); |
| 331 | 328 | ||
| 332 | if (symbol_conf.use_callchain) | 329 | if (symbol_conf.use_callchain) |
| 333 | ret += hist_entry__callchain_fprintf(he, hists, | 330 | ret += hist_entry__callchain_fprintf(he, hists, fp); |
| 334 | total_period, fp); | ||
| 335 | 331 | ||
| 336 | return ret; | 332 | return ret; |
| 337 | } | 333 | } |
| 338 | 334 | ||
| 339 | size_t hists__fprintf(struct hists *hists, struct hists *pair, | 335 | size_t hists__fprintf(struct hists *hists, bool show_header, int max_rows, |
| 340 | bool show_displacement, bool show_header, int max_rows, | ||
| 341 | int max_cols, FILE *fp) | 336 | int max_cols, FILE *fp) |
| 342 | { | 337 | { |
| 343 | struct sort_entry *se; | 338 | struct sort_entry *se; |
| 344 | struct rb_node *nd; | 339 | struct rb_node *nd; |
| 345 | size_t ret = 0; | 340 | size_t ret = 0; |
| 346 | u64 total_period; | ||
| 347 | unsigned long position = 1; | ||
| 348 | long displacement = 0; | ||
| 349 | unsigned int width; | 341 | unsigned int width; |
| 350 | const char *sep = symbol_conf.field_sep; | 342 | const char *sep = symbol_conf.field_sep; |
| 351 | const char *col_width = symbol_conf.col_width_list_str; | 343 | const char *col_width = symbol_conf.col_width_list_str; |
| @@ -354,8 +346,8 @@ size_t hists__fprintf(struct hists *hists, struct hists *pair, | |||
| 354 | struct perf_hpp dummy_hpp = { | 346 | struct perf_hpp dummy_hpp = { |
| 355 | .buf = bf, | 347 | .buf = bf, |
| 356 | .size = sizeof(bf), | 348 | .size = sizeof(bf), |
| 357 | .ptr = pair, | ||
| 358 | }; | 349 | }; |
| 350 | bool first = true; | ||
| 359 | 351 | ||
| 360 | init_rem_hits(); | 352 | init_rem_hits(); |
| 361 | 353 | ||
| @@ -367,8 +359,10 @@ size_t hists__fprintf(struct hists *hists, struct hists *pair, | |||
| 367 | if (!perf_hpp__format[idx].cond) | 359 | if (!perf_hpp__format[idx].cond) |
| 368 | continue; | 360 | continue; |
| 369 | 361 | ||
| 370 | if (idx) | 362 | if (!first) |
| 371 | fprintf(fp, "%s", sep ?: " "); | 363 | fprintf(fp, "%s", sep ?: " "); |
| 364 | else | ||
| 365 | first = false; | ||
| 372 | 366 | ||
| 373 | perf_hpp__format[idx].header(&dummy_hpp); | 367 | perf_hpp__format[idx].header(&dummy_hpp); |
| 374 | fprintf(fp, "%s", bf); | 368 | fprintf(fp, "%s", bf); |
| @@ -403,6 +397,8 @@ size_t hists__fprintf(struct hists *hists, struct hists *pair, | |||
| 403 | if (sep) | 397 | if (sep) |
| 404 | goto print_entries; | 398 | goto print_entries; |
| 405 | 399 | ||
| 400 | first = true; | ||
| 401 | |||
| 406 | fprintf(fp, "# "); | 402 | fprintf(fp, "# "); |
| 407 | for (idx = 0; idx < PERF_HPP__MAX_INDEX; idx++) { | 403 | for (idx = 0; idx < PERF_HPP__MAX_INDEX; idx++) { |
| 408 | unsigned int i; | 404 | unsigned int i; |
| @@ -410,8 +406,10 @@ size_t hists__fprintf(struct hists *hists, struct hists *pair, | |||
| 410 | if (!perf_hpp__format[idx].cond) | 406 | if (!perf_hpp__format[idx].cond) |
| 411 | continue; | 407 | continue; |
| 412 | 408 | ||
| 413 | if (idx) | 409 | if (!first) |
| 414 | fprintf(fp, "%s", sep ?: " "); | 410 | fprintf(fp, "%s", sep ?: " "); |
| 411 | else | ||
| 412 | first = false; | ||
| 415 | 413 | ||
| 416 | width = perf_hpp__format[idx].width(&dummy_hpp); | 414 | width = perf_hpp__format[idx].width(&dummy_hpp); |
| 417 | for (i = 0; i < width; i++) | 415 | for (i = 0; i < width; i++) |
| @@ -441,24 +439,13 @@ size_t hists__fprintf(struct hists *hists, struct hists *pair, | |||
| 441 | goto out; | 439 | goto out; |
| 442 | 440 | ||
| 443 | print_entries: | 441 | print_entries: |
| 444 | total_period = hists->stats.total_period; | ||
| 445 | |||
| 446 | for (nd = rb_first(&hists->entries); nd; nd = rb_next(nd)) { | 442 | for (nd = rb_first(&hists->entries); nd; nd = rb_next(nd)) { |
| 447 | struct hist_entry *h = rb_entry(nd, struct hist_entry, rb_node); | 443 | struct hist_entry *h = rb_entry(nd, struct hist_entry, rb_node); |
| 448 | 444 | ||
| 449 | if (h->filtered) | 445 | if (h->filtered) |
| 450 | continue; | 446 | continue; |
| 451 | 447 | ||
| 452 | if (show_displacement) { | 448 | ret += hist_entry__fprintf(h, max_cols, hists, fp); |
| 453 | if (h->pair != NULL) | ||
| 454 | displacement = ((long)h->pair->position - | ||
| 455 | (long)position); | ||
| 456 | else | ||
| 457 | displacement = 0; | ||
| 458 | ++position; | ||
| 459 | } | ||
| 460 | ret += hist_entry__fprintf(h, max_cols, hists, pair, displacement, | ||
| 461 | total_period, fp); | ||
| 462 | 449 | ||
| 463 | if (max_rows && ++nr_rows >= max_rows) | 450 | if (max_rows && ++nr_rows >= max_rows) |
| 464 | goto out; | 451 | goto out; |
