perf hists: Trim libtraceevent trace_seq buffers
tip-bot for Arnaldo Carvalho de Melo
merge botCommit-ID: 887fa86d6fd7a45cee2d0f9d5f75026786d61df2 Gitweb: http://git.kernel.org/tip/887fa86d6fd7a45cee2d0f9d5f75026786d61df2 Author: Arnaldo Carvalho de Melo <[email protected]> AuthorDate: Fri, 5 Aug 2016 12:37:21 -0300 Committer: Arnaldo Carvalho de Melo <[email protected]> CommitDate: Tue, 9 Aug 2016 10:46:56 -0300
perf hists: Trim libtraceevent trace_seq buffers
When we use libtraceevent to format trace event fields into printable strings to use in hist entries it is important to trim it from the default 4 KiB it starts with to what is really used, to reduce the memory footprint, so use realloc(seq.buffer, seq.len + 1) when returning the seq.buffer formatted with the fields contents.
Reported-and-Tested-by Wang Nan <[email protected]>
Cc Adrian Hunter <[email protected]>
Cc David Ahern <[email protected]>
Cc Jiri Olsa <[email protected]>
Cc Namhyung Kim <[email protected]>
Signed-off-by Arnaldo Carvalho de Melo <[email protected]>
--- tools/perf/util/sort.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
tools/perf/util/sort.c +5 -1
@@ -588,7 +588,11 @@ static char *get_trace_output(struct hist_entry *he) }else {pevent_event_info (&seq, evsel->tp_format, &rec); } -return seq.buffer; +/* +* Trim the buffer, it starts at 4KB and we're not going to +* add anything more to this buffer. +*/ +return realloc (seq.buffer, seq.len +1 ); } static int64_t