Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1618886
| From | Arnaldo Carvalho de Melo <acme@kernel.org> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH 2/5] perf stat: Refactor the code to strip csv output with ltrim() |
| Date | 2017-04-07 17:10 +0200 |
| Message-ID | <ttDGr-nA-49@gated-at.bofh.it> (permalink) |
| References | <ttD3H-8io-3@gated-at.bofh.it> <ttD3J-8io-31@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
Em Fri, Apr 07, 2017 at 11:24:18PM +0900, Taeung Song escreveu:
> To strip csv output, use ltrim() instead of
> just while loop and isspace() at print_metric_{only}_csv().
Applied.
> Cc: Andi Kleen <ak@linux.intel.com>
> Cc: Jiri Olsa <jolsa@kernel.org>
> Cc: Namhyung Kim <namhyung@kernel.org>
> Signed-off-by: Taeung Song <treeze.taeung@gmail.com>
> ---
> tools/perf/builtin-stat.c | 10 ++--------
> 1 file changed, 2 insertions(+), 8 deletions(-)
>
> diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c
> index 2158ea1..868e086a 100644
> --- a/tools/perf/builtin-stat.c
> +++ b/tools/perf/builtin-stat.c
> @@ -875,10 +875,7 @@ static void print_metric_csv(void *ctx,
> return;
> }
> snprintf(buf, sizeof(buf), fmt, val);
> - vals = buf;
> - while (isspace(*vals))
> - vals++;
> - ends = vals;
> + ends = vals = ltrim(buf);
> while (isdigit(*ends) || *ends == '.')
> ends++;
> *ends = 0;
> @@ -950,10 +947,7 @@ static void print_metric_only_csv(void *ctx, const char *color __maybe_unused,
> return;
> unit = fixunit(tbuf, os->evsel, unit);
> snprintf(buf, sizeof buf, fmt, val);
> - vals = buf;
> - while (isspace(*vals))
> - vals++;
> - ends = vals;
> + ends = vals = ltrim(buf);
> while (isdigit(*ends) || *ends == '.')
> ends++;
> *ends = 0;
> --
> 2.7.4
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH 0/5] Refactoring with ltrim() and rtrim() Taeung Song <treeze.taeung@gmail.com> - 2017-04-07 16:30 +0200
[PATCH 2/5] perf stat: Refactor the code to strip csv output with ltrim() Taeung Song <treeze.taeung@gmail.com> - 2017-04-07 16:30 +0200
Re: [PATCH 2/5] perf stat: Refactor the code to strip csv output with ltrim() Arnaldo Carvalho de Melo <acme@kernel.org> - 2017-04-07 17:10 +0200
Re: [PATCH 2/5] perf stat: Refactor the code to strip csv output with ltrim() Taeung Song <treeze.taeung@gmail.com> - 2017-04-08 01:50 +0200
[PATCH 3/5] perf ui browser: Refactor the code to parse color configs with ltrim() Taeung Song <treeze.taeung@gmail.com> - 2017-04-07 16:30 +0200
[PATCH 1/5] perf annotate: Refactor the code to parse disassemble lines with {l,r}trim() Taeung Song <treeze.taeung@gmail.com> - 2017-04-07 16:30 +0200
Re: [PATCH 1/5] perf annotate: Refactor the code to parse disassemble lines with {l,r}trim() Arnaldo Carvalho de Melo <acme@kernel.org> - 2017-04-07 17:10 +0200
Re: [PATCH 1/5] perf annotate: Refactor the code to parse disassemble lines with {l,r}trim() Taeung Song <treeze.taeung@gmail.com> - 2017-04-07 20:10 +0200
Re: [PATCH 1/5] perf annotate: Refactor the code to parse disassemble lines with {l,r}trim() Arnaldo Carvalho de Melo <acme@kernel.org> - 2017-04-07 17:10 +0200
Re: [PATCH 1/5] perf annotate: Refactor the code to parse disassemble lines with {l,r}trim() Taeung Song <treeze.taeung@gmail.com> - 2017-04-08 02:20 +0200
Re: [PATCH 1/5] perf annotate: Refactor the code to parse disassemble lines with {l,r}trim() Arnaldo Carvalho de Melo <acme@kernel.org> - 2017-04-07 17:10 +0200
csiph-web