[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200304203825.GC168640@krava>
Date: Wed, 4 Mar 2020 21:38:25 +0100
From: Jiri Olsa <jolsa@...hat.com>
To: Song Liu <songliubraving@...com>
Cc: netdev@...r.kernel.org, bpf@...r.kernel.org, quentin@...valent.com,
kernel-team@...com, ast@...nel.org, daniel@...earbox.net,
arnaldo.melo@...il.com, jolsa@...nel.org
Subject: Re: [PATCH v4 bpf-next 1/4] bpftool: introduce "prog profile" command
On Wed, Mar 04, 2020 at 10:07:07AM -0800, Song Liu wrote:
SNIP
> +
> +#include "profiler.skel.h"
> +
> +#define SAMPLE_PERIOD 0x7fffffffffffffffULL
> +struct profile_metric {
> + const char *name;
> + struct bpf_perf_event_value val;
> + struct perf_event_attr attr;
> + bool selected;
> +
> + /* calculate ratios like instructions per cycle */
> + const int ratio_metric; /* 0 for N/A, 1 for index 0 (cycles) */
> + const char *ratio_desc;
> + const float ratio_mul;
> +} metrics[] = {
> + {
> + .name = "cycles",
> + .attr = {
> + .sample_period = SAMPLE_PERIOD,
I don't think you need to set sample_period for counting.. why?
> + .type = PERF_TYPE_HARDWARE,
> + .config = PERF_COUNT_HW_CPU_CYCLES,
you could also add .exclude_user = 1
jirka
Powered by blists - more mailing lists