Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932967AbbGVDr6 (ORCPT ); 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 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 List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1774 Lines: 56 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); -- 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/