Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753526AbbGWBQM (ORCPT ); Wed, 22 Jul 2015 21:16:12 -0400 Received: from mail-pd0-f171.google.com ([209.85.192.171]:33974 "EHLO mail-pd0-f171.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752589AbbGWBQL (ORCPT ); Wed, 22 Jul 2015 21:16:11 -0400 Subject: Re: [PATCH v2 5/5] samples/bpf: example of get selected PMU counter value To: Kaixu Xia , davem@davemloft.net, acme@kernel.org, mingo@redhat.com, a.p.zijlstra@chello.nl, masami.hiramatsu.pt@hitachi.com, jolsa@kernel.org References: <1437552572-84748-1-git-send-email-xiakaixu@huawei.com> <1437552572-84748-6-git-send-email-xiakaixu@huawei.com> Cc: wangnan0@huawei.com, linux-kernel@vger.kernel.org, pi3orama@163.com, hekuang@huawei.com From: Alexei Starovoitov Message-ID: <55B04058.4090006@plumgrid.com> Date: Wed, 22 Jul 2015 18:16:08 -0700 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:38.0) Gecko/20100101 Thunderbird/38.0.1 MIME-Version: 1.0 In-Reply-To: <1437552572-84748-6-git-send-email-xiakaixu@huawei.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 726 Lines: 24 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@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/