aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf
diff options
context:
space:
mode:
authorIngo Molnar <mingo@elte.hu>2011-12-20 14:32:37 -0500
committerIngo Molnar <mingo@elte.hu>2011-12-20 14:32:37 -0500
commitd9e24427f339e5c18419769d41697062811c5cd8 (patch)
tree3c50f19561f60d4175d375ff8d39ec203a42eb8c /tools/perf
parentd87f69a16eb2cb96459117b06949a560679002e4 (diff)
parent65c1e0452a3389f9b7b8c1b23305ed2922fafb2d (diff)
Merge branch 'perf/core' of git://github.com/acmel/linux into perf/core
Diffstat (limited to 'tools/perf')
-rw-r--r--tools/perf/Documentation/perf-report.txt5
-rw-r--r--tools/perf/builtin-record.c1
-rw-r--r--tools/perf/builtin-report.c6
-rw-r--r--tools/perf/builtin-test.c127
-rw-r--r--tools/perf/perf.h1
-rw-r--r--tools/perf/util/config.c5
-rw-r--r--tools/perf/util/event.c13
-rw-r--r--tools/perf/util/evlist.c4
-rw-r--r--tools/perf/util/evsel.c5
-rw-r--r--tools/perf/util/symbol.c11
-rw-r--r--tools/perf/util/usage.c5
-rw-r--r--tools/perf/util/values.c1
12 files changed, 160 insertions, 24 deletions
diff --git a/tools/perf/Documentation/perf-report.txt b/tools/perf/Documentation/perf-report.txt
index dc85392a5ac7..35af0dc8ccb4 100644
--- a/tools/perf/Documentation/perf-report.txt
+++ b/tools/perf/Documentation/perf-report.txt
@@ -80,9 +80,10 @@ OPTIONS
80--dump-raw-trace:: 80--dump-raw-trace::
81 Dump raw trace in ASCII. 81 Dump raw trace in ASCII.
82 82
83-g [type,min,order]:: 83-g [type,min[,limit],order]::
84--call-graph:: 84--call-graph::
85 Display call chains using type, min percent threshold and order. 85 Display call chains using type, min percent threshold, optional print
86 limit and order.
86 type can be either: 87 type can be either:
87 - flat: single column, linear exposure of call chains. 88 - flat: single column, linear exposure of call chains.
88 - graph: use a graph tree, displaying absolute overhead rates. 89 - graph: use a graph tree, displaying absolute overhead rates.
diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c
index 766fa0a91a32..f8fd14fb62ec 100644
--- a/tools/perf/builtin-record.c
+++ b/tools/perf/builtin-record.c
@@ -700,6 +700,7 @@ const struct option record_options[] = {
700 OPT_BOOLEAN('d', "data", &record.opts.sample_address, 700 OPT_BOOLEAN('d', "data", &record.opts.sample_address,
701 "Sample addresses"), 701 "Sample addresses"),
702 OPT_BOOLEAN('T', "timestamp", &record.opts.sample_time, "Sample timestamps"), 702 OPT_BOOLEAN('T', "timestamp", &record.opts.sample_time, "Sample timestamps"),
703 OPT_BOOLEAN('P', "period", &record.opts.period, "Sample period"),
703 OPT_BOOLEAN('n', "no-samples", &record.opts.no_samples, 704 OPT_BOOLEAN('n', "no-samples", &record.opts.no_samples,
704 "don't sample"), 705 "don't sample"),
705 OPT_BOOLEAN('N', "no-buildid-cache", &record.no_buildid_cache, 706 OPT_BOOLEAN('N', "no-buildid-cache", &record.no_buildid_cache,
diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c
index ece7c5d3f504..b2654c9fb5c6 100644
--- a/tools/perf/builtin-report.c
+++ b/tools/perf/builtin-report.c
@@ -407,7 +407,7 @@ parse_callchain_opt(const struct option *opt, const char *arg, int unset)
407 goto setup; 407 goto setup;
408 408
409 if (tok2[0] != 'c') { 409 if (tok2[0] != 'c') {
410 callchain_param.print_limit = strtod(tok2, &endptr); 410 callchain_param.print_limit = strtoul(tok2, &endptr, 0);
411 tok2 = strtok(NULL, ","); 411 tok2 = strtok(NULL, ",");
412 if (!tok2) 412 if (!tok2)
413 goto setup; 413 goto setup;
@@ -485,8 +485,8 @@ int cmd_report(int argc, const char **argv, const char *prefix __used)
485 "regex filter to identify parent, see: '--sort parent'"), 485 "regex filter to identify parent, see: '--sort parent'"),
486 OPT_BOOLEAN('x', "exclude-other", &symbol_conf.exclude_other, 486 OPT_BOOLEAN('x', "exclude-other", &symbol_conf.exclude_other,
487 "Only display entries with parent-match"), 487 "Only display entries with parent-match"),
488 OPT_CALLBACK_DEFAULT('g', "call-graph", &report, "output_type,min_percent, call_order", 488 OPT_CALLBACK_DEFAULT('g', "call-graph", &report, "output_type,min_percent[,print_limit],call_order",
489 "Display callchains using output_type (graph, flat, fractal, or none) , min percent threshold and callchain order. " 489 "Display callchains using output_type (graph, flat, fractal, or none) , min percent threshold, optional print limit and callchain order. "
490 "Default: fractal,0.5,callee", &parse_callchain_opt, callchain_default_opt), 490 "Default: fractal,0.5,callee", &parse_callchain_opt, callchain_default_opt),
491 OPT_BOOLEAN('G', "inverted", &report.inverted_callchain, 491 OPT_BOOLEAN('G', "inverted", &report.inverted_callchain,
492 "alias for inverted call graph"), 492 "alias for inverted call graph"),
diff --git a/tools/perf/builtin-test.c b/tools/perf/builtin-test.c
index 6173f780dce0..2b9a7f497a20 100644
--- a/tools/perf/builtin-test.c
+++ b/tools/perf/builtin-test.c
@@ -603,7 +603,7 @@ out_free_threads:
603 603
604#define TEST_ASSERT_VAL(text, cond) \ 604#define TEST_ASSERT_VAL(text, cond) \
605do { \ 605do { \
606 if (!cond) { \ 606 if (!(cond)) { \
607 pr_debug("FAILED %s:%d %s\n", __FILE__, __LINE__, text); \ 607 pr_debug("FAILED %s:%d %s\n", __FILE__, __LINE__, text); \
608 return -1; \ 608 return -1; \
609 } \ 609 } \
@@ -759,6 +759,103 @@ static int test__checkevent_breakpoint_w(struct perf_evlist *evlist)
759 return 0; 759 return 0;
760} 760}
761 761
762static int test__checkevent_tracepoint_modifier(struct perf_evlist *evlist)
763{
764 struct perf_evsel *evsel = list_entry(evlist->entries.next,
765 struct perf_evsel, node);
766
767 TEST_ASSERT_VAL("wrong exclude_user", evsel->attr.exclude_user);
768 TEST_ASSERT_VAL("wrong exclude_kernel", !evsel->attr.exclude_kernel);
769 TEST_ASSERT_VAL("wrong exclude_hv", evsel->attr.exclude_hv);
770 TEST_ASSERT_VAL("wrong precise_ip", !evsel->attr.precise_ip);
771
772 return test__checkevent_tracepoint(evlist);
773}
774
775static int
776test__checkevent_tracepoint_multi_modifier(struct perf_evlist *evlist)
777{
778 struct perf_evsel *evsel;
779
780 TEST_ASSERT_VAL("wrong number of entries", evlist->nr_entries > 1);
781
782 list_for_each_entry(evsel, &evlist->entries, node) {
783 TEST_ASSERT_VAL("wrong exclude_user",
784 !evsel->attr.exclude_user);
785 TEST_ASSERT_VAL("wrong exclude_kernel",
786 evsel->attr.exclude_kernel);
787 TEST_ASSERT_VAL("wrong exclude_hv", evsel->attr.exclude_hv);
788 TEST_ASSERT_VAL("wrong precise_ip", !evsel->attr.precise_ip);
789 }
790
791 return test__checkevent_tracepoint_multi(evlist);
792}
793
794static int test__checkevent_raw_modifier(struct perf_evlist *evlist)
795{
796 struct perf_evsel *evsel = list_entry(evlist->entries.next,
797 struct perf_evsel, node);
798
799 TEST_ASSERT_VAL("wrong exclude_user", evsel->attr.exclude_user);
800 TEST_ASSERT_VAL("wrong exclude_kernel", !evsel->attr.exclude_kernel);
801 TEST_ASSERT_VAL("wrong exclude_hv", evsel->attr.exclude_hv);
802 TEST_ASSERT_VAL("wrong precise_ip", evsel->attr.precise_ip);
803
804 return test__checkevent_raw(evlist);
805}
806
807static int test__checkevent_numeric_modifier(struct perf_evlist *evlist)
808{
809 struct perf_evsel *evsel = list_entry(evlist->entries.next,
810 struct perf_evsel, node);
811
812 TEST_ASSERT_VAL("wrong exclude_user", evsel->attr.exclude_user);
813 TEST_ASSERT_VAL("wrong exclude_kernel", evsel->attr.exclude_kernel);
814 TEST_ASSERT_VAL("wrong exclude_hv", !evsel->attr.exclude_hv);
815 TEST_ASSERT_VAL("wrong precise_ip", evsel->attr.precise_ip);
816
817 return test__checkevent_numeric(evlist);
818}
819
820static int test__checkevent_symbolic_name_modifier(struct perf_evlist *evlist)
821{
822 struct perf_evsel *evsel = list_entry(evlist->entries.next,
823 struct perf_evsel, node);
824
825 TEST_ASSERT_VAL("wrong exclude_user", evsel->attr.exclude_user);
826 TEST_ASSERT_VAL("wrong exclude_kernel", evsel->attr.exclude_kernel);
827 TEST_ASSERT_VAL("wrong exclude_hv", !evsel->attr.exclude_hv);
828 TEST_ASSERT_VAL("wrong precise_ip", !evsel->attr.precise_ip);
829
830 return test__checkevent_symbolic_name(evlist);
831}
832
833static int test__checkevent_symbolic_alias_modifier(struct perf_evlist *evlist)
834{
835 struct perf_evsel *evsel = list_entry(evlist->entries.next,
836 struct perf_evsel, node);
837
838 TEST_ASSERT_VAL("wrong exclude_user", !evsel->attr.exclude_user);
839 TEST_ASSERT_VAL("wrong exclude_kernel", evsel->attr.exclude_kernel);
840 TEST_ASSERT_VAL("wrong exclude_hv", evsel->attr.exclude_hv);
841 TEST_ASSERT_VAL("wrong precise_ip", !evsel->attr.precise_ip);
842
843 return test__checkevent_symbolic_alias(evlist);
844}
845
846static int test__checkevent_genhw_modifier(struct perf_evlist *evlist)
847{
848 struct perf_evsel *evsel = list_entry(evlist->entries.next,
849 struct perf_evsel, node);
850
851 TEST_ASSERT_VAL("wrong exclude_user", evsel->attr.exclude_user);
852 TEST_ASSERT_VAL("wrong exclude_kernel", !evsel->attr.exclude_kernel);
853 TEST_ASSERT_VAL("wrong exclude_hv", evsel->attr.exclude_hv);
854 TEST_ASSERT_VAL("wrong precise_ip", evsel->attr.precise_ip);
855
856 return test__checkevent_genhw(evlist);
857}
858
762static struct test__event_st { 859static struct test__event_st {
763 const char *name; 860 const char *name;
764 __u32 type; 861 __u32 type;
@@ -808,6 +905,34 @@ static struct test__event_st {
808 .name = "mem:0:w", 905 .name = "mem:0:w",
809 .check = test__checkevent_breakpoint_w, 906 .check = test__checkevent_breakpoint_w,
810 }, 907 },
908 {
909 .name = "syscalls:sys_enter_open:k",
910 .check = test__checkevent_tracepoint_modifier,
911 },
912 {
913 .name = "syscalls:*:u",
914 .check = test__checkevent_tracepoint_multi_modifier,
915 },
916 {
917 .name = "r1:kp",
918 .check = test__checkevent_raw_modifier,
919 },
920 {
921 .name = "1:1:hp",
922 .check = test__checkevent_numeric_modifier,
923 },
924 {
925 .name = "instructions:h",
926 .check = test__checkevent_symbolic_name_modifier,
927 },
928 {
929 .name = "faults:u",
930 .check = test__checkevent_symbolic_alias_modifier,
931 },
932 {
933 .name = "L1-dcache-load-miss:kp",
934 .check = test__checkevent_genhw_modifier,
935 },
811}; 936};
812 937
813#define TEST__EVENTS_CNT (sizeof(test__events) / sizeof(struct test__event_st)) 938#define TEST__EVENTS_CNT (sizeof(test__events) / sizeof(struct test__event_st))
diff --git a/tools/perf/perf.h b/tools/perf/perf.h
index ea804f5a8cc2..64f8bee31ced 100644
--- a/tools/perf/perf.h
+++ b/tools/perf/perf.h
@@ -200,6 +200,7 @@ struct perf_record_opts {
200 bool sample_time; 200 bool sample_time;
201 bool sample_id_all_avail; 201 bool sample_id_all_avail;
202 bool system_wide; 202 bool system_wide;
203 bool period;
203 unsigned int freq; 204 unsigned int freq;
204 unsigned int mmap_pages; 205 unsigned int mmap_pages;
205 unsigned int user_freq; 206 unsigned int user_freq;
diff --git a/tools/perf/util/config.c b/tools/perf/util/config.c
index 80d9598db31a..0deac6a14b65 100644
--- a/tools/perf/util/config.c
+++ b/tools/perf/util/config.c
@@ -1,5 +1,8 @@
1/* 1/*
2 * GIT - The information manager from hell 2 * config.c
3 *
4 * Helper functions for parsing config items.
5 * Originally copied from GIT source.
3 * 6 *
4 * Copyright (C) Linus Torvalds, 2005 7 * Copyright (C) Linus Torvalds, 2005
5 * Copyright (C) Johannes Schindelin, 2005 8 * Copyright (C) Johannes Schindelin, 2005
diff --git a/tools/perf/util/event.c b/tools/perf/util/event.c
index 97c479bcb0dc..b7c7f39a8f6d 100644
--- a/tools/perf/util/event.c
+++ b/tools/perf/util/event.c
@@ -814,13 +814,14 @@ int perf_event__preprocess_sample(const union perf_event *event,
814 al->cpu = sample->cpu; 814 al->cpu = sample->cpu;
815 815
816 if (al->map) { 816 if (al->map) {
817 struct dso *dso = al->map->dso;
818
817 if (symbol_conf.dso_list && 819 if (symbol_conf.dso_list &&
818 (!al->map || !al->map->dso || 820 (!dso || !(strlist__has_entry(symbol_conf.dso_list,
819 !(strlist__has_entry(symbol_conf.dso_list, 821 dso->short_name) ||
820 al->map->dso->short_name) || 822 (dso->short_name != dso->long_name &&
821 (al->map->dso->short_name != al->map->dso->long_name && 823 strlist__has_entry(symbol_conf.dso_list,
822 strlist__has_entry(symbol_conf.dso_list, 824 dso->long_name)))))
823 al->map->dso->long_name)))))
824 goto out_filtered; 825 goto out_filtered;
825 826
826 al->sym = map__find_symbol(al->map, al->addr, filter); 827 al->sym = map__find_symbol(al->map, al->addr, filter);
diff --git a/tools/perf/util/evlist.c b/tools/perf/util/evlist.c
index 8b19e7a1e881..963d63dde457 100644
--- a/tools/perf/util/evlist.c
+++ b/tools/perf/util/evlist.c
@@ -447,8 +447,10 @@ static int __perf_evlist__mmap(struct perf_evlist *evlist,
447 evlist->mmap[idx].mask = mask; 447 evlist->mmap[idx].mask = mask;
448 evlist->mmap[idx].base = mmap(NULL, evlist->mmap_len, prot, 448 evlist->mmap[idx].base = mmap(NULL, evlist->mmap_len, prot,
449 MAP_SHARED, fd, 0); 449 MAP_SHARED, fd, 0);
450 if (evlist->mmap[idx].base == MAP_FAILED) 450 if (evlist->mmap[idx].base == MAP_FAILED) {
451 evlist->mmap[idx].base = NULL;
451 return -1; 452 return -1;
453 }
452 454
453 perf_evlist__add_pollfd(evlist, fd); 455 perf_evlist__add_pollfd(evlist, fd);
454 return 0; 456 return 0;
diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c
index 4a8c8b02e9cc..667f3b78bb2c 100644
--- a/tools/perf/util/evsel.c
+++ b/tools/perf/util/evsel.c
@@ -108,6 +108,9 @@ void perf_evsel__config(struct perf_evsel *evsel, struct perf_record_opts *opts)
108 if (opts->system_wide) 108 if (opts->system_wide)
109 attr->sample_type |= PERF_SAMPLE_CPU; 109 attr->sample_type |= PERF_SAMPLE_CPU;
110 110
111 if (opts->period)
112 attr->sample_type |= PERF_SAMPLE_PERIOD;
113
111 if (opts->sample_id_all_avail && 114 if (opts->sample_id_all_avail &&
112 (opts->sample_time || opts->system_wide || 115 (opts->sample_time || opts->system_wide ||
113 !opts->no_inherit || opts->cpu_list)) 116 !opts->no_inherit || opts->cpu_list))
@@ -457,7 +460,7 @@ int perf_event__parse_sample(const union perf_event *event, u64 type,
457 u32 val32[2]; 460 u32 val32[2];
458 } u; 461 } u;
459 462
460 463 memset(data, 0, sizeof(*data));
461 data->cpu = data->pid = data->tid = -1; 464 data->cpu = data->pid = data->tid = -1;
462 data->stream_id = data->id = data->time = -1ULL; 465 data->stream_id = data->id = data->time = -1ULL;
463 466
diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c
index 632b50c7bc26..215d50f2042e 100644
--- a/tools/perf/util/symbol.c
+++ b/tools/perf/util/symbol.c
@@ -1757,7 +1757,7 @@ static int map_groups__set_modules_path_dir(struct map_groups *mg,
1757 struct stat st; 1757 struct stat st;
1758 1758
1759 /*sshfs might return bad dent->d_type, so we have to stat*/ 1759 /*sshfs might return bad dent->d_type, so we have to stat*/
1760 sprintf(path, "%s/%s", dir_name, dent->d_name); 1760 snprintf(path, sizeof(path), "%s/%s", dir_name, dent->d_name);
1761 if (stat(path, &st)) 1761 if (stat(path, &st))
1762 continue; 1762 continue;
1763 1763
@@ -1766,8 +1766,6 @@ static int map_groups__set_modules_path_dir(struct map_groups *mg,
1766 !strcmp(dent->d_name, "..")) 1766 !strcmp(dent->d_name, ".."))
1767 continue; 1767 continue;
1768 1768
1769 snprintf(path, sizeof(path), "%s/%s",
1770 dir_name, dent->d_name);
1771 ret = map_groups__set_modules_path_dir(mg, path); 1769 ret = map_groups__set_modules_path_dir(mg, path);
1772 if (ret < 0) 1770 if (ret < 0)
1773 goto out; 1771 goto out;
@@ -1788,9 +1786,6 @@ static int map_groups__set_modules_path_dir(struct map_groups *mg,
1788 if (map == NULL) 1786 if (map == NULL)
1789 continue; 1787 continue;
1790 1788
1791 snprintf(path, sizeof(path), "%s/%s",
1792 dir_name, dent->d_name);
1793
1794 long_name = strdup(path); 1789 long_name = strdup(path);
1795 if (long_name == NULL) { 1790 if (long_name == NULL) {
1796 ret = -1; 1791 ret = -1;
@@ -2609,10 +2604,10 @@ int symbol__init(void)
2609 symbol_conf.initialized = true; 2604 symbol_conf.initialized = true;
2610 return 0; 2605 return 0;
2611 2606
2612out_free_dso_list:
2613 strlist__delete(symbol_conf.dso_list);
2614out_free_comm_list: 2607out_free_comm_list:
2615 strlist__delete(symbol_conf.comm_list); 2608 strlist__delete(symbol_conf.comm_list);
2609out_free_dso_list:
2610 strlist__delete(symbol_conf.dso_list);
2616 return -1; 2611 return -1;
2617} 2612}
2618 2613
diff --git a/tools/perf/util/usage.c b/tools/perf/util/usage.c
index e16bf9a707e8..d76d1c0ff98f 100644
--- a/tools/perf/util/usage.c
+++ b/tools/perf/util/usage.c
@@ -1,5 +1,8 @@
1/* 1/*
2 * GIT - The information manager from hell 2 * usage.c
3 *
4 * Various reporting routines.
5 * Originally copied from GIT source.
3 * 6 *
4 * Copyright (C) Linus Torvalds, 2005 7 * Copyright (C) Linus Torvalds, 2005
5 */ 8 */
diff --git a/tools/perf/util/values.c b/tools/perf/util/values.c
index bdd33470b235..697c8b4e59cc 100644
--- a/tools/perf/util/values.c
+++ b/tools/perf/util/values.c
@@ -32,6 +32,7 @@ void perf_read_values_destroy(struct perf_read_values *values)
32 32
33 for (i = 0; i < values->threads; i++) 33 for (i = 0; i < values->threads; i++)
34 free(values->value[i]); 34 free(values->value[i]);
35 free(values->value);
35 free(values->pid); 36 free(values->pid);
36 free(values->tid); 37 free(values->tid);
37 free(values->counterrawid); 38 free(values->counterrawid);