diff options
Diffstat (limited to 'tools/perf')
| -rw-r--r-- | tools/perf/Documentation/perf-timechart.txt | 3 | ||||
| -rw-r--r-- | tools/perf/Makefile | 2 | ||||
| -rw-r--r-- | tools/perf/builtin-record.c | 6 | ||||
| -rw-r--r-- | tools/perf/builtin-stat.c | 8 | ||||
| -rw-r--r-- | tools/perf/builtin-timechart.c | 10 | ||||
| -rw-r--r-- | tools/perf/builtin-top.c | 1 | ||||
| -rw-r--r-- | tools/perf/builtin-trace.c | 6 | ||||
| -rw-r--r-- | tools/perf/design.txt | 3 | ||||
| -rw-r--r-- | tools/perf/util/svghelper.c | 14 | ||||
| -rw-r--r-- | tools/perf/util/symbol.c | 3 | ||||
| -rw-r--r-- | tools/perf/util/trace-event-parse.c | 9 |
11 files changed, 47 insertions, 18 deletions
diff --git a/tools/perf/Documentation/perf-timechart.txt b/tools/perf/Documentation/perf-timechart.txt index 1c2ed3090cce..a7910099d6fd 100644 --- a/tools/perf/Documentation/perf-timechart.txt +++ b/tools/perf/Documentation/perf-timechart.txt | |||
| @@ -31,6 +31,9 @@ OPTIONS | |||
| 31 | -w:: | 31 | -w:: |
| 32 | --width=:: | 32 | --width=:: |
| 33 | Select the width of the SVG file (default: 1000) | 33 | Select the width of the SVG file (default: 1000) |
| 34 | -p:: | ||
| 35 | --power-only:: | ||
| 36 | Only output the CPU power section of the diagram | ||
| 34 | 37 | ||
| 35 | 38 | ||
| 36 | SEE ALSO | 39 | SEE ALSO |
diff --git a/tools/perf/Makefile b/tools/perf/Makefile index 2c309a5c6868..5a429966c995 100644 --- a/tools/perf/Makefile +++ b/tools/perf/Makefile | |||
| @@ -732,7 +732,7 @@ $(BUILT_INS): perf$X | |||
| 732 | common-cmds.h: util/generate-cmdlist.sh command-list.txt | 732 | common-cmds.h: util/generate-cmdlist.sh command-list.txt |
| 733 | 733 | ||
| 734 | common-cmds.h: $(wildcard Documentation/perf-*.txt) | 734 | common-cmds.h: $(wildcard Documentation/perf-*.txt) |
| 735 | $(QUIET_GEN)util/generate-cmdlist.sh > $@+ && mv $@+ $@ | 735 | $(QUIET_GEN). util/generate-cmdlist.sh > $@+ && mv $@+ $@ |
| 736 | 736 | ||
| 737 | $(patsubst %.sh,%,$(SCRIPT_SH)) : % : %.sh | 737 | $(patsubst %.sh,%,$(SCRIPT_SH)) : % : %.sh |
| 738 | $(QUIET_GEN)$(RM) $@ $@+ && \ | 738 | $(QUIET_GEN)$(RM) $@ $@+ && \ |
diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c index a5a050af8e7d..3eeef339c787 100644 --- a/tools/perf/builtin-record.c +++ b/tools/perf/builtin-record.c | |||
| @@ -41,6 +41,7 @@ static int raw_samples = 0; | |||
| 41 | static int system_wide = 0; | 41 | static int system_wide = 0; |
| 42 | static int profile_cpu = -1; | 42 | static int profile_cpu = -1; |
| 43 | static pid_t target_pid = -1; | 43 | static pid_t target_pid = -1; |
| 44 | static pid_t child_pid = -1; | ||
| 44 | static int inherit = 1; | 45 | static int inherit = 1; |
| 45 | static int force = 0; | 46 | static int force = 0; |
| 46 | static int append_file = 0; | 47 | static int append_file = 0; |
| @@ -184,6 +185,9 @@ static void sig_handler(int sig) | |||
| 184 | 185 | ||
| 185 | static void sig_atexit(void) | 186 | static void sig_atexit(void) |
| 186 | { | 187 | { |
| 188 | if (child_pid != -1) | ||
| 189 | kill(child_pid, SIGTERM); | ||
| 190 | |||
| 187 | if (signr == -1) | 191 | if (signr == -1) |
| 188 | return; | 192 | return; |
| 189 | 193 | ||
| @@ -610,6 +614,8 @@ static int __cmd_record(int argc, const char **argv) | |||
| 610 | exit(-1); | 614 | exit(-1); |
| 611 | } | 615 | } |
| 612 | } | 616 | } |
| 617 | |||
| 618 | child_pid = pid; | ||
| 613 | } | 619 | } |
| 614 | 620 | ||
| 615 | if (realtime_prio) { | 621 | if (realtime_prio) { |
diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c index e5f6ece65a13..3db31e7bf173 100644 --- a/tools/perf/builtin-stat.c +++ b/tools/perf/builtin-stat.c | |||
| @@ -69,7 +69,8 @@ static int run_idx = 0; | |||
| 69 | static int run_count = 1; | 69 | static int run_count = 1; |
| 70 | static int inherit = 1; | 70 | static int inherit = 1; |
| 71 | static int scale = 1; | 71 | static int scale = 1; |
| 72 | static int target_pid = -1; | 72 | static pid_t target_pid = -1; |
| 73 | static pid_t child_pid = -1; | ||
| 73 | static int null_run = 0; | 74 | static int null_run = 0; |
| 74 | 75 | ||
| 75 | static int fd[MAX_NR_CPUS][MAX_COUNTERS]; | 76 | static int fd[MAX_NR_CPUS][MAX_COUNTERS]; |
| @@ -285,6 +286,8 @@ static int run_perf_stat(int argc __used, const char **argv) | |||
| 285 | exit(-1); | 286 | exit(-1); |
| 286 | } | 287 | } |
| 287 | 288 | ||
| 289 | child_pid = pid; | ||
| 290 | |||
| 288 | /* | 291 | /* |
| 289 | * Wait for the child to be ready to exec. | 292 | * Wait for the child to be ready to exec. |
| 290 | */ | 293 | */ |
| @@ -433,6 +436,9 @@ static void skip_signal(int signo) | |||
| 433 | 436 | ||
| 434 | static void sig_atexit(void) | 437 | static void sig_atexit(void) |
| 435 | { | 438 | { |
| 439 | if (child_pid != -1) | ||
| 440 | kill(child_pid, SIGTERM); | ||
| 441 | |||
| 436 | if (signr == -1) | 442 | if (signr == -1) |
| 437 | return; | 443 | return; |
| 438 | 444 | ||
diff --git a/tools/perf/builtin-timechart.c b/tools/perf/builtin-timechart.c index 4405681b3134..702d8fe58fbc 100644 --- a/tools/perf/builtin-timechart.c +++ b/tools/perf/builtin-timechart.c | |||
| @@ -46,6 +46,8 @@ static u64 turbo_frequency; | |||
| 46 | 46 | ||
| 47 | static u64 first_time, last_time; | 47 | static u64 first_time, last_time; |
| 48 | 48 | ||
| 49 | static int power_only; | ||
| 50 | |||
| 49 | 51 | ||
| 50 | static struct perf_header *header; | 52 | static struct perf_header *header; |
| 51 | 53 | ||
| @@ -547,7 +549,7 @@ static void end_sample_processing(void) | |||
| 547 | u64 cpu; | 549 | u64 cpu; |
| 548 | struct power_event *pwr; | 550 | struct power_event *pwr; |
| 549 | 551 | ||
| 550 | for (cpu = 0; cpu < numcpus; cpu++) { | 552 | for (cpu = 0; cpu <= numcpus; cpu++) { |
| 551 | pwr = malloc(sizeof(struct power_event)); | 553 | pwr = malloc(sizeof(struct power_event)); |
| 552 | if (!pwr) | 554 | if (!pwr) |
| 553 | return; | 555 | return; |
| @@ -871,7 +873,7 @@ static int determine_display_tasks(u64 threshold) | |||
| 871 | /* no exit marker, task kept running to the end */ | 873 | /* no exit marker, task kept running to the end */ |
| 872 | if (p->end_time == 0) | 874 | if (p->end_time == 0) |
| 873 | p->end_time = last_time; | 875 | p->end_time = last_time; |
| 874 | if (p->total_time >= threshold) | 876 | if (p->total_time >= threshold && !power_only) |
| 875 | p->display = 1; | 877 | p->display = 1; |
| 876 | 878 | ||
| 877 | c = p->all; | 879 | c = p->all; |
| @@ -882,7 +884,7 @@ static int determine_display_tasks(u64 threshold) | |||
| 882 | if (c->start_time == 1) | 884 | if (c->start_time == 1) |
| 883 | c->start_time = first_time; | 885 | c->start_time = first_time; |
| 884 | 886 | ||
| 885 | if (c->total_time >= threshold) { | 887 | if (c->total_time >= threshold && !power_only) { |
| 886 | c->display = 1; | 888 | c->display = 1; |
| 887 | count++; | 889 | count++; |
| 888 | } | 890 | } |
| @@ -1134,6 +1136,8 @@ static const struct option options[] = { | |||
| 1134 | "output file name"), | 1136 | "output file name"), |
| 1135 | OPT_INTEGER('w', "width", &svg_page_width, | 1137 | OPT_INTEGER('w', "width", &svg_page_width, |
| 1136 | "page width"), | 1138 | "page width"), |
| 1139 | OPT_BOOLEAN('p', "power-only", &power_only, | ||
| 1140 | "output power data only"), | ||
| 1137 | OPT_END() | 1141 | OPT_END() |
| 1138 | }; | 1142 | }; |
| 1139 | 1143 | ||
diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c index 34d48c1b7a8b..c574c5b3d0e6 100644 --- a/tools/perf/builtin-top.c +++ b/tools/perf/builtin-top.c | |||
| @@ -759,6 +759,7 @@ static const char *skip_symbols[] = { | |||
| 759 | "exit_idle", | 759 | "exit_idle", |
| 760 | "mwait_idle", | 760 | "mwait_idle", |
| 761 | "mwait_idle_with_hints", | 761 | "mwait_idle_with_hints", |
| 762 | "poll_idle", | ||
| 762 | "ppc64_runlatch_off", | 763 | "ppc64_runlatch_off", |
| 763 | "pseries_dedicated_idle_sleep", | 764 | "pseries_dedicated_idle_sleep", |
| 764 | NULL | 765 | NULL |
diff --git a/tools/perf/builtin-trace.c b/tools/perf/builtin-trace.c index 2f938887335a..5d4c84d86373 100644 --- a/tools/perf/builtin-trace.c +++ b/tools/perf/builtin-trace.c | |||
| @@ -191,10 +191,6 @@ remap: | |||
| 191 | more: | 191 | more: |
| 192 | event = (event_t *)(buf + head); | 192 | event = (event_t *)(buf + head); |
| 193 | 193 | ||
| 194 | size = event->header.size; | ||
| 195 | if (!size) | ||
| 196 | size = 8; | ||
| 197 | |||
| 198 | if (head + event->header.size >= page_size * mmap_window) { | 194 | if (head + event->header.size >= page_size * mmap_window) { |
| 199 | unsigned long shift = page_size * (head / page_size); | 195 | unsigned long shift = page_size * (head / page_size); |
| 200 | int res; | 196 | int res; |
| @@ -209,7 +205,6 @@ more: | |||
| 209 | 205 | ||
| 210 | size = event->header.size; | 206 | size = event->header.size; |
| 211 | 207 | ||
| 212 | |||
| 213 | if (!size || process_event(event, offset, head) < 0) { | 208 | if (!size || process_event(event, offset, head) < 0) { |
| 214 | 209 | ||
| 215 | /* | 210 | /* |
| @@ -262,7 +257,6 @@ int cmd_trace(int argc, const char **argv, const char *prefix __used) | |||
| 262 | usage_with_options(annotate_usage, options); | 257 | usage_with_options(annotate_usage, options); |
| 263 | } | 258 | } |
| 264 | 259 | ||
| 265 | |||
| 266 | setup_pager(); | 260 | setup_pager(); |
| 267 | 261 | ||
| 268 | return __cmd_trace(); | 262 | return __cmd_trace(); |
diff --git a/tools/perf/design.txt b/tools/perf/design.txt index f1946d107b10..fdd42a824c98 100644 --- a/tools/perf/design.txt +++ b/tools/perf/design.txt | |||
| @@ -455,3 +455,6 @@ will need at least this: | |||
| 455 | 455 | ||
| 456 | If your architecture does have hardware capabilities, you can override the | 456 | If your architecture does have hardware capabilities, you can override the |
| 457 | weak stub hw_perf_event_init() to register hardware counters. | 457 | weak stub hw_perf_event_init() to register hardware counters. |
| 458 | |||
| 459 | Architectures that have d-cache aliassing issues, such as Sparc and ARM, | ||
| 460 | should select PERF_USE_VMALLOC in order to avoid these for perf mmap(). | ||
diff --git a/tools/perf/util/svghelper.c b/tools/perf/util/svghelper.c index a778fd0f4ae4..856655d8b0b8 100644 --- a/tools/perf/util/svghelper.c +++ b/tools/perf/util/svghelper.c | |||
| @@ -28,7 +28,7 @@ static u64 turbo_frequency, max_freq; | |||
| 28 | 28 | ||
| 29 | int svg_page_width = 1000; | 29 | int svg_page_width = 1000; |
| 30 | 30 | ||
| 31 | #define MIN_TEXT_SIZE 0.001 | 31 | #define MIN_TEXT_SIZE 0.01 |
| 32 | 32 | ||
| 33 | static u64 total_height; | 33 | static u64 total_height; |
| 34 | static FILE *svgfile; | 34 | static FILE *svgfile; |
| @@ -217,6 +217,18 @@ static char *cpu_model(void) | |||
| 217 | } | 217 | } |
| 218 | fclose(file); | 218 | fclose(file); |
| 219 | } | 219 | } |
| 220 | |||
| 221 | /* CPU type */ | ||
| 222 | file = fopen("/sys/devices/system/cpu/cpu0/cpufreq/scaling_available_frequencies", "r"); | ||
| 223 | if (file) { | ||
| 224 | while (fgets(buf, 255, file)) { | ||
| 225 | unsigned int freq; | ||
| 226 | freq = strtoull(buf, NULL, 10); | ||
| 227 | if (freq > max_freq) | ||
| 228 | max_freq = freq; | ||
| 229 | } | ||
| 230 | fclose(file); | ||
| 231 | } | ||
| 220 | return cpu_m; | 232 | return cpu_m; |
| 221 | } | 233 | } |
| 222 | 234 | ||
diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c index e3eebdd682d9..582ce72ca4d2 100644 --- a/tools/perf/util/symbol.c +++ b/tools/perf/util/symbol.c | |||
| @@ -396,8 +396,7 @@ static inline int elf_sym__is_function(const GElf_Sym *sym) | |||
| 396 | { | 396 | { |
| 397 | return elf_sym__type(sym) == STT_FUNC && | 397 | return elf_sym__type(sym) == STT_FUNC && |
| 398 | sym->st_name != 0 && | 398 | sym->st_name != 0 && |
| 399 | sym->st_shndx != SHN_UNDEF && | 399 | sym->st_shndx != SHN_UNDEF; |
| 400 | sym->st_size != 0; | ||
| 401 | } | 400 | } |
| 402 | 401 | ||
| 403 | static inline int elf_sym__is_label(const GElf_Sym *sym) | 402 | static inline int elf_sym__is_label(const GElf_Sym *sym) |
diff --git a/tools/perf/util/trace-event-parse.c b/tools/perf/util/trace-event-parse.c index f6a8437141c8..55b41b9e3834 100644 --- a/tools/perf/util/trace-event-parse.c +++ b/tools/perf/util/trace-event-parse.c | |||
| @@ -1968,10 +1968,11 @@ static const struct flag flags[] = { | |||
| 1968 | { "NET_TX_SOFTIRQ", 2 }, | 1968 | { "NET_TX_SOFTIRQ", 2 }, |
| 1969 | { "NET_RX_SOFTIRQ", 3 }, | 1969 | { "NET_RX_SOFTIRQ", 3 }, |
| 1970 | { "BLOCK_SOFTIRQ", 4 }, | 1970 | { "BLOCK_SOFTIRQ", 4 }, |
| 1971 | { "TASKLET_SOFTIRQ", 5 }, | 1971 | { "BLOCK_IOPOLL_SOFTIRQ", 5 }, |
| 1972 | { "SCHED_SOFTIRQ", 6 }, | 1972 | { "TASKLET_SOFTIRQ", 6 }, |
| 1973 | { "HRTIMER_SOFTIRQ", 7 }, | 1973 | { "SCHED_SOFTIRQ", 7 }, |
| 1974 | { "RCU_SOFTIRQ", 8 }, | 1974 | { "HRTIMER_SOFTIRQ", 8 }, |
| 1975 | { "RCU_SOFTIRQ", 9 }, | ||
| 1975 | 1976 | ||
| 1976 | { "HRTIMER_NORESTART", 0 }, | 1977 | { "HRTIMER_NORESTART", 0 }, |
| 1977 | { "HRTIMER_RESTART", 1 }, | 1978 | { "HRTIMER_RESTART", 1 }, |
