From patchwork Tue Oct 27 12:12:13 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chunyan Zhang X-Patchwork-Id: 55601 Delivered-To: patch@linaro.org Received: by 10.112.59.35 with SMTP id w3csp1756872lbq; Tue, 27 Oct 2015 05:17:12 -0700 (PDT) X-Received: by 10.202.73.146 with SMTP id w140mr26430738oia.94.1445948232273; Tue, 27 Oct 2015 05:17:12 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id oe3si24041864oeb.88.2015.10.27.05.17.11; Tue, 27 Oct 2015 05:17:12 -0700 (PDT) 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; dkim=neutral (body hash did not verify) header.i=@linaro_org.20150623.gappssmtp.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932222AbbJ0MRI (ORCPT + 28 others); Tue, 27 Oct 2015 08:17:08 -0400 Received: from mail-pa0-f52.google.com ([209.85.220.52]:35324 "EHLO mail-pa0-f52.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932130AbbJ0MRG (ORCPT ); Tue, 27 Oct 2015 08:17:06 -0400 Received: by pasz6 with SMTP id z6so221273207pas.2 for ; Tue, 27 Oct 2015 05:17:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro_org.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id; bh=P1NQ7XT094DNbqN+AXu1oAXo9GLay5d8NKSBdiIQk2k=; b=CqK9kFmaCtxW+yJtkABw/ahlSSxoEbE0oStQNwwG/kY/d2i9IvCtdTpoIVpqAx5bVN vtSQNWr3SkVaPZiLXXDOnqJfEh9dQ9gH485QNQi/5bqC/MybeakdUhihL63H+9OzuXZU dU5AvwZkvucCLgpG/+lSqdWNI1GmYLU7ViTx55XQqekFFBJQMzlXQgEcr5mrHLUpY3vc s+lBghWMVC20UqUYfRFXhjb+E9vsiL/6MGZ2lBhItW0iRnIEVKoMfvaQ4UeLP0Aj+BNV uvCeagR49Yy2rCKhBna+15n/DQ+WIJfOu/IIb0PiRwogt9hEWPR7lb3ryngOgpZ7jdNX OKGw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=P1NQ7XT094DNbqN+AXu1oAXo9GLay5d8NKSBdiIQk2k=; b=X0mqwGgE7AZRrgRfzCyWwMHMR9QE/kyna2/k5BAHrOhJ1ulfo5mn6IMrGDubSlkIlS yf0MtUcjDum/8uWlvP2kcvK6BJXjtAHx9EinMC6YjSm8ihVTWYsOwV2nmHStwj3hPgBb tSa1xYYK9W4eX1aH3x2+cOXkU/D2JOXD60N7z2FoFFnqiotsHFs3+BlLwzAONTAhLaO0 FpB/lhkuwE75e+jUbYbLqEOYK5BBaDjh1MItF3Jm1CiVeKWsGHzrugCh0g7D5EjI3NW0 +e1PU50TnfS1h+wZUxZGBEtdLVeQ/6MSZY53D7SGybyVo54xDLIfnPfJRGerwHT2Z2Ol F+EA== X-Gm-Message-State: ALoCoQlwK/mZ3Kl1I13zS9pg7oFgr2R2qDXuh9FzDQkP6z356tZ1H4RsPwkdQWYTURN5vOOOKxZT X-Received: by 10.66.228.199 with SMTP id sk7mr28157162pac.8.1445948225781; Tue, 27 Oct 2015 05:17:05 -0700 (PDT) Received: from zcy-ubuntu.spreadtrum.com ([175.111.195.49]) by smtp.gmail.com with ESMTPSA id b6sm39426519pbu.90.2015.10.27.05.17.02 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 27 Oct 2015 05:17:04 -0700 (PDT) From: Chunyan Zhang To: rostedt@goodmis.org, mingo@redhat.com Cc: linux-kernel@vger.kernel.org Subject: [PATCH] tracing: Only benchmark the time tracepoints take if tracing is on Date: Tue, 27 Oct 2015 20:12:13 +0800 Message-Id: <1445947933-27955-1-git-send-email-zhang.chunyan@linaro.org> X-Mailer: git-send-email 1.9.1 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org There's no need to record the time tracepoints take when tracing is off. This is because: 1) We cannot see these records since ring_buffer record is off at that moment. 2) If tracing is off and benchmark tracepoint is enabled, the time tracepoint takes is fewer than the same situation when tracing is on, since the tracepoints need to be wrote into ring_buffer, it would take more time. If turn on tracing at this moment, the average and standard deviation cannot exactly present the time that tracepoints take to write data into ring_buffer. Signed-off-by: Chunyan Zhang --- kernel/trace/trace_benchmark.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/ diff --git a/kernel/trace/trace_benchmark.c b/kernel/trace/trace_benchmark.c index 40a14cb..0f109c4 100644 --- a/kernel/trace/trace_benchmark.c +++ b/kernel/trace/trace_benchmark.c @@ -43,7 +43,7 @@ static void trace_do_benchmark(void) unsigned int std = 0; /* Only run if the tracepoint is actually active */ - if (!trace_benchmark_event_enabled()) + if (!trace_benchmark_event_enabled() || !tracing_is_on()) return; local_irq_disable();