Received: by 10.223.164.202 with SMTP id h10csp688659wrb; Thu, 9 Nov 2017 12:44:41 -0800 (PST) X-Google-Smtp-Source: ABhQp+R0OyitL9u4SCDZibWleQ2fnRArRNX0QaYGpWgGMTMqWUGlC3CFkIj11aJdG/wwVOJFsgyY X-Received: by 10.99.112.69 with SMTP id a5mr1638035pgn.179.1510260281801; Thu, 09 Nov 2017 12:44:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1510260281; cv=none; d=google.com; s=arc-20160816; b=qcNxQ20/PwMoSBqe7Cya5GXACcW0F+BV+SiwhPbFM3W83tpkKZCDFVDV71Mhl/lRMw h7Y+xdTbvzRyAKcJRkKNHD3PTuKSt2Hc88myQmhGKFC0mBdZVVbMmOl51/dfnVybqYh4 sv6IsLynSuUHHLcSS4xoDDfEFwCiJLxVCvIx01eEZ5U5G/2tR1nFAa39XEPGlOqbZAxD rs4dSPmv5YBhdb6zm/bB24Hw2EZ9AJmy8EMhSNkjETuGnkclPPdstqoXYiQMp8QmCAsN VsNEzuL7w47o47wyQXbSA++pep1GtandIxD2rjM8BHFdMlyNNurGvRTFeJNgAqUytqPz eggg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=U0TrfUhoKo6F2XIU2siZF8jrsA7scqBLLFGU+6WeeVM=; b=az1QvP3vMFgBD7RjOG0gqXJYRQBXb6cfPnO7589zOEohZd1texYNCNhvx4sjbIfUWC yXR7Nq4aEvl1bNJH8msUSVTqfskTWpDX2sRpK2yskznY2o118HaEiscCOPEVNkLPbp9j t4sr4I+bS0n/k844nOYCgYsk7/ZTC5nCEhRGfFydf29a8DkIxXpnKnox2Jwv7lSDBR2U Kwgv3HwtrvQvWG1fZxZ42UsQJqPoIiVTxnFqKV0fZWZDfk/robWIDHVNWfxNh3lWIneN FkREDnEfIDid519PmAvN5mQrRgrz5ppx/Itp0il93GgydeomkvbQpiddKGqsYzs7/1A/ +oqA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v26si3870265pgc.309.2017.11.09.12.44.29; Thu, 09 Nov 2017 12:44:41 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755102AbdKIUmy (ORCPT + 83 others); Thu, 9 Nov 2017 15:42:54 -0500 Received: from mga02.intel.com ([134.134.136.20]:19579 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754399AbdKIUep (ORCPT ); Thu, 9 Nov 2017 15:34:45 -0500 Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 09 Nov 2017 12:34:44 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.44,370,1505804400"; d="scan'208";a="3165361" Received: from dkusalov-mobl4.amr.corp.intel.com (HELO localhost) ([10.254.117.34]) by orsmga001.jf.intel.com with ESMTP; 09 Nov 2017 12:34:43 -0800 From: Tom Zanussi To: rostedt@goodmis.org Cc: tglx@linutronix.de, mhiramat@kernel.org, namhyung@kernel.org, vedang.patel@intel.com, bigeasy@linutronix.de, joel.opensrc@gmail.com, joelaf@google.com, mathieu.desnoyers@efficios.com, baohong.liu@intel.com, rajvi.jingar@intel.com, julia@ni.com, linux-kernel@vger.kernel.org, linux-rt-users@vger.kernel.org, Tom Zanussi Subject: [PATCH v5 09/37] tracing: Add ring buffer event param to hist field functions Date: Thu, 9 Nov 2017 14:33:40 -0600 Message-Id: <85d3153cd000f6583012b2cf2e00dd76b805e8db.1510252666.git.tom.zanussi@linux.intel.com> X-Mailer: git-send-email 1.9.3 In-Reply-To: References: In-Reply-To: References: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Some events such as timestamps require access to a ring_buffer_event struct; add a param so that hist field functions can access that. Signed-off-by: Tom Zanussi --- kernel/trace/trace_events_hist.c | 39 ++++++++++++++++++++++++--------------- 1 file changed, 24 insertions(+), 15 deletions(-) diff --git a/kernel/trace/trace_events_hist.c b/kernel/trace/trace_events_hist.c index 63a1912..37f5ace 100644 --- a/kernel/trace/trace_events_hist.c +++ b/kernel/trace/trace_events_hist.c @@ -26,7 +26,8 @@ struct hist_field; -typedef u64 (*hist_field_fn_t) (struct hist_field *field, void *event); +typedef u64 (*hist_field_fn_t) (struct hist_field *field, void *event, + struct ring_buffer_event *rbe); #define HIST_FIELD_OPERANDS_MAX 2 @@ -40,24 +41,28 @@ struct hist_field { struct hist_field *operands[HIST_FIELD_OPERANDS_MAX]; }; -static u64 hist_field_none(struct hist_field *field, void *event) +static u64 hist_field_none(struct hist_field *field, void *event, + struct ring_buffer_event *rbe) { return 0; } -static u64 hist_field_counter(struct hist_field *field, void *event) +static u64 hist_field_counter(struct hist_field *field, void *event, + struct ring_buffer_event *rbe) { return 1; } -static u64 hist_field_string(struct hist_field *hist_field, void *event) +static u64 hist_field_string(struct hist_field *hist_field, void *event, + struct ring_buffer_event *rbe) { char *addr = (char *)(event + hist_field->field->offset); return (u64)(unsigned long)addr; } -static u64 hist_field_dynstring(struct hist_field *hist_field, void *event) +static u64 hist_field_dynstring(struct hist_field *hist_field, void *event, + struct ring_buffer_event *rbe) { u32 str_item = *(u32 *)(event + hist_field->field->offset); int str_loc = str_item & 0xffff; @@ -66,24 +71,28 @@ static u64 hist_field_dynstring(struct hist_field *hist_field, void *event) return (u64)(unsigned long)addr; } -static u64 hist_field_pstring(struct hist_field *hist_field, void *event) +static u64 hist_field_pstring(struct hist_field *hist_field, void *event, + struct ring_buffer_event *rbe) { char **addr = (char **)(event + hist_field->field->offset); return (u64)(unsigned long)*addr; } -static u64 hist_field_log2(struct hist_field *hist_field, void *event) +static u64 hist_field_log2(struct hist_field *hist_field, void *event, + struct ring_buffer_event *rbe) { struct hist_field *operand = hist_field->operands[0]; - u64 val = operand->fn(operand, event); + u64 val = operand->fn(operand, event, rbe); return (u64) ilog2(roundup_pow_of_two(val)); } #define DEFINE_HIST_FIELD_FN(type) \ -static u64 hist_field_##type(struct hist_field *hist_field, void *event)\ + static u64 hist_field_##type(struct hist_field *hist_field, \ + void *event, \ + struct ring_buffer_event *rbe) \ { \ type *addr = (type *)(event + hist_field->field->offset); \ \ @@ -871,8 +880,8 @@ static bool need_tracing_map_ops(struct hist_trigger_data *hist_data) } static void hist_trigger_elt_update(struct hist_trigger_data *hist_data, - struct tracing_map_elt *elt, - void *rec) + struct tracing_map_elt *elt, void *rec, + struct ring_buffer_event *rbe) { struct hist_field *hist_field; unsigned int i; @@ -880,7 +889,7 @@ static void hist_trigger_elt_update(struct hist_trigger_data *hist_data, for_each_hist_val_field(i, hist_data) { hist_field = hist_data->fields[i]; - hist_val = hist_field->fn(hist_field, rec); + hist_val = hist_field->fn(hist_field, rec, rbe); tracing_map_update_sum(elt, i, hist_val); } } @@ -910,7 +919,7 @@ static inline void add_to_key(char *compound_key, void *key, } static void event_hist_trigger(struct event_trigger_data *data, void *rec, - struct ring_buffer_event *event) + struct ring_buffer_event *rbe) { struct hist_trigger_data *hist_data = data->private_data; bool use_compound_key = (hist_data->n_keys > 1); @@ -939,7 +948,7 @@ static void event_hist_trigger(struct event_trigger_data *data, void *rec, key = entries; } else { - field_contents = key_field->fn(key_field, rec); + field_contents = key_field->fn(key_field, rec, rbe); if (key_field->flags & HIST_FIELD_FL_STRING) { key = (void *)(unsigned long)field_contents; use_compound_key = true; @@ -956,7 +965,7 @@ static void event_hist_trigger(struct event_trigger_data *data, void *rec, elt = tracing_map_insert(hist_data->map, key); if (elt) - hist_trigger_elt_update(hist_data, elt, rec); + hist_trigger_elt_update(hist_data, elt, rec, rbe); } static void hist_trigger_stacktrace_print(struct seq_file *m, -- 1.9.3 From 1583483542298418472@xxx Wed Nov 08 07:53:04 +0000 2017 X-GM-THRID: 1583483542298418472 X-Gmail-Labels: Inbox,Category Forums,HistoricalUnread