aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/ui
diff options
context:
space:
mode:
authorJiri Olsa <jolsa@redhat.com>2012-12-01 15:15:40 -0500
committerArnaldo Carvalho de Melo <acme@redhat.com>2013-07-12 12:54:02 -0400
commit9af303e22a317d1cc6f440e08f72428830708b37 (patch)
treef9f93af120d5f3ce00682d8eb26797fc89f71a3f /tools/perf/ui
parentec308426ea743469ec6c2b0e06e20b3671546e8f (diff)
perf diff: Switching the base hists to be pairs head
Making the baseline hists to act as a pairs head. So far we don't care which hists act as a pairs head, because we have only 2 files to deal with and any of them is suitable to do the job. But if we want to process more files, we need to pick up one hists to act as pairs head, and the baseline hists is the most suitable. Signed-off-by: Jiri Olsa <jolsa@redhat.com> Reviewed-by: Namhyung Kim <namhyung@kernel.org> Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com> Cc: Frederic Weisbecker <fweisbec@gmail.com> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Paul Mackerras <paulus@samba.org> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Link: http://lkml.kernel.org/n/tip-cklmt2o4j87i9viz900245ae@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/ui')
-rw-r--r--tools/perf/ui/hist.c25
1 files changed, 5 insertions, 20 deletions
diff --git a/tools/perf/ui/hist.c b/tools/perf/ui/hist.c
index f45c97f694da..02313a9c4682 100644
--- a/tools/perf/ui/hist.c
+++ b/tools/perf/ui/hist.c
@@ -178,18 +178,8 @@ static int hpp__width_baseline(struct perf_hpp_fmt *fmt __maybe_unused,
178 178
179static double baseline_percent(struct hist_entry *he) 179static double baseline_percent(struct hist_entry *he)
180{ 180{
181 struct hist_entry *pair = hist_entry__next_pair(he); 181 struct hists *hists = he->hists;
182 struct hists *pair_hists = pair ? pair->hists : NULL; 182 return 100.0 * he->stat.period / hists->stats.total_period;
183 double percent = 0.0;
184
185 if (pair) {
186 u64 total_period = pair_hists->stats.total_period;
187 u64 base_period = pair->stat.period;
188
189 percent = 100.0 * base_period / total_period;
190 }
191
192 return percent;
193} 183}
194 184
195static int hpp__color_baseline(struct perf_hpp_fmt *fmt __maybe_unused, 185static int hpp__color_baseline(struct perf_hpp_fmt *fmt __maybe_unused,
@@ -197,10 +187,8 @@ static int hpp__color_baseline(struct perf_hpp_fmt *fmt __maybe_unused,
197{ 187{
198 double percent = baseline_percent(he); 188 double percent = baseline_percent(he);
199 189
200 if (hist_entry__has_pairs(he) || symbol_conf.field_sep) 190 return percent_color_snprintf(hpp->buf, hpp->size, " %6.2f%%",
201 return percent_color_snprintf(hpp->buf, hpp->size, " %6.2f%%", percent); 191 percent);
202 else
203 return scnprintf(hpp->buf, hpp->size, " ");
204} 192}
205 193
206static int hpp__entry_baseline(struct perf_hpp_fmt *_fmt __maybe_unused, 194static int hpp__entry_baseline(struct perf_hpp_fmt *_fmt __maybe_unused,
@@ -209,10 +197,7 @@ static int hpp__entry_baseline(struct perf_hpp_fmt *_fmt __maybe_unused,
209 double percent = baseline_percent(he); 197 double percent = baseline_percent(he);
210 const char *fmt = symbol_conf.field_sep ? "%.2f" : " %6.2f%%"; 198 const char *fmt = symbol_conf.field_sep ? "%.2f" : " %6.2f%%";
211 199
212 if (hist_entry__has_pairs(he) || symbol_conf.field_sep) 200 return scnprintf(hpp->buf, hpp->size, fmt, percent);
213 return scnprintf(hpp->buf, hpp->size, fmt, percent);
214 else
215 return scnprintf(hpp->buf, hpp->size, " ");
216} 201}
217 202
218static int hpp__header_period_baseline(struct perf_hpp_fmt *_fmt __maybe_unused, 203static int hpp__header_period_baseline(struct perf_hpp_fmt *_fmt __maybe_unused,