Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932592AbcDNOWw (ORCPT ); Thu, 14 Apr 2016 10:22:52 -0400 Received: from szxga01-in.huawei.com ([58.251.152.64]:13876 "EHLO szxga01-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753693AbcDNOWp (ORCPT ); Thu, 14 Apr 2016 10:22:45 -0400 From: Wang Nan To: CC: , , Wang Nan , Arnaldo Carvalho de Melo , "Adrian Hunter" , Jiri Olsa , "Masami Hiramatsu" , Namhyung Kim , Zefan Li , He Kuang Subject: [PATCH v2 0/6] perf tools: Use SIGUSR2 control data dumpping Date: Thu, 14 Apr 2016 14:21:59 +0000 Message-ID: <1460643725-167413-1-git-send-email-wangnan0@huawei.com> X-Mailer: git-send-email 1.8.3.4 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.107.193.248] X-CFilter-Loop: Reflected X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A020203.570FA79D.0159,ss=1,re=0.000,recu=0.000,reip=0.000,cl=1,cld=1,fgs=0, ip=0.0.0.0, so=2013-06-18 04:22:30, dmn=2013-03-21 17:37:32 X-Mirapoint-Loop-Id: b12c8d2d63abdfd91fc33aa600e70bdf Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3163 Lines: 85 This patch set is based on perf/core. v1 -> v2: Fix a bug which triggers output switching without '--switch-output' provided. Patch 5/10 in v1 has a bug: with following cmdline: # perf record -e intel_bts// --per-thread --snapshot -p 13588 Sending 'SIGUSR2' to perf triggers output switching, which us undesirable. The reason is in signal handler perf doesn't consider if user provided --switch-output explicitly. With this patchset applied: # /perf record --switch-output -e intel_bts// --per-thread --snapshot -p 13588 & [1] 15116 # kill -s SIGUSR2 15116 # [ perf record: dump data: Woken up 5 times ] [ perf record: Dump perf.data.2016041506170000 ] # kill -s SIGUSR2 15116 # [ perf record: dump data: Woken up 3 times ] [ perf record: Dump perf.data.2016041506170447 ] # fg /perf record --switch-output -e intel_bts// --per-thread --snapshot -p 13588 ^C[ perf record: Woken up 3 times to write data ] [ perf record: Dump perf.data.2016041506170785 ] [ perf record: Captured and wrote 0.012 MB perf.data. ] # ls -l ./perf.data* -rw------- 1 root root 4212888 Apr 15 06:17 ./perf.data.2016041506170000 -rw------- 1 root root 4212704 Apr 15 06:17 ./perf.data.2016041506170447 -rw------- 1 root root 18368 Apr 15 06:17 ./perf.data.2016041506170785 The first 2 perf.data works fine. The final one has no samples. And: # rm ./perf.data* # /perf record -e intel_bts// --per-thread --snapshot -p 13588 & [1] 15396 # kill -s SIGUSR2 15396 # kill -s SIGUSR2 15396 # fg /perf record -e intel_bts// --per-thread --snapshot -p 13588 ^C[ perf record: Woken up 9 times to write data ] [ perf record: Captured and wrote 8.012 MB perf.data ] # ls -l ./perf.data* -rw------- 1 root root 8417552 Apr 15 06:20 ./perf.data (In v1, the second test trigger output switching incorrectly) Patch 1-2/6 in this patchset makes switch output trigger similar to auxtrace snapshot trigger. Patch 1/6 introduces a 'trigger' class for them. It would be better to merge patch 1/6 with commit c0bdc1c ("perf record: Turns auxtrace_snapshot_enable into 3 states"). However, Ingo has collected that commit, so make it a separated patch. Signed-off-by: Wang Nan Cc: Arnaldo Carvalho de Melo Cc: Adrian Hunter Cc: Jiri Olsa Cc: Masami Hiramatsu Cc: Namhyung Kim Cc: Zefan Li Cc: pi3orama@163.com Cc: He Kuang Wang Nan (6): perf tools: Extrace trigger class from auxtrace_snapshot perf record: Split output into multiple files via '--switch-output' perf record: Force enable --timestamp-filename when --switch-output is provided perf record: Disable buildid cache options by default in switch output mode perf record: Re-synthesize tracking events after output switching perf record: Generate tracking events for process forked by perf tools/perf/builtin-record.c | 147 +++++++++++++++++++++++++++++++------------- tools/perf/util/util.h | 60 ++++++++++++++++++ 2 files changed, 163 insertions(+), 44 deletions(-) -- 1.8.3.4