diff options
author | Steven Rostedt <rostedt@goodmis.org> | 2014-06-17 08:59:16 -0400 |
---|---|---|
committer | Steven Rostedt <rostedt@goodmis.org> | 2014-06-21 00:18:42 -0400 |
commit | 4d4c9cc839a308be3289a361ccba4447ee140552 (patch) | |
tree | 404a0a22a3700c16ef3437b69fefe46c06cf5f91 /samples/trace_events | |
parent | ea73c79e33c45e1fa0071e216f06fd5682314490 (diff) |
tracing: Add __field_struct macro for TRACE_EVENT()
Currently the __field() macro in TRACE_EVENT is only good for primitive
values, such as integers and pointers, but it fails on complex data types
such as structures or unions. This is because the __field() macro
determines if the variable is signed or not with the test of:
(((type)(-1)) < (type)1)
Unfortunately, that fails when type is a structure.
Since trace events should support structures as fields a new macro
is created for such a case called __field_struct() which acts exactly
the same as __field() does but it does not do the signed type check
and just uses a constant false for that answer.
Cc: Tony Luck <tony.luck@gmail.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Diffstat (limited to 'samples/trace_events')
-rw-r--r-- | samples/trace_events/trace-events-sample.h | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/samples/trace_events/trace-events-sample.h b/samples/trace_events/trace-events-sample.h index 6af373236d73..4b0113f73ee9 100644 --- a/samples/trace_events/trace-events-sample.h +++ b/samples/trace_events/trace-events-sample.h | |||
@@ -56,7 +56,8 @@ | |||
56 | * struct: This defines the way the data will be stored in the ring buffer. | 56 | * struct: This defines the way the data will be stored in the ring buffer. |
57 | * There are currently two types of elements. __field and __array. | 57 | * There are currently two types of elements. __field and __array. |
58 | * a __field is broken up into (type, name). Where type can be any | 58 | * a __field is broken up into (type, name). Where type can be any |
59 | * type but an array. | 59 | * primitive type (integer, long or pointer). __field_struct() can |
60 | * be any static complex data value (struct, union, but not an array). | ||
60 | * For an array. there are three fields. (type, name, size). The | 61 | * For an array. there are three fields. (type, name, size). The |
61 | * type of elements in the array, the name of the field and the size | 62 | * type of elements in the array, the name of the field and the size |
62 | * of the array. | 63 | * of the array. |