diff options
Diffstat (limited to 'tools/perf/builtin-top.c')
-rw-r--r-- | tools/perf/builtin-top.c | 28 |
1 files changed, 21 insertions, 7 deletions
diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c index d978dc99236c..c0f69e80b2cc 100644 --- a/tools/perf/builtin-top.c +++ b/tools/perf/builtin-top.c | |||
@@ -57,7 +57,7 @@ static int fd[MAX_NR_CPUS][MAX_COUNTERS]; | |||
57 | 57 | ||
58 | static int system_wide = 0; | 58 | static int system_wide = 0; |
59 | 59 | ||
60 | static int default_interval = 100000; | 60 | static int default_interval = 0; |
61 | 61 | ||
62 | static int count_filter = 5; | 62 | static int count_filter = 5; |
63 | static int print_entries = 15; | 63 | static int print_entries = 15; |
@@ -975,7 +975,13 @@ static void start_counter(int i, int counter) | |||
975 | attr = attrs + counter; | 975 | attr = attrs + counter; |
976 | 976 | ||
977 | attr->sample_type = PERF_SAMPLE_IP | PERF_SAMPLE_TID; | 977 | attr->sample_type = PERF_SAMPLE_IP | PERF_SAMPLE_TID; |
978 | attr->freq = freq; | 978 | |
979 | if (freq) { | ||
980 | attr->sample_type |= PERF_SAMPLE_PERIOD; | ||
981 | attr->freq = 1; | ||
982 | attr->sample_freq = freq; | ||
983 | } | ||
984 | |||
979 | attr->inherit = (cpu < 0) && inherit; | 985 | attr->inherit = (cpu < 0) && inherit; |
980 | 986 | ||
981 | try_again: | 987 | try_again: |
@@ -1130,11 +1136,6 @@ int cmd_top(int argc, const char **argv, const char *prefix __used) | |||
1130 | if (argc) | 1136 | if (argc) |
1131 | usage_with_options(top_usage, options); | 1137 | usage_with_options(top_usage, options); |
1132 | 1138 | ||
1133 | if (freq) { | ||
1134 | default_interval = freq; | ||
1135 | freq = 1; | ||
1136 | } | ||
1137 | |||
1138 | /* CPU and PID are mutually exclusive */ | 1139 | /* CPU and PID are mutually exclusive */ |
1139 | if (target_pid != -1 && profile_cpu != -1) { | 1140 | if (target_pid != -1 && profile_cpu != -1) { |
1140 | printf("WARNING: PID switch overriding CPU\n"); | 1141 | printf("WARNING: PID switch overriding CPU\n"); |
@@ -1151,6 +1152,19 @@ int cmd_top(int argc, const char **argv, const char *prefix __used) | |||
1151 | parse_symbols(); | 1152 | parse_symbols(); |
1152 | parse_source(sym_filter_entry); | 1153 | parse_source(sym_filter_entry); |
1153 | 1154 | ||
1155 | |||
1156 | /* | ||
1157 | * User specified count overrides default frequency. | ||
1158 | */ | ||
1159 | if (default_interval) | ||
1160 | freq = 0; | ||
1161 | else if (freq) { | ||
1162 | default_interval = freq; | ||
1163 | } else { | ||
1164 | fprintf(stderr, "frequency and count are zero, aborting\n"); | ||
1165 | exit(EXIT_FAILURE); | ||
1166 | } | ||
1167 | |||
1154 | /* | 1168 | /* |
1155 | * Fill in the ones not specifically initialized via -c: | 1169 | * Fill in the ones not specifically initialized via -c: |
1156 | */ | 1170 | */ |