summaryrefslogtreecommitdiff
path: root/samples/trace_events
AgeCommit message (Collapse)AuthorFilesLines
2015-04-08tracing/samples: Update the trace-event-sample.h with TRACE_DEFINE_ENUM()Steven Rostedt (Red Hat)1-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>
2015-04-08tracing: Update trace-event-sample with TRACE_SYSTEM_VAR documentationSteven Rostedt (Red Hat)1-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>
2015-02-10tracing: Add samples of DECLARE_EVENT_CLASS() and DEFINE_EVENT()Steven Rostedt (Red Hat)2-0/+88
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>
2015-02-10tracing: Add TRACE_EVENT_FN exampleSteven Rostedt (Red Hat)2-0/+95
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>
2015-02-10tracing: Add TRACE_EVENT_CONDITION sampleSteven Rostedt (Red Hat)2-0/+61
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>
2015-02-09tracing: Update the TRACE_EVENT fields available in the sample codeSteven Rostedt (Red Hat)2-14/+150
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>
2014-07-01tracing: Change trace event sample to use strlcpy instead of strncpyZhao Hongjiang1-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>
2014-06-21tracing: Add __field_struct macro for TRACE_EVENT()Steven Rostedt1-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>
2009-09-15debugfs: Change debuhgfs directory of trace-events-sample.hGeunSik Lim1-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>
2009-07-13tracing/events: Move TRACE_SYSTEM outside of include guardLi Zefan1-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>
2009-06-17tracing: update sample event documentationSteven Rostedt2-11/+24
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>
2009-05-07tracing: update sample with TRACE_INCLUDE_FILESteven Rostedt1-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>
2009-05-06tracing: small trave_events sample Makefile cleanupChristoph Hellwig1-3/+1
Use -I$(src) to add the current directory the include path. [ Impact: cleanup ] Signed-off-by: Christoph Hellwig <hch@lst.de> Acked-by: Steven Rostedt <rostedt@goodmis.org> LKML-Reference: <new-submission> Signed-off-by: Ingo Molnar <mingo@elte.hu>
2009-05-06tracing/events: don't say hi when loading the trace event sampleLi Zefan1-4/+0
The sample is useful for testing, and I'm using it. But after loading the module, it keeps saying hi every 10 seconds, this may be disturbing. Also Steven said commenting out the "hi" helped in causing races. :) [ Impact: make testing a bit easier ] Signed-off-by: Li Zefan <lizf@cn.fujitsu.com> Acked-by: Steven Rostedt <rostedt@goodmis.org> Acked-by: Frederic Weisbecker <fweisbec@gmail.com> LKML-Reference: <4A00F6AD.2070008@cn.fujitsu.com> Signed-off-by: Ingo Molnar <mingo@elte.hu>
2009-04-15tracing/events: add trace-events-sampleSteven Rostedt3-0/+188
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>