Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1373764
| From | Arnaldo Carvalho de Melo <acme@kernel.org> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH 11/19] perf tools: Introduce trim function |
| Date | 2016-04-07 23:10 +0200 |
| Message-ID | <rlplE-1qw-3@gated-at.bofh.it> (permalink) |
| References | <rlpbX-16R-3@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
From: Jiri Olsa <jolsa@kernel.org>
To be used in cases for both sides trim.
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Cc: Andreas Hollmann <hollmann@in.tum.de>
Cc: David Ahern <dsahern@gmail.com>
Cc: Milian Wolff <milian.wolff@kdab.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/1460013073-18444-1-git-send-email-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/ui/browsers/hists.c | 3 +--
tools/perf/ui/stdio/hist.c | 3 +--
tools/perf/util/util.h | 5 +++++
3 files changed, 7 insertions(+), 4 deletions(-)
diff --git a/tools/perf/ui/browsers/hists.c b/tools/perf/ui/browsers/hists.c
index 2a83414159a6..e70df2e54d66 100644
--- a/tools/perf/ui/browsers/hists.c
+++ b/tools/perf/ui/browsers/hists.c
@@ -1607,9 +1607,8 @@ static int hists_browser__scnprintf_hierarchy_headers(struct hist_browser *brows
ret = fmt->header(fmt, &dummy_hpp, hists_to_evsel(hists));
dummy_hpp.buf[ret] = '\0';
- rtrim(dummy_hpp.buf);
- start = ltrim(dummy_hpp.buf);
+ start = trim(dummy_hpp.buf);
ret = strlen(start);
if (start != dummy_hpp.buf)
diff --git a/tools/perf/ui/stdio/hist.c b/tools/perf/ui/stdio/hist.c
index 7aff5acf3265..560eb47d56f9 100644
--- a/tools/perf/ui/stdio/hist.c
+++ b/tools/perf/ui/stdio/hist.c
@@ -569,9 +569,8 @@ static int print_hierarchy_header(struct hists *hists, struct perf_hpp *hpp,
first_col = false;
fmt->header(fmt, hpp, hists_to_evsel(hists));
- rtrim(hpp->buf);
- header_width += fprintf(fp, "%s", ltrim(hpp->buf));
+ header_width += fprintf(fp, "%s", trim(hpp->buf));
}
}
diff --git a/tools/perf/util/util.h b/tools/perf/util/util.h
index 8298d607c738..3bf3de86d429 100644
--- a/tools/perf/util/util.h
+++ b/tools/perf/util/util.h
@@ -254,6 +254,11 @@ int hex2u64(const char *ptr, u64 *val);
char *ltrim(char *s);
char *rtrim(char *s);
+static inline char *trim(char *s)
+{
+ return ltrim(rtrim(s));
+}
+
void dump_stack(void);
void sighandler_dump_stack(int sig);
--
2.5.5
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[GIT PULL 00/19] perf/core improvements and fixes Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-04-07 23:00 +0200
[PATCH 04/19] perf tools: Remove superfluous ARCH Makefile includes Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-04-07 23:00 +0200
[PATCH 18/19] perf symbols: Record text offset in dso to calculate objdump address Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-04-07 23:00 +0200
[PATCH 08/19] perf trace: Infrastructure to show COMM strings for syscalls returning PIDs Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-04-07 23:00 +0200
[PATCH 01/19] perf config: Fix build with older toolchain. Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-04-07 23:10 +0200
[PATCH 11/19] perf tools: Introduce trim function Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-04-07 23:10 +0200
[PATCH 03/19] perf script perl: Do error checking on new backtrace routine Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-04-07 23:10 +0200
[PATCH 06/19] perf trace: Beautify sched_setscheduler 'policy' argument Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-04-07 23:10 +0200
[PATCH 07/19] perf trace: Beautify wait4/waitid 'options' argument Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-04-07 23:10 +0200
[PATCH 09/19] perf trace: Beautify set_tid_address, getpid, getppid return values Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-04-07 23:10 +0200
[PATCH 15/19] perf trace: Move syscall table id <-> name routines to separate class Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-04-07 23:10 +0200
[PATCH 14/19] perf trace: Beautify mode_t arguments Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-04-07 23:10 +0200
[PATCH 12/19] perf tools: Add dedicated unwind addr_space member into thread struct Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-04-07 23:10 +0200
[PATCH 13/19] perf script: Process event update events Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-04-07 23:10 +0200
[PATCH 16/19] perf tools: Allow generating per-arch syscall table arrays Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-04-07 23:10 +0200
[PATCH 05/19] perf list: Document event specifications better Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-04-07 23:10 +0200
[PATCH 02/19] perf probe: Check if dwarf_getlocations() is available Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-04-07 23:10 +0200
[PATCH 10/19] perf trace: Beautify pid_t arguments Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-04-07 23:10 +0200
Re: [GIT PULL 00/19] perf/core improvements and fixes Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-04-08 15:20 +0200
Re: [GIT PULL 00/19] perf/core improvements and fixes Ingo Molnar <mingo@kernel.org> - 2016-04-13 09:00 +0200
csiph-web