On Thu, Mar 03, 2016 at 01:12:02AM +0900, Namhyung Kim wrote:
> The perf_hpp__setup_hists_formats() is to build hists-specific output
> formats (and sort keys).  Currently it's only used in order to build the
> output format in a hierarchy with same sort keys, but it could be used
> with different sort keys in non-hierarchy mode later.
> 
> Signed-off-by: Namhyung Kim <namhy...@kernel.org>
> ---
>  tools/perf/ui/hist.c   | 66 
> ++++++++++++++++++++++++++++++++++++++++++++++++++
>  tools/perf/util/hist.c | 12 +++++++++
>  tools/perf/util/hist.h | 10 ++++++++
>  tools/perf/util/sort.c | 29 ++++++++++++++++++++++
>  4 files changed, 117 insertions(+)
> 
> diff --git a/tools/perf/ui/hist.c b/tools/perf/ui/hist.c
> index 7c0585c146e1..ded564936701 100644
> --- a/tools/perf/ui/hist.c
> +++ b/tools/perf/ui/hist.c
> @@ -5,6 +5,7 @@
>  #include "../util/util.h"
>  #include "../util/sort.h"
>  #include "../util/evsel.h"
> +#include "../util/evlist.h"
>  
>  /* hist period print (hpp) functions */
>  
> @@ -715,3 +716,68 @@ void perf_hpp__set_user_width(const char *width_list_str)
>                       break;
>       }
>  }
> +
> +static int add_hierarchy_fmt(struct hists *hists, struct perf_hpp_fmt *fmt)
> +{
> +     struct perf_hpp_list_node *node = NULL;
> +     struct perf_hpp_fmt *fmt_copy;
> +     bool found = false;
> +
> +     list_for_each_entry(node, &hists->hpp_formats, list) {
> +             struct perf_hpp_fmt *pos;
> +
> +             pos = list_first_entry(&node->hpp.fields, struct perf_hpp_fmt, 
> list);

the struct perf_hpp_list_node could hold 'level' as well,
so you wouldn't need to query first fmt

jirka

Reply via email to