[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <55B04058.4090006@plumgrid.com>
Date: Wed, 22 Jul 2015 18:16:08 -0700
From: Alexei Starovoitov <ast@...mgrid.com>
To: Kaixu Xia <xiakaixu@...wei.com>, davem@...emloft.net,
acme@...nel.org, mingo@...hat.com, a.p.zijlstra@...llo.nl,
masami.hiramatsu.pt@...achi.com, jolsa@...nel.org
Cc: wangnan0@...wei.com, linux-kernel@...r.kernel.org,
pi3orama@....com, hekuang@...wei.com
Subject: Re: [PATCH v2 5/5] samples/bpf: example of get selected PMU counter
value
On 7/22/15 1:09 AM, Kaixu Xia wrote:
> +SEC("kprobe/sys_write")
> +int bpf_prog1(struct pt_regs *ctx)
> +{
> + u64 count;
> + u32 key = bpf_get_smp_processor_id();
> + char fmt[] = "bpf count: CPU-%d %llu\n";
> +
> + count = bpf_perf_event_read(&my_map, &key);
> + bpf_trace_printk(fmt, sizeof(fmt), key, count);
> +
> + return 0;
> +}
overall the whole thing looks much better, but since you can print
anything, print some sensible string here instead of 'bpf count'.
Thanks!
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists