Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753382AbbKZJ5U (ORCPT ); Thu, 26 Nov 2015 04:57:20 -0500 Received: from mail-wm0-f42.google.com ([74.125.82.42]:36887 "EHLO mail-wm0-f42.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753166AbbKZJ5N (ORCPT ); Thu, 26 Nov 2015 04:57:13 -0500 Date: Thu, 26 Nov 2015 10:57:09 +0100 From: Ingo Molnar To: "Wangnan (F)" Cc: Peter Zijlstra , Yunlong Song , paulus@samba.org, mingo@redhat.com, acme@kernel.org, linux-kernel@vger.kernel.org, namhyung@kernel.org, ast@kernel.org, masami.hiramatsu.pt@hitachi.com, kan.liang@intel.com, adrian.hunter@intel.com, jolsa@kernel.org, dsahern@gmail.com, bp@alien8.de, jean.pihet@linaro.org, rric@kernel.org, xiakaixu@huawei.com, hekuang@huawei.com Subject: Re: [PATCH] perf record: Add snapshot mode support for perf's regular events Message-ID: <20151126095709.GA7723@gmail.com> References: <1448373632-8806-1-git-send-email-yunlong.song@huawei.com> <20151125092728.GZ17308@twins.programming.kicks-ass.net> <565582E0.7070202@huawei.com> <20151125122038.GA17308@twins.programming.kicks-ass.net> <5655AF89.8070907@huawei.com> <20151126091910.GA6380@gmail.com> <20151126092738.GA6793@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20151126092738.GA6793@gmail.com> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2652 Lines: 49 * Ingo Molnar wrote: > So if an overwrite-mode background tracing session is running, you don't even have > to signal it to capture the ring-buffer: just open the ring-buffer fd in procfs, > under /proc/XYZ/perf/ring-buffers/5.trace or so, and dump its current contents, > assuming the task doing that has sufficient permissions - i.e. > ptrace_may_access(). > > We could even pretty-print some very basic version of the records from the kernel, > via /proc/XYZ/perf/ring-buffers/5.txt, to support a tooling-less tracing modes. > This way perf based tracing could be supported even on systems that have no > writable filesystems. With this 'cat' could be used to look at the current trace: cat /proc/XYZ/perf/ring-buffers/5.txt would result in 'perf script' alike output generated by the kernel: $ cat /proc/XYZ/perf/ring-buffers/5.txt perf 24816 63796.780079: 1 cycles:pp: ffffffff810603f8 native_write_msr_safe perf 24816 63796.780083: 1 cycles:pp: ffffffff810603f8 native_write_msr_safe perf 24816 63796.780086: 8 cycles:pp: ffffffff810603f8 native_write_msr_safe perf 24816 63796.780089: 97 cycles:pp: ffffffff810603f8 native_write_msr_safe perf 24816 63796.780092: 1237 cycles:pp: ffffffff8103450c intel_pmu_handle_irq perf 24816 63796.780094: 13879 cycles:pp: ffffffff81204f23 setup_new_exec sh 24816 63796.780104: 170378 cycles:pp: ffffffff811bc437 change_protection_range sh 24816 63796.780145: 698206 cycles:pp: ffffffff813d22d7 clear_page_c_e sh 24816 63796.780304: 1145748 cycles:pp: 7f60aca20bdb _dl_addr sh 24817 63796.780400: 1 cycles:pp: ffffffff810603f8 native_write_msr_safe sh 24817 63796.780403: 1 cycles:pp: ffffffff810603f8 native_write_msr_safe sh 24817 63796.780406: 10 cycles:pp: ffffffff810603f8 native_write_msr_safe sh 24817 63796.780409: 118 cycles:pp: ffffffff810603f8 native_write_msr_safe ... and you could use shell scripting to analyze it - just like with ftrace. of course this would be simplified output - and you could still access or copy the raw trace data as well, and use all the rich tooling and visualization features of full perf. Thanks, Ingo -- 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/