@@ -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
new file mode 100644
@@ -0,0 +1,22 @@
+#include <linux/trace_events.h>
+#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);
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 <zhang.chunyan@linaro.org> --- 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