From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751719AbcEMH6F (ORCPT ); Fri, 13 May 2016 03:58:05 -0400 Received: from szxga02-in.huawei.com ([119.145.14.65]:29806 "EHLO szxga02-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751280AbcEMH6E (ORCPT ); Fri, 13 May 2016 03:58:04 -0400 From: Wang Nan To: CC: , , Wang Nan , Arnaldo Carvalho de Melo , He Kuang , Jiri Olsa , Masami Hiramatsu , Namhyung Kim , "Peter Zijlstra" , Zefan Li , Subject: [PATCH 00/17] perf tools: Support overwritable ring buffer Date: Fri, 13 May 2016 07:55:57 +0000 Message-ID: <1463126174-119290-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.0A020204.573588B0.0038,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: 08494db9e3396488b5dd81e448773d6a Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This patch set enables daemonized perf recording by utilizing overwritable backward ring buffer. With this feature one can put perf background, and dump ring buffer records by a SIGUSR2 when he/she find something unusual. For example, following command record system calls, schedule events and samples on cpu cycles continously: # perf record -g -e cycles -e raw_syscalls:*/call-graph=no/ \ -e sched:sched_switch/call-graph=no/ \ --switch-output --overwrite -a Then by sending SIGUSR2 to perf when lagging is happen, we get multiple perf.data output, each of them correspond a abnormal event, and the data size is reasonable: # ls -l ./perf.data* -rw------- 1 root root 5122165 May 13 23:51 ./perf.data.2016051323511683 -rw------- 1 root root 5135093 May 13 23:51 ./perf.data.2016051323512107 -rw------- 1 root root 5135213 May 13 23:51 ./perf.data.2016051323512215 -rw------- 1 root root 5135157 May 13 23:51 ./perf.data.2016051323512387 Wang Nan (17): perf tools: Extract __perf_evlist__mmap_read() perf tools: Add evlist channel helpers perf tools: Automatically add new channel according to evlist perf tools: Operate multiple channels perf record: Prevent reading invalid data in record__mmap_read perf tools: Squash overwrite setting into channel perf record: Don't read from and poll overwrite channel perf record: Don't poll on overwrite channel perf tools: Detect avalibility of write_backward perf tools: Enable overwrite settings perf tools: Set write_backward attribut bit for overwrite events perf tools: Record fd into perf_mmap perf tools: Add API to pause a channel perf record: Rename variable to make code clear perf record: Read from backward ring buffer perf record: Toggle overwrite ring buffer for reading perf tools: Don't warn about out of order event if write_backward is used tools/perf/builtin-record.c | 207 +++++++++++++++++++++++-- tools/perf/perf.h | 2 + tools/perf/util/evlist.c | 332 ++++++++++++++++++++++++++++++++++++----- tools/perf/util/evlist.h | 67 ++++++++- tools/perf/util/evsel.c | 17 +++ tools/perf/util/evsel.h | 3 + tools/perf/util/parse-events.c | 20 ++- tools/perf/util/parse-events.h | 2 + tools/perf/util/parse-events.l | 2 + tools/perf/util/record.c | 11 ++ tools/perf/util/session.c | 22 ++- 11 files changed, 625 insertions(+), 60 deletions(-) Cc: Arnaldo Carvalho de Melo Cc: He Kuang Cc: Jiri Olsa Cc: Masami Hiramatsu Cc: Namhyung Kim Cc: Peter Zijlstra Cc: Wang Nan Cc: Zefan Li Cc: pi3orama@163.com -- 1.8.3.4