From patchwork Wed Jul 22 03:46:02 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chunyan Zhang X-Patchwork-Id: 51329 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-lb0-f198.google.com (mail-lb0-f198.google.com [209.85.217.198]) by patches.linaro.org (Postfix) with ESMTPS id AB6DF20323 for ; Wed, 22 Jul 2015 03:48:19 +0000 (UTC) Received: by lbcjf8 with SMTP id jf8sf52817843lbc.0 for ; Tue, 21 Jul 2015 20:48:18 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:sender:precedence:list-id :x-original-sender:x-original-authentication-results:mailing-list :list-post:list-help:list-archive:list-unsubscribe; bh=CSlljH51r9wGKCxzejd/DjL3Y+3KZBntutwja0PnA0w=; b=CvYoAYmDL59Zul4mlDPj/ka3iuz0VvbZN6DRMM0sbAGfm+FL89h4Nzx7p9Da+fGW85 pg3SpVg2zgLMlH194+XoNHZj3n7sQ1dFwkBvJjd8z6Q1X2G5qU3IRKpfDFAhWydiMB5s 091LyE1CUeLXUdV9+vvhLkSInGFaNJme/FGHMtxUZTtJXD6Zqhdc2j3iUByv4GYbTU8k mNX2Cnbyi0wV4JTA1ueXvMAp4A19Bzs0xJLzCCTH/JVpJczL9unQIDOHXD2v5fq78BdB q3awHOfhHy/o0dw4a0GgZ3P8Jr5t5VaJTXB9kwLxpMxfmfiss/5lpWen2qgWedbhZMpC mf4g== X-Gm-Message-State: ALoCoQmRkA0Wls6baiAXP8trSKiBU1aA8bxyuoghxnWXaAfpjjnsI8/veAy7gWI9cR4DFMemHCz+ X-Received: by 10.112.160.39 with SMTP id xh7mr194436lbb.22.1437536898615; Tue, 21 Jul 2015 20:48:18 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.204.9 with SMTP id ku9ls23160lac.37.gmail; Tue, 21 Jul 2015 20:48:18 -0700 (PDT) X-Received: by 10.112.168.102 with SMTP id zv6mr296104lbb.45.1437536898418; Tue, 21 Jul 2015 20:48:18 -0700 (PDT) Received: from mail-lb0-f182.google.com (mail-lb0-f182.google.com. [209.85.217.182]) by mx.google.com with ESMTPS id jc6si114450lac.71.2015.07.21.20.48.18 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 21 Jul 2015 20:48:18 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.182 as permitted sender) client-ip=209.85.217.182; Received: by lbbzr7 with SMTP id zr7so128364115lbb.1 for ; Tue, 21 Jul 2015 20:48:18 -0700 (PDT) X-Received: by 10.152.18.162 with SMTP id x2mr284457lad.73.1437536898000; Tue, 21 Jul 2015 20:48:18 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.7.198 with SMTP id l6csp1825561lba; Tue, 21 Jul 2015 20:48:16 -0700 (PDT) X-Received: by 10.66.118.237 with SMTP id kp13mr973831pab.9.1437536896003; Tue, 21 Jul 2015 20:48:16 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v11si302534pas.231.2015.07.21.20.48.14; Tue, 21 Jul 2015 20:48:15 -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; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932974AbbGVDr6 (ORCPT + 28 others); Tue, 21 Jul 2015 23:47:58 -0400 Received: from mail-pd0-f174.google.com ([209.85.192.174]:36297 "EHLO mail-pd0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932848AbbGVDrz (ORCPT ); Tue, 21 Jul 2015 23:47:55 -0400 Received: by pdjr16 with SMTP id r16so133645163pdj.3 for ; Tue, 21 Jul 2015 20:47:55 -0700 (PDT) X-Received: by 10.66.157.167 with SMTP id wn7mr862133pab.119.1437536875121; Tue, 21 Jul 2015 20:47:55 -0700 (PDT) Received: from zcy-ubuntu.spreadtrum.com ([175.111.195.49]) by smtp.gmail.com with ESMTPSA id bg7sm223459pdb.29.2015.07.21.20.47.51 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 21 Jul 2015 20:47:54 -0700 (PDT) From: Chunyan Zhang To: rostedt@goodmis.org, mingo@kernel.org Cc: mathieu.poirier@linaro.org, serge.broslavsky@linaro.org, broonie@kernel.org, alexander.shishkin@linux.intel.com, linux-kernel@vger.kernel.org Subject: [PATCH v4 2/3] trace: Introduce trace log output function for STM Date: Wed, 22 Jul 2015 11:46:02 +0800 Message-Id: <1437536763-10827-3-git-send-email-zhang.chunyan@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1437536763-10827-1-git-send-email-zhang.chunyan@linaro.org> References: <1437536763-10827-1-git-send-email-zhang.chunyan@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: zhang.chunyan@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.182 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , This patch introduced a new function to print the trace events logs to STM buffer when the trace event happens. Signed-off-by: Chunyan Zhang --- kernel/trace/Makefile | 1 + kernel/trace/trace_output_stm.c | 22 ++++++++++++++++++++++ 2 files changed, 23 insertions(+) create mode 100644 kernel/trace/trace_output_stm.c diff --git a/kernel/trace/Makefile b/kernel/trace/Makefile index 9b1044e..ac6c195 100644 --- a/kernel/trace/Makefile +++ b/kernel/trace/Makefile @@ -67,4 +67,5 @@ obj-$(CONFIG_UPROBE_EVENT) += trace_uprobe.o obj-$(CONFIG_TRACEPOINT_BENCHMARK) += trace_benchmark.o +obj-$(CONFIG_TRACE_EVENT_STM) += trace_output_stm.o libftrace-y := ftrace.o diff --git a/kernel/trace/trace_output_stm.c b/kernel/trace/trace_output_stm.c new file mode 100644 index 0000000..42d5549 --- /dev/null +++ b/kernel/trace/trace_output_stm.c @@ -0,0 +1,22 @@ +#include +#include "trace_output.h" + +void trace_event_stm_log(struct trace_event_buffer *buffer) +{ + /* use static because iter can be a bit big for the stack */ + static struct trace_iterator iter; + struct trace_entry *entry = (struct trace_entry *)buffer->entry; + struct trace_event *event = NULL; + + iter.ent = entry; + + if (entry) + event = ftrace_find_event(entry->type); + + if (event && event->funcs) { + event->funcs->trace(&iter, 0, event); + stm_trace_event_write(iter.seq.buffer, iter.seq.seq.len); + iter.seq.seq.len = 0; + } +} +EXPORT_SYMBOL_GPL(trace_event_stm_log);