aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf
diff options
context:
space:
mode:
Diffstat (limited to 'tools/perf')
-rw-r--r--tools/perf/.gitignore1
-rw-r--r--tools/perf/Documentation/perf-timechart.txt3
-rw-r--r--tools/perf/Makefile2
-rw-r--r--tools/perf/builtin-record.c6
-rw-r--r--tools/perf/builtin-stat.c26
-rw-r--r--tools/perf/builtin-timechart.c10
-rw-r--r--tools/perf/builtin-top.c1
-rw-r--r--tools/perf/builtin-trace.c6
-rw-r--r--tools/perf/design.txt3
-rw-r--r--tools/perf/util/module.c96
-rw-r--r--tools/perf/util/parse-events.c49
-rw-r--r--tools/perf/util/svghelper.c14
-rw-r--r--tools/perf/util/symbol.c20
-rw-r--r--tools/perf/util/trace-event-parse.c9
14 files changed, 161 insertions, 85 deletions
diff --git a/tools/perf/.gitignore b/tools/perf/.gitignore
index d69a759a104..0854f110bf7 100644
--- a/tools/perf/.gitignore
+++ b/tools/perf/.gitignore
@@ -10,6 +10,7 @@ perf-stat
10perf-top 10perf-top
11perf*.1 11perf*.1
12perf*.xml 12perf*.xml
13perf*.html
13common-cmds.h 14common-cmds.h
14tags 15tags
15TAGS 16TAGS
diff --git a/tools/perf/Documentation/perf-timechart.txt b/tools/perf/Documentation/perf-timechart.txt
index 1c2ed3090cc..a7910099d6f 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
36SEE ALSO 39SEE ALSO
diff --git a/tools/perf/Makefile b/tools/perf/Makefile
index b5f1953b614..5881943f0c3 100644
--- a/tools/perf/Makefile
+++ b/tools/perf/Makefile
@@ -728,7 +728,7 @@ $(BUILT_INS): perf$X
728common-cmds.h: util/generate-cmdlist.sh command-list.txt 728common-cmds.h: util/generate-cmdlist.sh command-list.txt
729 729
730common-cmds.h: $(wildcard Documentation/perf-*.txt) 730common-cmds.h: $(wildcard Documentation/perf-*.txt)
731 $(QUIET_GEN)util/generate-cmdlist.sh > $@+ && mv $@+ $@ 731 $(QUIET_GEN). util/generate-cmdlist.sh > $@+ && mv $@+ $@
732 732
733$(patsubst %.sh,%,$(SCRIPT_SH)) : % : %.sh 733$(patsubst %.sh,%,$(SCRIPT_SH)) : % : %.sh
734 $(QUIET_GEN)$(RM) $@ $@+ && \ 734 $(QUIET_GEN)$(RM) $@ $@+ && \
diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c
index a5a050af8e7..3eeef339c78 100644
--- a/tools/perf/builtin-record.c
+++ b/tools/perf/builtin-record.c
@@ -41,6 +41,7 @@ static int raw_samples = 0;
41static int system_wide = 0; 41static int system_wide = 0;
42static int profile_cpu = -1; 42static int profile_cpu = -1;
43static pid_t target_pid = -1; 43static pid_t target_pid = -1;
44static pid_t child_pid = -1;
44static int inherit = 1; 45static int inherit = 1;
45static int force = 0; 46static int force = 0;
46static int append_file = 0; 47static int append_file = 0;
@@ -184,6 +185,9 @@ static void sig_handler(int sig)
184 185
185static void sig_atexit(void) 186static 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 16af2d82e85..3db31e7bf17 100644
--- a/tools/perf/builtin-stat.c
+++ b/tools/perf/builtin-stat.c
@@ -69,7 +69,8 @@ static int run_idx = 0;
69static int run_count = 1; 69static int run_count = 1;
70static int inherit = 1; 70static int inherit = 1;
71static int scale = 1; 71static int scale = 1;
72static int target_pid = -1; 72static pid_t target_pid = -1;
73static pid_t child_pid = -1;
73static int null_run = 0; 74static int null_run = 0;
74 75
75static int fd[MAX_NR_CPUS][MAX_COUNTERS]; 76static 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 */
@@ -338,14 +341,24 @@ static void nsec_printout(int counter, double avg)
338 341
339static void abs_printout(int counter, double avg) 342static void abs_printout(int counter, double avg)
340{ 343{
344 double total, ratio = 0.0;
345
341 fprintf(stderr, " %14.0f %-24s", avg, event_name(counter)); 346 fprintf(stderr, " %14.0f %-24s", avg, event_name(counter));
342 347
343 if (MATCH_EVENT(HARDWARE, HW_INSTRUCTIONS, counter)) { 348 if (MATCH_EVENT(HARDWARE, HW_INSTRUCTIONS, counter)) {
344 fprintf(stderr, " # %10.3f IPC ", 349 total = avg_stats(&runtime_cycles_stats);
345 avg / avg_stats(&runtime_cycles_stats)); 350
351 if (total)
352 ratio = avg / total;
353
354 fprintf(stderr, " # %10.3f IPC ", ratio);
346 } else { 355 } else {
347 fprintf(stderr, " # %10.3f M/sec", 356 total = avg_stats(&runtime_nsecs_stats);
348 1000.0 * avg / avg_stats(&runtime_nsecs_stats)); 357
358 if (total)
359 ratio = 1000.0 * avg / total;
360
361 fprintf(stderr, " # %10.3f M/sec", ratio);
349 } 362 }
350} 363}
351 364
@@ -423,6 +436,9 @@ static void skip_signal(int signo)
423 436
424static void sig_atexit(void) 437static void sig_atexit(void)
425{ 438{
439 if (child_pid != -1)
440 kill(child_pid, SIGTERM);
441
426 if (signr == -1) 442 if (signr == -1)
427 return; 443 return;
428 444
diff --git a/tools/perf/builtin-timechart.c b/tools/perf/builtin-timechart.c
index 4405681b313..702d8fe58fb 100644
--- a/tools/perf/builtin-timechart.c
+++ b/tools/perf/builtin-timechart.c
@@ -46,6 +46,8 @@ static u64 turbo_frequency;
46 46
47static u64 first_time, last_time; 47static u64 first_time, last_time;
48 48
49static int power_only;
50
49 51
50static struct perf_header *header; 52static 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 1ca88896eee..37512e93623 100644
--- a/tools/perf/builtin-top.c
+++ b/tools/perf/builtin-top.c
@@ -782,6 +782,7 @@ static const char *skip_symbols[] = {
782 "exit_idle", 782 "exit_idle",
783 "mwait_idle", 783 "mwait_idle",
784 "mwait_idle_with_hints", 784 "mwait_idle_with_hints",
785 "poll_idle",
785 "ppc64_runlatch_off", 786 "ppc64_runlatch_off",
786 "pseries_dedicated_idle_sleep", 787 "pseries_dedicated_idle_sleep",
787 NULL 788 NULL
diff --git a/tools/perf/builtin-trace.c b/tools/perf/builtin-trace.c
index e9d256e2f47..0c5e4f72f2b 100644
--- a/tools/perf/builtin-trace.c
+++ b/tools/perf/builtin-trace.c
@@ -219,10 +219,6 @@ remap:
219more: 219more:
220 event = (event_t *)(buf + head); 220 event = (event_t *)(buf + head);
221 221
222 size = event->header.size;
223 if (!size)
224 size = 8;
225
226 if (head + event->header.size >= page_size * mmap_window) { 222 if (head + event->header.size >= page_size * mmap_window) {
227 unsigned long shift = page_size * (head / page_size); 223 unsigned long shift = page_size * (head / page_size);
228 int res; 224 int res;
@@ -237,7 +233,6 @@ more:
237 233
238 size = event->header.size; 234 size = event->header.size;
239 235
240
241 if (!size || process_event(event, offset, head) < 0) { 236 if (!size || process_event(event, offset, head) < 0) {
242 237
243 /* 238 /*
@@ -290,7 +285,6 @@ int cmd_trace(int argc, const char **argv, const char *prefix __used)
290 usage_with_options(annotate_usage, options); 285 usage_with_options(annotate_usage, options);
291 } 286 }
292 287
293
294 setup_pager(); 288 setup_pager();
295 289
296 return __cmd_trace(); 290 return __cmd_trace();
diff --git a/tools/perf/design.txt b/tools/perf/design.txt
index f1946d107b1..fdd42a824c9 100644
--- a/tools/perf/design.txt
+++ b/tools/perf/design.txt
@@ -455,3 +455,6 @@ will need at least this:
455 455
456If your architecture does have hardware capabilities, you can override the 456If your architecture does have hardware capabilities, you can override the
457weak stub hw_perf_event_init() to register hardware counters. 457weak stub hw_perf_event_init() to register hardware counters.
458
459Architectures that have d-cache aliassing issues, such as Sparc and ARM,
460should select PERF_USE_VMALLOC in order to avoid these for perf mmap().
diff --git a/tools/perf/util/module.c b/tools/perf/util/module.c
index 3d567fe59c7..0d8c85defcd 100644
--- a/tools/perf/util/module.c
+++ b/tools/perf/util/module.c
@@ -4,6 +4,7 @@
4#include "module.h" 4#include "module.h"
5 5
6#include <libelf.h> 6#include <libelf.h>
7#include <libgen.h>
7#include <gelf.h> 8#include <gelf.h>
8#include <elf.h> 9#include <elf.h>
9#include <dirent.h> 10#include <dirent.h>
@@ -409,35 +410,40 @@ out_failure:
409static int mod_dso__load_module_paths(struct mod_dso *self) 410static int mod_dso__load_module_paths(struct mod_dso *self)
410{ 411{
411 struct utsname uts; 412 struct utsname uts;
412 int count = 0, len; 413 int count = 0, len, err = -1;
413 char *line = NULL; 414 char *line = NULL;
414 FILE *file; 415 FILE *file;
415 char *path; 416 char *dpath, *dir;
416 size_t n; 417 size_t n;
417 418
418 if (uname(&uts) < 0) 419 if (uname(&uts) < 0)
419 goto out_failure; 420 return err;
420 421
421 len = strlen("/lib/modules/"); 422 len = strlen("/lib/modules/");
422 len += strlen(uts.release); 423 len += strlen(uts.release);
423 len += strlen("/modules.dep"); 424 len += strlen("/modules.dep");
424 425
425 path = calloc(1, len); 426 dpath = calloc(1, len + 1);
426 if (path == NULL) 427 if (dpath == NULL)
427 goto out_failure; 428 return err;
428 429
429 strcat(path, "/lib/modules/"); 430 strcat(dpath, "/lib/modules/");
430 strcat(path, uts.release); 431 strcat(dpath, uts.release);
431 strcat(path, "/modules.dep"); 432 strcat(dpath, "/modules.dep");
432 433
433 file = fopen(path, "r"); 434 file = fopen(dpath, "r");
434 free(path);
435 if (file == NULL) 435 if (file == NULL)
436 goto out_failure; 436 goto out_failure;
437 437
438 dir = dirname(dpath);
439 if (!dir)
440 goto out_failure;
441 strcat(dir, "/");
442
438 while (!feof(file)) { 443 while (!feof(file)) {
439 char *name, *tmp;
440 struct module *module; 444 struct module *module;
445 char *name, *path, *tmp;
446 FILE *modfile;
441 int line_len; 447 int line_len;
442 448
443 line_len = getline(&line, &n, file); 449 line_len = getline(&line, &n, file);
@@ -445,17 +451,41 @@ static int mod_dso__load_module_paths(struct mod_dso *self)
445 break; 451 break;
446 452
447 if (!line) 453 if (!line)
448 goto out_failure; 454 break;
449 455
450 line[--line_len] = '\0'; /* \n */ 456 line[--line_len] = '\0'; /* \n */
451 457
452 path = strtok(line, ":"); 458 path = strchr(line, ':');
459 if (!path)
460 break;
461 *path = '\0';
462
463 path = strdup(line);
453 if (!path) 464 if (!path)
454 goto out_failure; 465 break;
466
467 if (!strstr(path, dir)) {
468 if (strncmp(path, "kernel/", 7))
469 break;
470
471 free(path);
472 path = calloc(1, strlen(dir) + strlen(line) + 1);
473 if (!path)
474 break;
475 strcat(path, dir);
476 strcat(path, line);
477 }
478
479 modfile = fopen(path, "r");
480 if (modfile == NULL)
481 break;
482 fclose(modfile);
455 483
456 name = strdup(path); 484 name = strdup(path);
457 name = strtok(name, "/"); 485 if (!name)
486 break;
458 487
488 name = strtok(name, "/");
459 tmp = name; 489 tmp = name;
460 490
461 while (tmp) { 491 while (tmp) {
@@ -463,26 +493,25 @@ static int mod_dso__load_module_paths(struct mod_dso *self)
463 if (tmp) 493 if (tmp)
464 name = tmp; 494 name = tmp;
465 } 495 }
496
466 name = strsep(&name, "."); 497 name = strsep(&name, ".");
498 if (!name)
499 break;
467 500
468 /* Quirk: replace '-' with '_' in sound modules */ 501 /* Quirk: replace '-' with '_' in all modules */
469 for (len = strlen(name); len; len--) { 502 for (len = strlen(name); len; len--) {
470 if (*(name+len) == '-') 503 if (*(name+len) == '-')
471 *(name+len) = '_'; 504 *(name+len) = '_';
472 } 505 }
473 506
474 module = module__new(name, path); 507 module = module__new(name, path);
475 if (!module) { 508 if (!module)
476 fprintf(stderr, "load_module_paths: allocation error\n"); 509 break;
477 goto out_failure;
478 }
479 mod_dso__insert_module(self, module); 510 mod_dso__insert_module(self, module);
480 511
481 module->sections = sec_dso__new_dso("sections"); 512 module->sections = sec_dso__new_dso("sections");
482 if (!module->sections) { 513 if (!module->sections)
483 fprintf(stderr, "load_module_paths: allocation error\n"); 514 break;
484 goto out_failure;
485 }
486 515
487 module->active = mod_dso__load_sections(module); 516 module->active = mod_dso__load_sections(module);
488 517
@@ -490,13 +519,20 @@ static int mod_dso__load_module_paths(struct mod_dso *self)
490 count++; 519 count++;
491 } 520 }
492 521
493 free(line); 522 if (feof(file))
494 fclose(file); 523 err = count;
495 524 else
496 return count; 525 fprintf(stderr, "load_module_paths: modules.dep parsing failure!\n");
497 526
498out_failure: 527out_failure:
499 return -1; 528 if (dpath)
529 free(dpath);
530 if (file)
531 fclose(file);
532 if (line)
533 free(line);
534
535 return err;
500} 536}
501 537
502int mod_dso__load_modules(struct mod_dso *dso) 538int mod_dso__load_modules(struct mod_dso *dso)
diff --git a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.c
index 13ab4b842d4..87c424de79e 100644
--- a/tools/perf/util/parse-events.c
+++ b/tools/perf/util/parse-events.c
@@ -165,33 +165,31 @@ struct tracepoint_path *tracepoint_id_to_path(u64 config)
165 DIR *sys_dir, *evt_dir; 165 DIR *sys_dir, *evt_dir;
166 struct dirent *sys_next, *evt_next, sys_dirent, evt_dirent; 166 struct dirent *sys_next, *evt_next, sys_dirent, evt_dirent;
167 char id_buf[4]; 167 char id_buf[4];
168 int sys_dir_fd, fd; 168 int fd;
169 u64 id; 169 u64 id;
170 char evt_path[MAXPATHLEN]; 170 char evt_path[MAXPATHLEN];
171 char dir_path[MAXPATHLEN];
171 172
172 if (valid_debugfs_mount(debugfs_path)) 173 if (valid_debugfs_mount(debugfs_path))
173 return NULL; 174 return NULL;
174 175
175 sys_dir = opendir(debugfs_path); 176 sys_dir = opendir(debugfs_path);
176 if (!sys_dir) 177 if (!sys_dir)
177 goto cleanup; 178 return NULL;
178 sys_dir_fd = dirfd(sys_dir);
179 179
180 for_each_subsystem(sys_dir, sys_dirent, sys_next) { 180 for_each_subsystem(sys_dir, sys_dirent, sys_next) {
181 int dfd = openat(sys_dir_fd, sys_dirent.d_name, 181
182 O_RDONLY|O_DIRECTORY), evt_dir_fd; 182 snprintf(dir_path, MAXPATHLEN, "%s/%s", debugfs_path,
183 if (dfd == -1) 183 sys_dirent.d_name);
184 continue; 184 evt_dir = opendir(dir_path);
185 evt_dir = fdopendir(dfd); 185 if (!evt_dir)
186 if (!evt_dir) {
187 close(dfd);
188 continue; 186 continue;
189 } 187
190 evt_dir_fd = dirfd(evt_dir);
191 for_each_event(sys_dirent, evt_dir, evt_dirent, evt_next) { 188 for_each_event(sys_dirent, evt_dir, evt_dirent, evt_next) {
192 snprintf(evt_path, MAXPATHLEN, "%s/id", 189
190 snprintf(evt_path, MAXPATHLEN, "%s/%s/id", dir_path,
193 evt_dirent.d_name); 191 evt_dirent.d_name);
194 fd = openat(evt_dir_fd, evt_path, O_RDONLY); 192 fd = open(evt_path, O_RDONLY);
195 if (fd < 0) 193 if (fd < 0)
196 continue; 194 continue;
197 if (read(fd, id_buf, sizeof(id_buf)) < 0) { 195 if (read(fd, id_buf, sizeof(id_buf)) < 0) {
@@ -225,7 +223,6 @@ struct tracepoint_path *tracepoint_id_to_path(u64 config)
225 closedir(evt_dir); 223 closedir(evt_dir);
226 } 224 }
227 225
228cleanup:
229 closedir(sys_dir); 226 closedir(sys_dir);
230 return NULL; 227 return NULL;
231} 228}
@@ -761,28 +758,24 @@ static void print_tracepoint_events(void)
761{ 758{
762 DIR *sys_dir, *evt_dir; 759 DIR *sys_dir, *evt_dir;
763 struct dirent *sys_next, *evt_next, sys_dirent, evt_dirent; 760 struct dirent *sys_next, *evt_next, sys_dirent, evt_dirent;
764 int sys_dir_fd;
765 char evt_path[MAXPATHLEN]; 761 char evt_path[MAXPATHLEN];
762 char dir_path[MAXPATHLEN];
766 763
767 if (valid_debugfs_mount(debugfs_path)) 764 if (valid_debugfs_mount(debugfs_path))
768 return; 765 return;
769 766
770 sys_dir = opendir(debugfs_path); 767 sys_dir = opendir(debugfs_path);
771 if (!sys_dir) 768 if (!sys_dir)
772 goto cleanup; 769 return;
773 sys_dir_fd = dirfd(sys_dir);
774 770
775 for_each_subsystem(sys_dir, sys_dirent, sys_next) { 771 for_each_subsystem(sys_dir, sys_dirent, sys_next) {
776 int dfd = openat(sys_dir_fd, sys_dirent.d_name, 772
777 O_RDONLY|O_DIRECTORY), evt_dir_fd; 773 snprintf(dir_path, MAXPATHLEN, "%s/%s", debugfs_path,
778 if (dfd == -1) 774 sys_dirent.d_name);
779 continue; 775 evt_dir = opendir(dir_path);
780 evt_dir = fdopendir(dfd); 776 if (!evt_dir)
781 if (!evt_dir) {
782 close(dfd);
783 continue; 777 continue;
784 } 778
785 evt_dir_fd = dirfd(evt_dir);
786 for_each_event(sys_dirent, evt_dir, evt_dirent, evt_next) { 779 for_each_event(sys_dirent, evt_dir, evt_dirent, evt_next) {
787 snprintf(evt_path, MAXPATHLEN, "%s:%s", 780 snprintf(evt_path, MAXPATHLEN, "%s:%s",
788 sys_dirent.d_name, evt_dirent.d_name); 781 sys_dirent.d_name, evt_dirent.d_name);
@@ -791,8 +784,6 @@ static void print_tracepoint_events(void)
791 } 784 }
792 closedir(evt_dir); 785 closedir(evt_dir);
793 } 786 }
794
795cleanup:
796 closedir(sys_dir); 787 closedir(sys_dir);
797} 788}
798 789
diff --git a/tools/perf/util/svghelper.c b/tools/perf/util/svghelper.c
index a778fd0f4ae..856655d8b0b 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
29int svg_page_width = 1000; 29int svg_page_width = 1000;
30 30
31#define MIN_TEXT_SIZE 0.001 31#define MIN_TEXT_SIZE 0.01
32 32
33static u64 total_height; 33static u64 total_height;
34static FILE *svgfile; 34static 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 fd3d9c8e90f..47ea0609a76 100644
--- a/tools/perf/util/symbol.c
+++ b/tools/perf/util/symbol.c
@@ -324,8 +324,7 @@ static inline int elf_sym__is_function(const GElf_Sym *sym)
324{ 324{
325 return elf_sym__type(sym) == STT_FUNC && 325 return elf_sym__type(sym) == STT_FUNC &&
326 sym->st_name != 0 && 326 sym->st_name != 0 &&
327 sym->st_shndx != SHN_UNDEF && 327 sym->st_shndx != SHN_UNDEF;
328 sym->st_size != 0;
329} 328}
330 329
331static inline int elf_sym__is_label(const GElf_Sym *sym) 330static inline int elf_sym__is_label(const GElf_Sym *sym)
@@ -833,7 +832,7 @@ int dso__load_modules(struct dso *self, symbol_filter_t filter, int v)
833 struct mod_dso *mods = mod_dso__new_dso("modules"); 832 struct mod_dso *mods = mod_dso__new_dso("modules");
834 struct module *pos; 833 struct module *pos;
835 struct rb_node *next; 834 struct rb_node *next;
836 int err; 835 int err, count = 0;
837 836
838 err = mod_dso__load_modules(mods); 837 err = mod_dso__load_modules(mods);
839 838
@@ -852,14 +851,16 @@ int dso__load_modules(struct dso *self, symbol_filter_t filter, int v)
852 break; 851 break;
853 852
854 next = rb_next(&pos->rb_node); 853 next = rb_next(&pos->rb_node);
854 count += err;
855 } 855 }
856 856
857 if (err < 0) { 857 if (err < 0) {
858 mod_dso__delete_modules(mods); 858 mod_dso__delete_modules(mods);
859 mod_dso__delete_self(mods); 859 mod_dso__delete_self(mods);
860 return err;
860 } 861 }
861 862
862 return err; 863 return count;
863} 864}
864 865
865static inline void dso__fill_symbol_holes(struct dso *self) 866static inline void dso__fill_symbol_holes(struct dso *self)
@@ -913,8 +914,15 @@ int dso__load_kernel(struct dso *self, const char *vmlinux,
913 914
914 if (vmlinux) { 915 if (vmlinux) {
915 err = dso__load_vmlinux(self, vmlinux, filter, v); 916 err = dso__load_vmlinux(self, vmlinux, filter, v);
916 if (err > 0 && use_modules) 917 if (err > 0 && use_modules) {
917 err = dso__load_modules(self, filter, v); 918 int syms = dso__load_modules(self, filter, v);
919
920 if (syms < 0) {
921 fprintf(stderr, "dso__load_modules failed!\n");
922 return syms;
923 }
924 err += syms;
925 }
918 } 926 }
919 927
920 if (err <= 0) 928 if (err <= 0)
diff --git a/tools/perf/util/trace-event-parse.c b/tools/perf/util/trace-event-parse.c
index f6a8437141c..55b41b9e383 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 },