Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752110AbbH2CPX (ORCPT ); Fri, 28 Aug 2015 22:15:23 -0400 Received: from szxga01-in.huawei.com ([58.251.152.64]:49428 "EHLO szxga01-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751559AbbH2CPW (ORCPT ); Fri, 28 Aug 2015 22:15:22 -0400 Message-ID: <55E115A3.8030506@huawei.com> Date: Sat, 29 Aug 2015 10:14:59 +0800 From: xiakaixu User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:17.0) Gecko/20130801 Thunderbird/17.0.8 MIME-Version: 1.0 To: Alexei Starovoitov CC: , , , , , , , , , Subject: Re: [RFC PATCH 0/4] perf tools: Use the new ability of eBPF programs to access hardware PMU counter References: <1440672142-89311-1-git-send-email-xiakaixu@huawei.com> <55E10AC1.1000706@plumgrid.com> In-Reply-To: <55E10AC1.1000706@plumgrid.com> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8bit X-Originating-IP: [10.111.101.23] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1956 Lines: 43 于 2015/8/29 9:28, Alexei Starovoitov 写道: > On 8/27/15 3:42 AM, Kaixu Xia wrote: >> An example is pasted at the bottom of this cover letter. In that example, >> we can get the cpu_cycles and exception taken in sys_write. >> >> $ cat /sys/kernel/debug/tracing/trace_pipe >> $ ./perf record --event perf-bpf.o ls >> ... >> cat-1653 [003] d..1 88174.613854: : ente: CPU-3 cyc:48746333 exc:84 >> cat-1653 [003] d..2 88174.613861: : exit: CPU-3 cyc:48756041 exc:84 > > nice. probably more complex example that computes the delta of the pmu > counters on the kernel side would be even more interesting. Right, this is just a little example. Actually, I have tested this ability on kernel side and user space side, that is kprobe and uprobe. The collected delta of the pmu counters form kernel and glibc is correct and meets the expected goals. I will give them in the next version. At this time i wish to get your comment on the current chosen implementation. Now the struct perf_event_map_def is introduced and the user can directly define the struct perf_event_attr, so we can skip the parse_events process and call the sys_perf_event_open on the events directly. This is the most simple implementation, but I am not sure it is the most appropriate. > Do you think you can extend 'perf stat' with a flag that does > stats collection for a given kernel or user function instead of the > whole process ? > Then we can use perf record/report to figure out hot functions and > follow with 'perf stat -f my_hot_func my_process' to drill into > particular function stats. Good idea! I will consider it when this patchset is basically completed. > > > . > -- 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/