summaryrefslogtreecommitdiffstats
path: root/tools/perf/util/hist.h
diff options
context:
space:
mode:
authorArnaldo Carvalho de Melo <acme@redhat.com>2010-03-31 11:33:40 -0300
committerArnaldo Carvalho de Melo <acme@redhat.com>2010-04-02 16:28:15 -0300
commita4e3b956a820162b7c1d616117b4f23b6017f504 (patch)
tree370116b6f6f4f8d3410a14831d394cf4993d04d8 /tools/perf/util/hist.h
parent70162138c91b040da3162fe1f34fe8aaf6506f10 (diff)
downloadblackbird-op-linux-a4e3b956a820162b7c1d616117b4f23b6017f504.tar.gz
blackbird-op-linux-a4e3b956a820162b7c1d616117b4f23b6017f504.zip
perf hist: Replace ->print() routines by ->snprintf() equivalents
Then hist_entry__fprintf will just us the newly introduced hist_entry__snprintf, add the newline and fprintf it to the supplied FILE descriptor. This allows us to remove the use_browser checking in the color_printf routines, that now got color_snprintf variants too. The newt TUI browser (and other GUIs that may come in the future) don't have to worry about stdio specific stuff in the strings they get from the se->snprintf routines and instead use whatever means to do the equivalent. Also the newt TUI browser don't have to use the fmemopen() hack, instead it can use the se->snprintf routines directly. For now tho use the hist_entry__snprintf routine to reduce the patch size. Cc: Frédéric Weisbecker <fweisbec@gmail.com> Cc: Mike Galbraith <efault@gmx.de> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Cc: Paul Mackerras <paulus@samba.org> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/util/hist.h')
-rw-r--r--tools/perf/util/hist.h7
1 files changed, 6 insertions, 1 deletions
diff --git a/tools/perf/util/hist.h b/tools/perf/util/hist.h
index da6a8c1320fa..ad17f0ad798b 100644
--- a/tools/perf/util/hist.h
+++ b/tools/perf/util/hist.h
@@ -18,11 +18,16 @@ struct hist_entry *__perf_session__add_hist_entry(struct rb_root *hists,
u64 count, bool *hit);
extern int64_t hist_entry__cmp(struct hist_entry *, struct hist_entry *);
extern int64_t hist_entry__collapse(struct hist_entry *, struct hist_entry *);
-size_t hist_entry__fprintf(struct hist_entry *self,
+int hist_entry__fprintf(struct hist_entry *self,
struct perf_session *pair_session,
bool show_displacement,
long displacement, FILE *fp,
u64 session_total);
+int hist_entry__snprintf(struct hist_entry *self,
+ char *bf, size_t size,
+ struct perf_session *pair_session,
+ bool show_displacement, long displacement,
+ bool color, u64 session_total);
void hist_entry__free(struct hist_entry *);
u64 perf_session__output_resort(struct rb_root *hists, u64 total_samples);
OpenPOWER on IntegriCloud