Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753022AbcLBVUx (ORCPT ); Fri, 2 Dec 2016 16:20:53 -0500 Received: from mga05.intel.com ([192.55.52.43]:20536 "EHLO mga05.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752475AbcLBVUo (ORCPT ); Fri, 2 Dec 2016 16:20:44 -0500 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.33,288,1477983600"; d="scan'208";a="1093847553" From: kan.liang@intel.com To: peterz@infradead.org, mingo@redhat.com, acme@kernel.org, linux-kernel@vger.kernel.org Cc: alexander.shishkin@linux.intel.com, tglx@linutronix.de, namhyung@kernel.org, jolsa@kernel.org, adrian.hunter@intel.com, wangnan0@huawei.com, mark.rutland@arm.com, andi@firstfloor.org, Kan Liang Subject: [PATCH V2 11/13] perf tools: introduce PERF_RECORD_USER_OVERHEAD Date: Fri, 2 Dec 2016 16:19:19 -0500 Message-Id: <1480713561-6617-12-git-send-email-kan.liang@intel.com> X-Mailer: git-send-email 2.5.5 In-Reply-To: <1480713561-6617-1-git-send-email-kan.liang@intel.com> References: <1480713561-6617-1-git-send-email-kan.liang@intel.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2334 Lines: 70 From: Kan Liang It is used to track user space perf tool profiling time cost. Signed-off-by: Kan Liang --- tools/perf/util/event.c | 1 + tools/perf/util/event.h | 5 +++++ tools/perf/util/session.c | 4 ++++ 3 files changed, 10 insertions(+) diff --git a/tools/perf/util/event.c b/tools/perf/util/event.c index e8736dc..764893c 100644 --- a/tools/perf/util/event.c +++ b/tools/perf/util/event.c @@ -48,6 +48,7 @@ static const char *perf_event__names[] = { [PERF_RECORD_STAT_ROUND] = "STAT_ROUND", [PERF_RECORD_EVENT_UPDATE] = "EVENT_UPDATE", [PERF_RECORD_TIME_CONV] = "TIME_CONV", + [PERF_RECORD_USER_OVERHEAD] = "USER_OVERHEAD", }; const char *perf_event__name(unsigned int id) diff --git a/tools/perf/util/event.h b/tools/perf/util/event.h index a6c98ce..6110f32 100644 --- a/tools/perf/util/event.h +++ b/tools/perf/util/event.h @@ -237,6 +237,7 @@ enum perf_user_event_type { /* above any possible kernel type */ PERF_RECORD_STAT_ROUND = 77, PERF_RECORD_EVENT_UPDATE = 78, PERF_RECORD_TIME_CONV = 79, + PERF_RECORD_USER_OVERHEAD = 80, PERF_RECORD_HEADER_MAX }; @@ -490,6 +491,10 @@ struct time_conv_event { u64 time_zero; }; +enum perf_user_overhead_event_type { /* above any possible kernel type */ + PERF_USER_OVERHEAD_TYPE_START = 100, +}; + struct perf_overhead { struct perf_event_header header; u64 type; diff --git a/tools/perf/util/session.c b/tools/perf/util/session.c index 1dc32e3..7745bec 100644 --- a/tools/perf/util/session.c +++ b/tools/perf/util/session.c @@ -804,6 +804,7 @@ static perf_event__swap_op perf_event__swap_ops[] = { [PERF_RECORD_STAT_ROUND] = perf_event__stat_round_swap, [PERF_RECORD_EVENT_UPDATE] = perf_event__event_update_swap, [PERF_RECORD_TIME_CONV] = perf_event__all64_swap, + [PERF_RECORD_USER_OVERHEAD] = perf_event__all64_swap, [PERF_RECORD_HEADER_MAX] = NULL, }; @@ -1387,6 +1388,9 @@ static s64 perf_session__process_user_event(struct perf_session *session, case PERF_RECORD_TIME_CONV: session->time_conv = event->time_conv; return tool->time_conv(tool, event, session); + case PERF_RECORD_USER_OVERHEAD: + overhead_stats_update(tool, session->evlist, event, -1); + return tool->overhead(tool, event, NULL, NULL); default: return -EINVAL; } -- 2.5.5