Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp4516165imj; Tue, 12 Feb 2019 18:18:18 -0800 (PST) X-Google-Smtp-Source: AHgI3IYSefXSJ/kijguCVvhki7S/zSe+Cn00FfIDab6lsgyl4n1Mi/4PyQ64xKPcei/T37JkXsda X-Received: by 2002:a65:6242:: with SMTP id q2mr6569473pgv.245.1550024298429; Tue, 12 Feb 2019 18:18:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550024298; cv=none; d=google.com; s=arc-20160816; b=BNkql2XHf0C3+4QxnofJ/oPQ/iD9ZX00T76YKVhYRmr8ZqCkCX3bkFMYfBcTrIfCxJ +1kZxRL4jk1xc86jPLyefVKaN5EvakqLsMu/DxKjGgF1nNtVXQTr1zhPHxTxx/WVRXeT m7SqhIFqkGT4Ii/hOy006S14jXLwHXe8Yr1fz8JgzFjtz/nFUGNWvG1LoHyBEozcssat 81O929zVlVOY5Zttv/eewrrFKUAzn5MwXUZoI1LnVfhWPIyiEtA0W9v92QO3N464ZBLC 2CGA6DKIDkaK6r1avAUTu4QK+LfkLFPOKnxy+mlH1LZqlaT7rGjInXKAYJWrddoIgix9 +PsQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date; bh=BEFx/TSRUhmUmfNAljLoGqx5utpQmpW3xnSkBEpJqdM=; b=DQE/av9/LQ1C54ejvBi5etdFukpIj3MwSu1e32WQHAifJBLl5SXTqzcS5lFElMxX5l Y3AxKybT9x10aOCNVp+Rn+dheo2ZNB1C5FaQz95HK6S58YOpwWSGlQbLoDe5b1r2tlz/ fUFDz7a3sqlJsYYL3mbcxnGo3jTrJxGdoDDA1/qIf32WCG7PIoNG0kFhAVhACX/xSeih pJx0ViHTACn4ZlkejmVz0VionoBz4SGOd7svD7Mr7IHQv/GE5JrapQAm+EtFkBWdjJkX mT1623ZVaYa88cc1My9uD+f+O/E8CkTCrRqeFdB/E5aMULWPFmQzN7YY7RtxVD0KmAQ0 kFsQ== 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 o8si491066pgn.469.2019.02.12.18.18.01; Tue, 12 Feb 2019 18:18:18 -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 S1731341AbfBLXOU (ORCPT + 99 others); Tue, 12 Feb 2019 18:14:20 -0500 Received: from mail.kernel.org ([198.145.29.99]:34362 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727804AbfBLXOT (ORCPT ); Tue, 12 Feb 2019 18:14:19 -0500 Received: from gandalf.local.home (cpe-66-24-58-225.stny.res.rr.com [66.24.58.225]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 1F5B920842; Tue, 12 Feb 2019 23:14:17 +0000 (UTC) Date: Tue, 12 Feb 2019 18:14:15 -0500 From: Steven Rostedt To: Lukasz Luba Cc: linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, b.zolnierkie@samsung.com, myungjoo.ham@samsung.com, cw00.choi@samsung.com, kyungmin.park@samsung.com, m.szyprowski@samsung.com, s.nawrocki@samsung.com, tkjos@google.com, joel@joelfernandes.org, chris.diamand@arm.com, mka@chromium.org, mingo@redhat.com Subject: Re: [PATCH v3 6/7] trace: events: add devfreq trace event file Message-ID: <20190212181415.1156e542@gandalf.local.home> In-Reply-To: <1550010238-24002-7-git-send-email-l.luba@partner.samsung.com> References: <1550010238-24002-1-git-send-email-l.luba@partner.samsung.com> <1550010238-24002-7-git-send-email-l.luba@partner.samsung.com> X-Mailer: Claws Mail 3.16.0 (GTK+ 2.24.32; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 12 Feb 2019 23:23:57 +0100 Lukasz Luba wrote: > The patch adds a new file for with trace events for devfreq > framework. They are used for performance analysis of the framework. > It also contains updates in MAINTAINERS file adding new entry for > devfreq maintainers. > > Signed-off-by: Lukasz Luba > --- > MAINTAINERS | 1 + > include/trace/events/devfreq.h | 39 +++++++++++++++++++++++++++++++++++++++ > 2 files changed, 40 insertions(+) > create mode 100644 include/trace/events/devfreq.h > > diff --git a/MAINTAINERS b/MAINTAINERS > index 9919840..c042fda 100644 > --- a/MAINTAINERS > +++ b/MAINTAINERS > @@ -4447,6 +4447,7 @@ S: Maintained > F: drivers/devfreq/ > F: include/linux/devfreq.h > F: Documentation/devicetree/bindings/devfreq/ > +F: include/trace/events/devfreq.h > > DEVICE FREQUENCY EVENT (DEVFREQ-EVENT) > M: Chanwoo Choi > diff --git a/include/trace/events/devfreq.h b/include/trace/events/devfreq.h > new file mode 100644 > index 0000000..fec9304 > --- /dev/null > +++ b/include/trace/events/devfreq.h > @@ -0,0 +1,39 @@ > +/* SPDX-License-Identifier: GPL-2.0 */ > +#undef TRACE_SYSTEM > +#define TRACE_SYSTEM devfreq > + > +#if !defined(_TRACE_DEVFREQ_H) || defined(TRACE_HEADER_MULTI_READ) > +#define _TRACE_DEVFREQ_H > + > +#include > +#include > + > +TRACE_EVENT(devfreq_monitor, > + TP_PROTO(const char *dev_name, unsigned long freq, > + unsigned int polling_ms, unsigned long busy_time, > + unsigned long total_time), > + > + TP_ARGS(dev_name, freq, polling_ms, busy_time, total_time), > + > + TP_STRUCT__entry( > + __string(dev_name, dev_name) > + __field(unsigned long, freq) > + __field(unsigned int, polling_ms) > + __field(unsigned int, load) > + ), > + > + TP_fast_assign( > + __assign_str(dev_name, dev_name); > + __entry->freq = freq; > + __entry->polling_ms = polling_ms; > + __entry->load = (100 * busy_time) / total_time; How critical is the code that this trace event is called in. If it is not that critical (it is a slow path), then this is fine, but if this is not a slow path (something triggered 100 HZ or less), then I would recommend moving the above calculation to TP_printk(). A divide is a slow operation, and is best to do that in the post processing. The current location does the divide at the time of the tracepoint is called. I would also have a check to make sure that total_time is not zero here, otherwise that could be bad. __entry->busy_time = busy_time; __entry->total_time = total_time; > + ), > + > + TP_printk("dev_name=%s freq=%lu polling_ms=%u load=%u", > + __get_str(dev_name), __entry->freq, __entry->polling_ms, __entry->total_time == 0 ? 100 : __entry->busy_time / __entry->total_time) -- Steve > + __entry->load) > +); > +#endif /* _TRACE_DEVFREQ_H */ > + > +/* This part must be outside protection */ > +#include