5eb12a84dbfd0c210c07cd11d937d7dc461b523f
[linux-3.10.git] / include / trace / events / nvhost_podgov.h
1 /*
2  * include/trace/events/nvhost_podgov.h
3  *
4  * Nvhost event logging to ftrace.
5  *
6  * Copyright (c) 2012, NVIDIA Corporation.
7  *
8  * This program is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation; either version 2 of the License, or
11  * (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful, but WITHOUT
14  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
15  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
16  * more details.
17  *
18  * You should have received a copy of the GNU General Public License along
19  * with this program; if not, write to the Free Software Foundation, Inc.,
20  * 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
21  */
22
23 #undef TRACE_SYSTEM
24 #define TRACE_SYSTEM nvhost_podgov
25
26 #if !defined(_TRACE_NVHOST_PODGOV_H) || defined(TRACE_HEADER_MULTI_READ)
27 #define _TRACE_NVHOST_PODGOV_H
28
29 #include <linux/ktime.h>
30 #include <linux/tracepoint.h>
31
32 DECLARE_EVENT_CLASS(podgov_update_freq,
33         TP_PROTO(unsigned long old_freq, unsigned long new_freq),
34
35         TP_ARGS(old_freq, new_freq),
36
37         TP_STRUCT__entry(
38                 __field(unsigned long, old_freq)
39                 __field(unsigned long, new_freq)
40         ),
41
42         TP_fast_assign(
43                 __entry->old_freq = old_freq;
44                 __entry->new_freq = new_freq;
45         ),
46
47         TP_printk("old_freq=%lu, new_freq=%lu",
48           __entry->old_freq, __entry->new_freq)
49 );
50
51 DEFINE_EVENT(podgov_update_freq, podgov_do_scale,
52         TP_PROTO(unsigned long old_freq, unsigned long new_freq),
53         TP_ARGS(old_freq, new_freq)
54 );
55
56 DEFINE_EVENT(podgov_update_freq, podgov_scaling_state_check,
57         TP_PROTO(unsigned long old_freq, unsigned long new_freq),
58         TP_ARGS(old_freq, new_freq)
59 );
60
61 DEFINE_EVENT(podgov_update_freq, podgov_estimate_freq,
62         TP_PROTO(unsigned long old_freq, unsigned long new_freq),
63         TP_ARGS(old_freq, new_freq)
64 );
65
66 DEFINE_EVENT(podgov_update_freq, podgov_clocks_handler,
67         TP_PROTO(unsigned long old_freq, unsigned long new_freq),
68         TP_ARGS(old_freq, new_freq)
69 );
70
71 TRACE_EVENT(podgov_enabled,
72         TP_PROTO(int enable),
73
74         TP_ARGS(enable),
75
76         TP_STRUCT__entry(
77                 __field(int, enable)
78         ),
79
80         TP_fast_assign(
81                 __entry->enable = enable;
82         ),
83
84         TP_printk("scaling_enabled=%d", __entry->enable)
85 );
86
87 TRACE_EVENT(podgov_busy,
88         TP_PROTO(unsigned long busyness),
89
90         TP_ARGS(busyness),
91
92         TP_STRUCT__entry(
93                 __field(unsigned long, busyness)
94         ),
95
96         TP_fast_assign(
97                 __entry->busyness = busyness;
98         ),
99
100         TP_printk("busyness=%lu", __entry->busyness)
101 );
102
103 TRACE_EVENT(podgov_hint,
104         TP_PROTO(long idle_estimate, int hint),
105
106         TP_ARGS(idle_estimate, hint),
107
108         TP_STRUCT__entry(
109                 __field(long, idle_estimate)
110                 __field(int, hint)
111         ),
112
113         TP_fast_assign(
114                 __entry->idle_estimate = idle_estimate;
115                 __entry->hint = hint;
116         ),
117
118         TP_printk("podgov: idle %ld, hint %d", __entry->idle_estimate,
119                 __entry->hint)
120 );
121
122 TRACE_EVENT(podgov_idle,
123         TP_PROTO(unsigned long idleness),
124
125         TP_ARGS(idleness),
126
127         TP_STRUCT__entry(
128                 __field(unsigned long, idleness)
129         ),
130
131         TP_fast_assign(
132                 __entry->idleness = idleness;
133         ),
134
135         TP_printk("idleness=%lu", __entry->idleness)
136 );
137
138 TRACE_EVENT(podgov_print_target,
139         TP_PROTO(long busy, int avg_busy, long curr, long target, int hint,
140                 int avg_hint),
141
142         TP_ARGS(busy, avg_busy, curr, target, hint, avg_hint),
143
144         TP_STRUCT__entry(
145                 __field(long, busy)
146                 __field(int, avg_busy)
147                 __field(long, curr)
148                 __field(long, target)
149                 __field(int, hint)
150                 __field(int, avg_hint)
151         ),
152
153         TP_fast_assign(
154                 __entry->busy = busy;
155                 __entry->avg_busy = avg_busy;
156                 __entry->curr = curr;
157                 __entry->target = target;
158                 __entry->hint = hint;
159                 __entry->avg_hint = avg_hint;
160         ),
161
162         TP_printk("podgov: busy %ld <%d>, curr %ld, t %ld, hint %d <%d>\n",
163                 __entry->busy, __entry->avg_busy, __entry->curr,
164                 __entry->target, __entry->hint, __entry->avg_hint)
165 );
166
167 TRACE_EVENT(podgov_stats,
168         TP_PROTO(int fast_up_count, int slow_down_count, unsigned int idle_min,
169                 unsigned int idle_max),
170
171         TP_ARGS(fast_up_count, slow_down_count, idle_min, idle_max),
172
173         TP_STRUCT__entry(
174                 __field(int, fast_up_count)
175                 __field(int, slow_down_count)
176                 __field(unsigned int, idle_min)
177                 __field(unsigned int, idle_max)
178         ),
179
180         TP_fast_assign(
181                 __entry->fast_up_count = fast_up_count;
182                 __entry->slow_down_count = slow_down_count;
183                 __entry->idle_min = idle_min;
184                 __entry->idle_max = idle_max;
185         ),
186
187         TP_printk("podgov stats: + %d - %d min %u max %u\n",
188                 __entry->fast_up_count, __entry->slow_down_count,
189                 __entry->idle_min, __entry->idle_max)
190 );
191
192 #endif /*  _TRACE_NVHOST_PODGOV_H */
193
194 /* This part must be outside protection */
195 #include <trace/define_trace.h>