From b790b1583e7aa661497b10e756731d083eed5eac Mon Sep 17 00:00:00 2001 From: Suril Date: Wed, 7 Jun 2017 14:31:08 -0700 Subject: tracing: Add event tracing mechanism Add traces for latency measurement to monitor performance. Add events for async_atrace. enable: echo 1 > /sys/kernel/debug/tracing/events/atrace/enable disable: echo 0 > /sys/kernel/debug/tracing/events/atrace/enable AV-388 Change-Id: Id88ab72d1aeab20afc7c0d48dc0fdb905404f5f6 Signed-off-by: Suril Dhruv Reviewed-on: http://git-master/r/1497930 Reviewed-on: http://git-master/r/1505062 Reviewed-on: https://git-master.nvidia.com/r/1511675 Reviewed-on: https://git-master.nvidia.com/r/1560227 Reviewed-by: Maneet Maneet Singh GVS: Gerrit_Virtual_Submit Reviewed-by: svccoveritychecker Reviewed-by: Sachin Nikam --- include/trace/events/atrace.h | 111 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 111 insertions(+) create mode 100644 include/trace/events/atrace.h (limited to 'include/trace') diff --git a/include/trace/events/atrace.h b/include/trace/events/atrace.h new file mode 100644 index 000000000..7fe8b30d9 --- /dev/null +++ b/include/trace/events/atrace.h @@ -0,0 +1,111 @@ +/* + * include/trace/events/atrace.h + * + * atrace specific events + * + * Copyright (c) 2017, NVIDIA CORPORATION. All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + */ + +#undef TRACE_SYSTEM +#define TRACE_SYSTEM atrace + +#if !defined(_TRACE_ATRACE_H) || defined(TRACE_HEADER_MULTI_READ) +#define _TRACE_ATRACE_H + +#include + +TRACE_EVENT(async_atrace_begin, + + TP_PROTO(const char *trace_str, int trace_id, int tracing_cookie), + + TP_ARGS(trace_str, trace_id, tracing_cookie), + + TP_STRUCT__entry( + __field(const char *, trace_str) + __field(int, trace_id) + __field(int, tracing_cookie) + ), + + TP_fast_assign( + __entry->trace_str = trace_str; + __entry->trace_id = trace_id; + __entry->tracing_cookie = tracing_cookie; + ), + + TP_printk("tracing_mark_write: S|%d|%s|%d\n", __entry->trace_id, + __entry->trace_str, __entry->tracing_cookie) +); + +TRACE_EVENT(async_atrace_end, + + TP_PROTO(const char *trace_str, int trace_id, int tracing_cookie), + + TP_ARGS(trace_str, trace_id, tracing_cookie), + + TP_STRUCT__entry( + __field(const char *, trace_str) + __field(int, trace_id) + __field(int, tracing_cookie) + ), + + TP_fast_assign( + __entry->trace_str = trace_str; + __entry->trace_id = trace_id; + __entry->tracing_cookie = tracing_cookie; + ), + + TP_printk("tracing_mark_write: F|%d|%s|%d\n", __entry->trace_id, + __entry->trace_str, __entry->tracing_cookie) +); + +TRACE_EVENT(atrace_start, + + TP_PROTO(const char *trace_str, int trace_id), + + TP_ARGS(trace_str, trace_id), + + TP_STRUCT__entry( + __field(const char *, trace_str) + __field(int, trace_id) + ), + + TP_fast_assign( + __entry->trace_str = trace_str; + __entry->trace_id = trace_id; + ), + + TP_printk("tracing_mark_write: B|%d|%s\n", __entry->trace_id, + __entry->trace_str) +); + +TRACE_EVENT(atrace_end, + + TP_PROTO(const char *trace_str), + + TP_ARGS(trace_str), + + TP_STRUCT__entry( + __field(const char *, trace_str) + ), + + TP_fast_assign( + __entry->trace_str = trace_str; + ), + + TP_printk("tracing_mark_write: E|%s\n", __entry->trace_str) +); +#endif + +/* This part must be outside protection */ +#include -- cgit v1.2.2