Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1331125 > unrolled thread
| Started by | Jiri Olsa <jolsa@redhat.com> |
|---|---|
| First post | 2016-02-10 13:50 +0100 |
| Last post | 2016-02-10 15:40 +0100 |
| Articles | 2 — 2 participants |
Back to article view | Back to linux.kernel
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: [PATCH 15/23] perf ui/stdio: Align column header for hierarchy output Jiri Olsa <jolsa@redhat.com> - 2016-02-10 13:50 +0100
Re: [PATCH 15/23] perf ui/stdio: Align column header for hierarchy output Namhyung Kim <namhyung@kernel.org> - 2016-02-10 15:40 +0100
| From | Jiri Olsa <jolsa@redhat.com> |
|---|---|
| Date | 2016-02-10 13:50 +0100 |
| Subject | Re: [PATCH 15/23] perf ui/stdio: Align column header for hierarchy output |
| Message-ID | <r0Cnw-2fc-15@gated-at.bofh.it> |
On Fri, Feb 05, 2016 at 10:01:47PM +0900, Namhyung Kim wrote:
> The hierarchy output mode is to group entries so the existing columns
> won't fit to the new output. Treat all sort keys as a single column and
> separate headers by "/".
>
> # Overhead Command / Shared Object
> # ........... ................................
> #
> 15.11% swapper
> 14.97% [kernel.vmlinux]
> 0.09% [libahci]
> 0.05% [iwlwifi]
> ...
>
> Acked-by: Pekka Enberg <penberg@kernel.org>
> Signed-off-by: Namhyung Kim <namhyung@kernel.org>
> ---
> tools/perf/ui/stdio/hist.c | 107 +++++++++++++++++++++++++++++++++++++++++++++
> 1 file changed, 107 insertions(+)
>
> diff --git a/tools/perf/ui/stdio/hist.c b/tools/perf/ui/stdio/hist.c
> index b58f718a6afc..4bdab3cf1b6c 100644
> --- a/tools/perf/ui/stdio/hist.c
> +++ b/tools/perf/ui/stdio/hist.c
> @@ -505,6 +505,108 @@ static int hist_entry__fprintf(struct hist_entry *he, size_t size,
> return ret;
> }
>
> +static int print_hierarchy_indent(const char *sep, int nr_sort,
> + const char *line, FILE *fp)
> +{
> + if (sep != NULL || nr_sort < 1)
> + return 0;
> +
> + return fprintf(fp, "%-.*s", (nr_sort - 1) * HIERARCHY_INDENT, line);
hum, could you use fprintf(fp, "%*c", nr_sort..., '.');
with the same effect to get rid of those dots and spaces strings..
jirka
> +}
> +
> +static int print_hierarchy_header(struct hists *hists, struct perf_hpp *hpp,
> + const char *sep, FILE *fp)
> +{
> + bool first = true;
> + int nr_sort;
> + unsigned width = 0;
> + unsigned header_width = 0;
> + struct perf_hpp_fmt *fmt;
> + const char spaces[] = " "
> + " "
> + " ";
> + const char dots[] = "................................................."
> + "....................................................................."
> + ".....................................................................";
SNIP
[toc] | [next] | [standalone]
| From | Namhyung Kim <namhyung@kernel.org> |
|---|---|
| Date | 2016-02-10 15:40 +0100 |
| Message-ID | <r0E5Y-3mS-5@gated-at.bofh.it> |
| In reply to | #1331125 |
On Wed, Feb 10, 2016 at 01:40:03PM +0100, Jiri Olsa wrote:
> On Fri, Feb 05, 2016 at 10:01:47PM +0900, Namhyung Kim wrote:
> > The hierarchy output mode is to group entries so the existing columns
> > won't fit to the new output. Treat all sort keys as a single column and
> > separate headers by "/".
> >
> > # Overhead Command / Shared Object
> > # ........... ................................
> > #
> > 15.11% swapper
> > 14.97% [kernel.vmlinux]
> > 0.09% [libahci]
> > 0.05% [iwlwifi]
> > ...
> >
> > Acked-by: Pekka Enberg <penberg@kernel.org>
> > Signed-off-by: Namhyung Kim <namhyung@kernel.org>
> > ---
> > tools/perf/ui/stdio/hist.c | 107 +++++++++++++++++++++++++++++++++++++++++++++
> > 1 file changed, 107 insertions(+)
> >
> > diff --git a/tools/perf/ui/stdio/hist.c b/tools/perf/ui/stdio/hist.c
> > index b58f718a6afc..4bdab3cf1b6c 100644
> > --- a/tools/perf/ui/stdio/hist.c
> > +++ b/tools/perf/ui/stdio/hist.c
> > @@ -505,6 +505,108 @@ static int hist_entry__fprintf(struct hist_entry *he, size_t size,
> > return ret;
> > }
> >
> > +static int print_hierarchy_indent(const char *sep, int nr_sort,
> > + const char *line, FILE *fp)
> > +{
> > + if (sep != NULL || nr_sort < 1)
> > + return 0;
> > +
> > + return fprintf(fp, "%-.*s", (nr_sort - 1) * HIERARCHY_INDENT, line);
>
> hum, could you use fprintf(fp, "%*c", nr_sort..., '.');
>
> with the same effect to get rid of those dots and spaces strings..
Is it possible? I already tried but it failed with the dots..
$ cat dot.c
#include <stdio.h>
int main(void)
{
printf("%*c\n", 5, '.');
return 0;
}
$ gcc dot.c
$ ./a.out
.
$
Thanks,
Namhyung
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web