1 /* Copyright (c) 2014-2017, The Linux Foundation. All rights reserved. 2 * 3 * This program is free software; you can redistribute it and/or modify 4 * it under the terms of the GNU General Public License version 2 and 5 * only version 2 as published by the Free Software Foundation. 6 * 7 * This program is distributed in the hope that it will be useful, 8 * but WITHOUT ANY WARRANTY; without even the implied warranty of 9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 * GNU General Public License for more details. 11 */ 12 13 #if !defined(_DISP_TRACE_H_) || defined(TRACE_HEADER_MULTI_READ) 14 #define _DISP_TRACE_H_ 15 16 #include <linux/stringify.h> 17 #include <linux/types.h> 18 #include <linux/tracepoint.h> 19 20 #undef TRACE_SYSTEM 21 #define TRACE_SYSTEM disp_trace 22 23 TRACE_EVENT(tracing_mark_write, 24 TP_PROTO(int pid, const char *name, bool trace_begin), 25 TP_ARGS(pid, name, trace_begin), 26 TP_STRUCT__entry( 27 __field(int, pid) 28 __string(trace_name, name) 29 __field(bool, trace_begin) 30 ), 31 TP_fast_assign( 32 __entry->pid = pid; 33 __assign_str(trace_name, name); 34 __entry->trace_begin = trace_begin; 35 ), 36 37 TP_printk("%s|%d|%s", __entry->trace_begin ? "B" : "E", 38 __entry->pid, __get_str(trace_name)) 39 ); 40 41 TRACE_EVENT(display_trace_counter, 42 TP_PROTO(int pid, char *name, int value), 43 TP_ARGS(pid, name, value), 44 TP_STRUCT__entry( 45 __field(int, pid) 46 __string(counter_name, name) 47 __field(int, value) 48 ), 49 TP_fast_assign( 50 __entry->pid = pid; 51 __assign_str(counter_name, name); 52 __entry->value = value; 53 ), 54 TP_printk("C|%d|%s|%d", 55 __entry->pid, 56 __get_str(counter_name), __entry->value) 57 ); 58 59 TRACE_EVENT(display_trace_counter2, 60 TP_PROTO(int pid, char *name, int id, int value), 61 TP_ARGS(pid, name, id, value), 62 TP_STRUCT__entry( 63 __field(int, pid) 64 __string(counter_name, name) 65 __field(int, id) 66 __field(int, value) 67 ), 68 TP_fast_assign( 69 __entry->pid = pid; 70 __assign_str(counter_name, name); 71 __entry->id = id; 72 __entry->value = value; 73 ), 74 TP_printk("C|%d|%s-%d|%d", 75 __entry->pid, 76 __get_str(counter_name), __entry->id, __entry->value) 77 ); 78 79 #define DISP_TRACE_END(name) trace_tracing_mark_write(current->tgid, name, 0) 80 #define DISP_TRACE_BEGIN(name) trace_tracing_mark_write(current->tgid, name, 1) 81 #define DISP_TRACE_FUNC() DISP_TRACE_BEGIN(__func__) 82 83 #define DISP_TRACE_INT(name, value) \ 84 trace_display_trace_counter(current->tgid, name, value) 85 86 /* 87 * Using the api in the interrupt context ensures 88 * that the systrace information is bound to the same process. 89 */ 90 #define __fake_pid__ (0x0624) 91 #define DISP_TRACE_INT_F(name, value) \ 92 trace_display_trace_counter(__fake_pid__, name, value) 93 94 #define DISP_TRACE_INT2(name, id, value) \ 95 trace_display_trace_counter2(__fake_pid__, name, id, value) 96 97 #endif /* _DISP_TRACE_H_ */ 98 99 /* 100 * This part must be outside protection 101 */ 102 #undef TRACE_INCLUDE_PATH 103 #define TRACE_INCLUDE_PATH . 104 #include <trace/define_trace.h> 105 106