1 /* 2 * Copyright (C) 2012-2014, 2016-2017 ARM Limited. All rights reserved. 3 * 4 * This program is free software and is provided to you under the terms of the GNU General Public License version 2 5 * as published by the Free Software Foundation, and any use by you of this program is subject to the terms of such GNU licence. 6 * 7 * A copy of the licence is included with the program, and can also be obtained from Free Software 8 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 9 */ 10 11 #if !defined (MALI_LINUX_TRACE_H) || defined (TRACE_HEADER_MULTI_READ) 12 #define MALI_LINUX_TRACE_H 13 14 #include <linux/types.h> 15 16 #include <linux/stringify.h> 17 #include <linux/tracepoint.h> 18 19 #undef TRACE_SYSTEM 20 #define TRACE_SYSTEM mali 21 22 #define TRACE_INCLUDE_PATH . 23 #define TRACE_INCLUDE_FILE mali_linux_trace 24 25 /** 26 * Define the tracepoint used to communicate the status of a GPU. Called 27 * when a GPU turns on or turns off. 28 * 29 * @param event_id The type of the event. This parameter is a bitfield 30 * encoding the type of the event. 31 * 32 * @param d0 First data parameter. 33 * @param d1 Second data parameter. 34 * @param d2 Third data parameter. 35 * @param d3 Fourth data parameter. 36 * @param d4 Fifth data parameter. 37 */ 38 TRACE_EVENT(mali_timeline_event, 39 40 TP_PROTO(unsigned int event_id, unsigned int d0, unsigned int d1, 41 unsigned int d2, unsigned int d3, unsigned int d4), 42 43 TP_ARGS(event_id, d0, d1, d2, d3, d4), 44 45 TP_STRUCT__entry( 46 __field(unsigned int, event_id) 47 __field(unsigned int, d0) 48 __field(unsigned int, d1) 49 __field(unsigned int, d2) 50 __field(unsigned int, d3) 51 __field(unsigned int, d4) 52 ), 53 54 TP_fast_assign( 55 __entry->event_id = event_id; 56 __entry->d0 = d0; 57 __entry->d1 = d1; 58 __entry->d2 = d2; 59 __entry->d3 = d3; 60 __entry->d4 = d4; 61 ), 62 63 TP_printk("event=%d", __entry->event_id) 64 ); 65 66 /** 67 * Define a tracepoint used to regsiter the value of a hardware counter. 68 * Hardware counters belonging to the vertex or fragment processor are 69 * reported via this tracepoint each frame, whilst L2 cache hardware 70 * counters are reported continuously. 71 * 72 * @param counter_id The counter ID. 73 * @param value The value of the counter. 74 */ 75 TRACE_EVENT(mali_hw_counter, 76 77 TP_PROTO(unsigned int counter_id, unsigned int value), 78 79 TP_ARGS(counter_id, value), 80 81 TP_STRUCT__entry( 82 __field(unsigned int, counter_id) 83 __field(unsigned int, value) 84 ), 85 86 TP_fast_assign( 87 __entry->counter_id = counter_id; 88 ), 89 90 TP_printk("event %d = %d", __entry->counter_id, __entry->value) 91 ); 92 93 /** 94 * Define a tracepoint used to send a bundle of software counters. 95 * 96 * @param counters The bundle of counters. 97 */ 98 TRACE_EVENT(mali_sw_counters, 99 100 TP_PROTO(pid_t pid, pid_t tid, void *surface_id, unsigned int *counters), 101 102 TP_ARGS(pid, tid, surface_id, counters), 103 104 TP_STRUCT__entry( 105 __field(pid_t, pid) 106 __field(pid_t, tid) 107 __field(void *, surface_id) 108 __field(unsigned int *, counters) 109 ), 110 111 TP_fast_assign( 112 __entry->pid = pid; 113 __entry->tid = tid; 114 __entry->surface_id = surface_id; 115 __entry->counters = counters; 116 ), 117 118 TP_printk("counters were %s", __entry->counters == NULL ? "NULL" : "not NULL") 119 ); 120 121 /** 122 * Define a tracepoint used to gather core activity for systrace 123 * @param pid The process id for which the core activity originates from 124 * @param active If the core is active (1) or not (0) 125 * @param core_type The type of core active, either GP (1) or PP (0) 126 * @param core_id The core id that is active for the core_type 127 * @param frame_builder_id The frame builder id associated with this core activity 128 * @param flush_id The flush id associated with this core activity 129 */ 130 TRACE_EVENT(mali_core_active, 131 132 TP_PROTO(pid_t pid, unsigned int active, unsigned int core_type, unsigned int core_id, unsigned int frame_builder_id, unsigned int flush_id), 133 134 TP_ARGS(pid, active, core_type, core_id, frame_builder_id, flush_id), 135 136 TP_STRUCT__entry( 137 __field(pid_t, pid) 138 __field(unsigned int, active) 139 __field(unsigned int, core_type) 140 __field(unsigned int, core_id) 141 __field(unsigned int, frame_builder_id) 142 __field(unsigned int, flush_id) 143 ), 144 145 TP_fast_assign( 146 __entry->pid = pid; 147 __entry->active = active; 148 __entry->core_type = core_type; 149 __entry->core_id = core_id; 150 __entry->frame_builder_id = frame_builder_id; 151 __entry->flush_id = flush_id; 152 ), 153 154 TP_printk("%s|%d|%s%i:%x|%d", __entry->active ? "S" : "F", __entry->pid, __entry->core_type ? "GP" : "PP", __entry->core_id, __entry->flush_id, __entry->frame_builder_id) 155 ); 156 157 #endif /* MALI_LINUX_TRACE_H */ 158 159 /* This part must exist outside the header guard. */ 160 #include <trace/define_trace.h> 161 162