aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/builtin-diff.c
diff options
context:
space:
mode:
Diffstat (limited to 'tools/perf/builtin-diff.c')
-rw-r--r--tools/perf/builtin-diff.c19
1 files changed, 16 insertions, 3 deletions
diff --git a/tools/perf/builtin-diff.c b/tools/perf/builtin-diff.c
index 4fde60655341..ff91e9c291bb 100644
--- a/tools/perf/builtin-diff.c
+++ b/tools/perf/builtin-diff.c
@@ -50,6 +50,9 @@ static int diff__process_sample_event(event_t *event, struct perf_session *sessi
50 return -1; 50 return -1;
51 } 51 }
52 52
53 if (al.filtered)
54 return 0;
55
53 event__parse_sample(event, session->sample_type, &data); 56 event__parse_sample(event, session->sample_type, &data);
54 57
55 if (al.sym && perf_session__add_hist_entry(session, &al, data.period)) { 58 if (al.sym && perf_session__add_hist_entry(session, &al, data.period)) {
@@ -182,10 +185,14 @@ blank: memset(displacement, ' ', sizeof(displacement));
182 printed = fprintf(fp, "%4lu %5.5s ", pos, displacement); 185 printed = fprintf(fp, "%4lu %5.5s ", pos, displacement);
183 186
184 if (show_percent) { 187 if (show_percent) {
185 double old_percent = (old_count * 100) / pair_session->events_stats.total, 188 double old_percent = 0, new_percent = 0, diff;
186 new_percent = (self->count * 100) / session->events_stats.total; 189
187 double diff = old_percent - new_percent; 190 if (pair_session->events_stats.total > 0)
191 old_percent = (old_count * 100) / pair_session->events_stats.total;
192 if (session->events_stats.total > 0)
193 new_percent = (self->count * 100) / session->events_stats.total;
188 194
195 diff = old_percent - new_percent;
189 if (verbose) 196 if (verbose)
190 printed += fprintf(fp, " %3.2f%% %3.2f%%", old_percent, new_percent); 197 printed += fprintf(fp, " %3.2f%% %3.2f%%", old_percent, new_percent);
191 198
@@ -260,6 +267,12 @@ static const struct option options[] = {
260 "Don't shorten the pathnames taking into account the cwd"), 267 "Don't shorten the pathnames taking into account the cwd"),
261 OPT_BOOLEAN('P', "full-paths", &event_ops.full_paths, 268 OPT_BOOLEAN('P', "full-paths", &event_ops.full_paths,
262 "Don't shorten the pathnames taking into account the cwd"), 269 "Don't shorten the pathnames taking into account the cwd"),
270 OPT_STRING('d', "dsos", &symbol_conf.dso_list_str, "dso[,dso...]",
271 "only consider symbols in these dsos"),
272 OPT_STRING('C', "comms", &symbol_conf.comm_list_str, "comm[,comm...]",
273 "only consider symbols in these comms"),
274 OPT_STRING('S', "symbols", &symbol_conf.sym_list_str, "symbol[,symbol...]",
275 "only consider these symbols"),
263 OPT_END() 276 OPT_END()
264}; 277};
265 278