rjw | 1f88458 | 2022-01-06 17:20:42 +0800 | [diff] [blame^] | 1 | /* AFS tracepoints |
| 2 | * |
| 3 | * Copyright (C) 2016 Red Hat, Inc. All Rights Reserved. |
| 4 | * Written by David Howells (dhowells@redhat.com) |
| 5 | * |
| 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. |
| 10 | */ |
| 11 | #undef TRACE_SYSTEM |
| 12 | #define TRACE_SYSTEM afs |
| 13 | |
| 14 | #if !defined(_TRACE_AFS_H) || defined(TRACE_HEADER_MULTI_READ) |
| 15 | #define _TRACE_AFS_H |
| 16 | |
| 17 | #include <linux/tracepoint.h> |
| 18 | |
| 19 | /* |
| 20 | * Define enums for tracing information. |
| 21 | */ |
| 22 | #ifndef __AFS_DECLARE_TRACE_ENUMS_ONCE_ONLY |
| 23 | #define __AFS_DECLARE_TRACE_ENUMS_ONCE_ONLY |
| 24 | |
| 25 | enum afs_call_trace { |
| 26 | afs_call_trace_alloc, |
| 27 | afs_call_trace_free, |
| 28 | afs_call_trace_put, |
| 29 | afs_call_trace_wake, |
| 30 | afs_call_trace_work, |
| 31 | }; |
| 32 | |
| 33 | #endif /* end __AFS_DECLARE_TRACE_ENUMS_ONCE_ONLY */ |
| 34 | |
| 35 | /* |
| 36 | * Declare tracing information enums and their string mappings for display. |
| 37 | */ |
| 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, "QUEUE") |
| 44 | |
| 45 | /* |
| 46 | * Export enum symbols via userspace. |
| 47 | */ |
| 48 | #undef EM |
| 49 | #undef E_ |
| 50 | #define EM(a, b) TRACE_DEFINE_ENUM(a); |
| 51 | #define E_(a, b) TRACE_DEFINE_ENUM(a); |
| 52 | |
| 53 | afs_call_traces; |
| 54 | |
| 55 | /* |
| 56 | * Now redefine the EM() and E_() macros to map the enums to the strings that |
| 57 | * will be printed in the output. |
| 58 | */ |
| 59 | #undef EM |
| 60 | #undef E_ |
| 61 | #define EM(a, b) { a, b }, |
| 62 | #define E_(a, b) { a, b } |
| 63 | |
| 64 | TRACE_EVENT(afs_recv_data, |
| 65 | TP_PROTO(struct afs_call *call, unsigned count, unsigned offset, |
| 66 | bool want_more, int ret), |
| 67 | |
| 68 | TP_ARGS(call, count, offset, want_more, ret), |
| 69 | |
| 70 | TP_STRUCT__entry( |
| 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 ) |
| 78 | __field(int, ret ) |
| 79 | ), |
| 80 | |
| 81 | TP_fast_assign( |
| 82 | __entry->rxcall = call->rxcall; |
| 83 | __entry->call = call; |
| 84 | __entry->state = call->state; |
| 85 | __entry->unmarshall = call->unmarshall; |
| 86 | __entry->count = count; |
| 87 | __entry->offset = offset; |
| 88 | __entry->want_more = want_more; |
| 89 | __entry->ret = ret; |
| 90 | ), |
| 91 | |
| 92 | TP_printk("c=%p ac=%p s=%u u=%u %u/%u wm=%u ret=%d", |
| 93 | __entry->rxcall, |
| 94 | __entry->call, |
| 95 | __entry->state, __entry->unmarshall, |
| 96 | __entry->offset, __entry->count, |
| 97 | __entry->want_more, __entry->ret) |
| 98 | ); |
| 99 | |
| 100 | TRACE_EVENT(afs_notify_call, |
| 101 | TP_PROTO(struct rxrpc_call *rxcall, struct afs_call *call), |
| 102 | |
| 103 | TP_ARGS(rxcall, call), |
| 104 | |
| 105 | TP_STRUCT__entry( |
| 106 | __field(struct rxrpc_call *, rxcall ) |
| 107 | __field(struct afs_call *, call ) |
| 108 | __field(enum afs_call_state, state ) |
| 109 | __field(unsigned short, unmarshall ) |
| 110 | ), |
| 111 | |
| 112 | TP_fast_assign( |
| 113 | __entry->rxcall = rxcall; |
| 114 | __entry->call = call; |
| 115 | __entry->state = call->state; |
| 116 | __entry->unmarshall = call->unmarshall; |
| 117 | ), |
| 118 | |
| 119 | TP_printk("c=%p ac=%p s=%u u=%u", |
| 120 | __entry->rxcall, |
| 121 | __entry->call, |
| 122 | __entry->state, __entry->unmarshall) |
| 123 | ); |
| 124 | |
| 125 | TRACE_EVENT(afs_cb_call, |
| 126 | TP_PROTO(struct afs_call *call), |
| 127 | |
| 128 | TP_ARGS(call), |
| 129 | |
| 130 | TP_STRUCT__entry( |
| 131 | __field(struct rxrpc_call *, rxcall ) |
| 132 | __field(struct afs_call *, call ) |
| 133 | __field(const char *, name ) |
| 134 | __field(u32, op ) |
| 135 | ), |
| 136 | |
| 137 | TP_fast_assign( |
| 138 | __entry->rxcall = call->rxcall; |
| 139 | __entry->call = call; |
| 140 | __entry->name = call->type->name; |
| 141 | __entry->op = call->operation_ID; |
| 142 | ), |
| 143 | |
| 144 | TP_printk("c=%p ac=%p %s o=%u", |
| 145 | __entry->rxcall, |
| 146 | __entry->call, |
| 147 | __entry->name, |
| 148 | __entry->op) |
| 149 | ); |
| 150 | |
| 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), |
| 154 | |
| 155 | TP_ARGS(call, op, usage, outstanding, where), |
| 156 | |
| 157 | TP_STRUCT__entry( |
| 158 | __field(struct afs_call *, call ) |
| 159 | __field(int, op ) |
| 160 | __field(int, usage ) |
| 161 | __field(int, outstanding ) |
| 162 | __field(const void *, where ) |
| 163 | ), |
| 164 | |
| 165 | TP_fast_assign( |
| 166 | __entry->call = call; |
| 167 | __entry->op = op; |
| 168 | __entry->usage = usage; |
| 169 | __entry->outstanding = outstanding; |
| 170 | __entry->where = where; |
| 171 | ), |
| 172 | |
| 173 | TP_printk("c=%p %s u=%d o=%d sp=%pSR", |
| 174 | __entry->call, |
| 175 | __print_symbolic(__entry->op, afs_call_traces), |
| 176 | __entry->usage, |
| 177 | __entry->outstanding, |
| 178 | __entry->where) |
| 179 | ); |
| 180 | |
| 181 | #endif /* _TRACE_AFS_H */ |
| 182 | |
| 183 | /* This part must be outside protection */ |
| 184 | #include <trace/define_trace.h> |