[PATCH 07/22] perf tools: Implement selected bool se_snprintf callback logic

From: Jiri Olsa
Date: Sun Feb 02 2014 - 16:39:56 EST


Pass the selected info for TUI browser.

Signed-off-by: Jiri Olsa <jolsa@xxxxxxxxxx>
Cc: Corey Ashford <cjashfor@xxxxxxxxxxxxxxxxxx>
Cc: Frederic Weisbecker <fweisbec@xxxxxxxxx>
Cc: Ingo Molnar <mingo@xxxxxxx>
Cc: Namhyung Kim <namhyung@xxxxxxxxxx>
Cc: Paul Mackerras <paulus@xxxxxxxxx>
Cc: Peter Zijlstra <a.p.zijlstra@xxxxxxxxx>
Cc: Arnaldo Carvalho de Melo <acme@xxxxxxxxxx>
Cc: David Ahern <dsahern@xxxxxxxxx>
---
tools/perf/ui/browsers/hists.c | 5 +++--
tools/perf/ui/hist.c | 5 +++--
tools/perf/ui/stdio/hist.c | 2 +-
tools/perf/util/hist.h | 3 ++-
4 files changed, 9 insertions(+), 6 deletions(-)

diff --git a/tools/perf/ui/browsers/hists.c b/tools/perf/ui/browsers/hists.c
index 0a08853..0f6d515 100644
--- a/tools/perf/ui/browsers/hists.c
+++ b/tools/perf/ui/browsers/hists.c
@@ -790,7 +790,8 @@ static int hist_browser__show_entry(struct hist_browser *browser,
if (!browser->b.navkeypressed)
width += 1;

- hist_entry__sort_snprintf(entry, s, sizeof(s), browser->hists);
+ hist_entry__sort_snprintf(entry, current_entry, s, sizeof(s),
+ browser->hists);
slsmg_write_nstring(s, width);
++row;
++printed;
@@ -1124,7 +1125,7 @@ static int hist_browser__fprintf_entry(struct hist_browser *browser,
if (symbol_conf.use_callchain)
folded_sign = hist_entry__folded(he);

- hist_entry__sort_snprintf(he, s, sizeof(s), browser->hists);
+ hist_entry__sort_snprintf(he, false, s, sizeof(s), browser->hists);
percent = (he->stat.period * 100.0) / browser->hists->stats.total_period;

if (symbol_conf.use_callchain)
diff --git a/tools/perf/ui/hist.c b/tools/perf/ui/hist.c
index 75a8ea6..430c4ea 100644
--- a/tools/perf/ui/hist.c
+++ b/tools/perf/ui/hist.c
@@ -298,7 +298,8 @@ void perf_hpp__cancel_cumulate(void)
perf_hpp__format[PERF_HPP__OVERHEAD].header = hpp__header_overhead;
}

-int hist_entry__sort_snprintf(struct hist_entry *he, char *s, size_t size,
+int hist_entry__sort_snprintf(struct hist_entry *he, bool selected,
+ char *s, size_t size,
struct hists *hists)
{
const char *sep = symbol_conf.field_sep;
@@ -310,7 +311,7 @@ int hist_entry__sort_snprintf(struct hist_entry *he, char *s, size_t size,
continue;

ret += scnprintf(s + ret, size - ret, "%s", sep ?: " ");
- ret += se->se_snprintf(se, false, he, s + ret, size - ret,
+ ret += se->se_snprintf(se, selected, he, s + ret, size - ret,
hists__col_len(hists, se->se_width_idx));
}

diff --git a/tools/perf/ui/stdio/hist.c b/tools/perf/ui/stdio/hist.c
index b48c7ba..ab6f4d6 100644
--- a/tools/perf/ui/stdio/hist.c
+++ b/tools/perf/ui/stdio/hist.c
@@ -360,7 +360,7 @@ static int hist_entry__fprintf(struct hist_entry *he, size_t size,
size = hpp.size = bfsz;

ret = hist_entry__period_snprintf(&hpp, he);
- hist_entry__sort_snprintf(he, bf + ret, size - ret, hists);
+ hist_entry__sort_snprintf(he, false, bf + ret, size - ret, hists);

ret = fprintf(fp, "%s\n", bf);

diff --git a/tools/perf/util/hist.h b/tools/perf/util/hist.h
index ae403a6..9c0bd20 100644
--- a/tools/perf/util/hist.h
+++ b/tools/perf/util/hist.h
@@ -143,7 +143,8 @@ int hist_entry_iter__add(struct hist_entry_iter *iter, struct addr_location *al,
int64_t hist_entry__cmp(struct hist_entry *left, struct hist_entry *right);
int64_t hist_entry__collapse(struct hist_entry *left, struct hist_entry *right);
int hist_entry__transaction_len(void);
-int hist_entry__sort_snprintf(struct hist_entry *he, char *bf, size_t size,
+int hist_entry__sort_snprintf(struct hist_entry *he, bool selected,
+ char *bf, size_t size,
struct hists *hists);
void hist_entry__free(struct hist_entry *);

--
1.8.3.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/