3 * Copyright (C) 2016 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com)
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public Licence
8 * as published by the Free Software Foundation; either version
9 * 2 of the Licence, or (at your option) any later version.
12 #define TRACE_SYSTEM afs
14 #if !defined(_TRACE_AFS_H) || defined(TRACE_HEADER_MULTI_READ)
17 #include <linux/tracepoint.h>
20 * Define enums for tracing information.
22 #ifndef __AFS_DECLARE_TRACE_ENUMS_ONCE_ONLY
23 #define __AFS_DECLARE_TRACE_ENUMS_ONCE_ONLY
33 #endif /* end __AFS_DECLARE_TRACE_ENUMS_ONCE_ONLY */
36 * Declare tracing information enums and their string mappings for display.
38 #define afs_call_traces \
39 EM(afs_call_trace_alloc, "ALLOC") \
40 EM(afs_call_trace_free, "FREE ") \
41 EM(afs_call_trace_put, "PUT ") \
42 EM(afs_call_trace_wake, "WAKE ") \
43 E_(afs_call_trace_work, "WORK ")
46 * Export enum symbols via userspace.
50 #define EM(a, b) TRACE_DEFINE_ENUM(a);
51 #define E_(a, b) TRACE_DEFINE_ENUM(a);
56 * Now redefine the EM() and E_() macros to map the enums to the strings that
57 * will be printed in the output.
61 #define EM(a, b) { a, b },
62 #define E_(a, b) { a, b }
64 TRACE_EVENT(afs_recv_data
,
65 TP_PROTO(struct afs_call
*call
, unsigned count
, unsigned offset
,
66 bool want_more
, int ret
),
68 TP_ARGS(call
, count
, offset
, want_more
, ret
),
71 __field(struct rxrpc_call
*, rxcall
)
72 __field(struct afs_call
*, call
)
73 __field(enum afs_call_state
, state
)
74 __field(unsigned int, count
)
75 __field(unsigned int, offset
)
76 __field(unsigned short, unmarshall
)
77 __field(bool, want_more
)
82 __entry
->rxcall
= call
->rxcall
;
84 __entry
->state
= call
->state
;
85 __entry
->unmarshall
= call
->unmarshall
;
86 __entry
->count
= count
;
87 __entry
->offset
= offset
;
88 __entry
->want_more
= want_more
;
92 TP_printk("c=%p ac=%p s=%u u=%u %u/%u wm=%u ret=%d",
95 __entry
->state
, __entry
->unmarshall
,
96 __entry
->offset
, __entry
->count
,
97 __entry
->want_more
, __entry
->ret
)
100 TRACE_EVENT(afs_notify_call
,
101 TP_PROTO(struct rxrpc_call
*rxcall
, struct afs_call
*call
),
103 TP_ARGS(rxcall
, call
),
106 __field(struct rxrpc_call
*, rxcall
)
107 __field(struct afs_call
*, call
)
108 __field(enum afs_call_state
, state
)
109 __field(unsigned short, unmarshall
)
113 __entry
->rxcall
= rxcall
;
114 __entry
->call
= call
;
115 __entry
->state
= call
->state
;
116 __entry
->unmarshall
= call
->unmarshall
;
119 TP_printk("c=%p ac=%p s=%u u=%u",
122 __entry
->state
, __entry
->unmarshall
)
125 TRACE_EVENT(afs_cb_call
,
126 TP_PROTO(struct afs_call
*call
),
131 __field(struct rxrpc_call
*, rxcall
)
132 __field(struct afs_call
*, call
)
133 __field(const char *, name
)
138 __entry
->rxcall
= call
->rxcall
;
139 __entry
->call
= call
;
140 __entry
->name
= call
->type
->name
;
141 __entry
->op
= call
->operation_ID
;
144 TP_printk("c=%p ac=%p %s o=%u",
151 TRACE_EVENT(afs_call
,
152 TP_PROTO(struct afs_call
*call
, enum afs_call_trace op
,
153 int usage
, int outstanding
, const void *where
),
155 TP_ARGS(call
, op
, usage
, outstanding
, where
),
158 __field(struct afs_call
*, call
)
161 __field(int, outstanding
)
162 __field(const void *, where
)
166 __entry
->call
= call
;
168 __entry
->usage
= usage
;
169 __entry
->outstanding
= outstanding
;
170 __entry
->where
= where
;
173 TP_printk("c=%p %s u=%d o=%d sp=%pSR",
175 __print_symbolic(__entry
->op
, afs_call_traces
),
177 __entry
->outstanding
,
181 #endif /* _TRACE_AFS_H */
183 /* This part must be outside protection */
184 #include <trace/define_trace.h>