summaryrefslogtreecommitdiffstats
path: root/samples/trace_events/trace-events-sample.h
Commit message (Collapse)AuthorAgeFilesLines
* tracing/samples: Update the trace-event-sample.h with TRACE_DEFINE_ENUM()Steven Rostedt (Red Hat)2015-04-081-1/+63
| | | | | | | | | | | | | | | Document the use of TRACE_DEFINE_ENUM() by adding enums to the trace-event-sample.h and using this macro to convert them in the format files. Also update the comments and sho the use of __print_symbolic() and __print_flags() as well as adding comments abount __print_array(). Link: http://lkml.kernel.org/r/20150403013802.220157513@goodmis.org Reviewed-by: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com> Tested-by: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com> Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
* tracing: Update trace-event-sample with TRACE_SYSTEM_VAR documentationSteven Rostedt (Red Hat)2015-04-081-1/+19
| | | | | | | | | | | | | | Add documentation about TRACE_SYSTEM needing to be alpha-numeric or with underscores, and that if it is not, then the use of TRACE_SYSTEM_VAR is required to make something that is. An example of this is shown in samples/trace_events/trace-events-sample.h Link: http://lkml.kernel.org/r/20150403013802.220157513@goodmis.org Reviewed-by: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com> Tested-by: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com> Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
* tracing: Add samples of DECLARE_EVENT_CLASS() and DEFINE_EVENT()Steven Rostedt (Red Hat)2015-02-101-0/+81
| | | | | | | | Add to samples/trace_events/ the macros DECLARE_EVENT_CLASS() and DEFINE_EVENT() and recommend using them over multiple TRACE_EVENT() macros if the multiple events have the same format. Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
* tracing: Add TRACE_EVENT_FN exampleSteven Rostedt (Red Hat)2015-02-101-0/+44
| | | | | | | | | If a function should be called before a tracepoint is enabled and/or after it is disabled, the TRACE_EVENT_FN() serves this purpose. But it is not well documented. Having it as a sample would help developers to know how to use it. Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
* tracing: Add TRACE_EVENT_CONDITION sampleSteven Rostedt (Red Hat)2015-02-091-0/+58
| | | | | | | | The sample code lacks an example of TRACE_EVENT_CONDITION, and it has been expressed to me that this feature for TRACE_EVENT is not well known and not used when it could be. Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
* tracing: Update the TRACE_EVENT fields available in the sample codeSteven Rostedt (Red Hat)2015-02-091-13/+132
| | | | | | | | | The sample code in samples/trace_events/ is extremely out of date and does not show all the new fields that have been added since the sample code was written. As most people are unaware of these new fields, adding sample code and explanations of those fields should help out. Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
* tracing: Change trace event sample to use strlcpy instead of strncpyZhao Hongjiang2014-07-011-1/+1
| | | | | | | | | | | | | | Strings should be copied with strlcpy instead of strncpy when they will later be printed via %s. This guarantees that they terminate with a NUL '\0' character and do not run pass the end of the allocated string. This is only for sample code, but it should stil represent a good role model. Link: http://lkml.kernel.org/p/51C2E204.1080501@huawei.com Signed-off-by: Zhao Hongjiang <zhaohongjiang@huawei.com> Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
* tracing: Add __field_struct macro for TRACE_EVENT()Steven Rostedt2014-06-211-1/+2
| | | | | | | | | | | | | | | | | | | 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>
* debugfs: Change debuhgfs directory of trace-events-sample.hGeunSik Lim2009-09-151-1/+1
| | | | | | | | Default directory of debug filesystem for ftrace is /sys/kernel/debug/. Signed-off-by: GeunSik Lim <geunsik.lim@samsung.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* tracing/events: Move TRACE_SYSTEM outside of include guardLi Zefan2009-07-131-17/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | If TRACE_INCLDUE_FILE is defined, <trace/events/TRACE_INCLUDE_FILE.h> will be included and compiled, otherwise it will be <trace/events/TRACE_SYSTEM.h> So TRACE_SYSTEM should be defined outside of #if proctection, just like TRACE_INCLUDE_FILE. Imaging this scenario: #include <trace/events/foo.h> -> TRACE_SYSTEM == foo ... #include <trace/events/bar.h> -> TRACE_SYSTEM == bar ... #define CREATE_TRACE_POINTS #include <trace/events/foo.h> -> TRACE_SYSTEM == bar !!! and then bar.h will be included and compiled. Signed-off-by: Li Zefan <lizf@cn.fujitsu.com> Cc: Steven Rostedt <rostedt@goodmis.org> Cc: Frederic Weisbecker <fweisbec@gmail.com> LKML-Reference: <4A5A9CF1.2010007@cn.fujitsu.com> Signed-off-by: Ingo Molnar <mingo@elte.hu>
* tracing: update sample event documentationSteven Rostedt2009-06-171-11/+16
| | | | | | | The comments in the sample code is a bit confusing. This patch cleans them up a little. Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
* tracing: update sample with TRACE_INCLUDE_FILESteven Rostedt2009-05-071-1/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When creating trace events for ftrace, the header file with the TRACE_EVENT macros must also have a macro called TRACE_SYSTEM. This macro describes the name of the system the TRACE_EVENTS are defined for. It also doubles as a way for the define_trace.h file to include the file that included it. For example: in irq.h #define TRACE_SYSTEM irq [...] #include <trace/define_trace.h> The define_trace will use TRACE_SYSTEM to include irq.h. But if the name of the trace system does not match the name of the trace header file, one can override it with: Which will change define_trace.h to inclued foo_trace.h instead of foo.h The sample comments this, but people that use the sample code will more likely use the code and not read the comments. This patch changes the sample code to use the TRACE_INCLUDE_FILE to better show developers how to use it. [ Impact: make sample less confusing to developers ] Reported-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
* tracing/events: add trace-events-sampleSteven Rostedt2009-04-151-0/+124
This patch adds a sample to the samples directory on how to create and use TRACE_EVENT trace points. Signed-off-by: Steven Rostedt <rostedt@goodmis.org>