03 Nov, 2015

1 commit

  • The commit 889204278ccf ("tracing: Update trace-event-sample with
    TRACE_SYSTEM_VAR documentation") changed TRACE_SYSTEM to 'sample-trace',
    but didn't make the according change of its name in the comments.

    Link: http://lkml.kernel.org/r/1443599650-23680-1-git-send-email-zhang.chunyan@linaro.org

    Signed-off-by: Chunyan Zhang
    Signed-off-by: Steven Rostedt

    Chunyan Zhang
     

18 Jul, 2015

1 commit

  • He Kuang noticed that the trace event samples for arrays was broken:

    "The output result of trace_foo_bar event in traceevent samples is
    wrong. This problem can be reproduced as following:

    (Build kernel with SAMPLE_TRACE_EVENTS=m)

    $ insmod trace-events-sample.ko

    $ echo 1 > /sys/kernel/debug/tracing/events/sample-trace/foo_bar/enable

    $ cat /sys/kernel/debug/tracing/trace

    event-sample-980 [000] .... 43.649559: foo_bar: foo hello 21 0x15
    BIT1|BIT3|0x10 {0x1,0x6f6f6e53,0xff007970,0xffffffff} Snoopy
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    The array length is not right, should be {0x1}.
    (ffffffff,ffffffff)

    event-sample-980 [000] .... 44.653827: foo_bar: foo hello 22 0x16
    BIT2|BIT3|0x10
    {0x1,0x2,0x646e6147,0x666c61,0xffffffff,0xffffffff,0x750aeffe,0x7}
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    The array length is not right, should be {0x1,0x2}.
    Gandalf (ffffffff,ffffffff)"

    This was caused by an update to have __print_array()'s second parameter
    be the count of items in the array and not the size of the array.

    As there is already users of __print_array(), it can not change. But
    the sample code can and we can also improve on the documentation about
    __print_array() and __get_dynamic_array_len().

    Link: http://lkml.kernel.org/r/1436839171-31527-2-git-send-email-hekuang@huawei.com

    Fixes: ac01ce1410fc2 ("tracing: Make ftrace_print_array_seq compute buf_len")
    Reported-by: He Kuang
    Signed-off-by: Steven Rostedt

    Steven Rostedt (Red Hat)
     

08 Apr, 2015

2 commits

  • 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
    Tested-by: Masami Hiramatsu
    Signed-off-by: Steven Rostedt

    Steven Rostedt (Red Hat)
     
  • 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
    Tested-by: Masami Hiramatsu
    Signed-off-by: Steven Rostedt

    Steven Rostedt (Red Hat)
     

10 Feb, 2015

4 commits


01 Jul, 2014

1 commit

  • 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
    Signed-off-by: Steven Rostedt

    Zhao Hongjiang
     

21 Jun, 2014

1 commit

  • 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
    Signed-off-by: Steven Rostedt

    Steven Rostedt
     

16 Sep, 2009

1 commit


13 Jul, 2009

1 commit

  • If TRACE_INCLDUE_FILE is defined,
    will be included and compiled, otherwise it will be

    So TRACE_SYSTEM should be defined outside of #if proctection,
    just like TRACE_INCLUDE_FILE.

    Imaging this scenario:

    #include
    -> TRACE_SYSTEM == foo
    ...
    #include
    -> TRACE_SYSTEM == bar
    ...
    #define CREATE_TRACE_POINTS
    #include
    -> TRACE_SYSTEM == bar !!!

    and then bar.h will be included and compiled.

    Signed-off-by: Li Zefan
    Cc: Steven Rostedt
    Cc: Frederic Weisbecker
    LKML-Reference:
    Signed-off-by: Ingo Molnar

    Li Zefan
     

17 Jun, 2009

1 commit


07 May, 2009

1 commit

  • 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

    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
    Signed-off-by: Steven Rostedt

    Steven Rostedt
     

06 May, 2009

2 commits


15 Apr, 2009

1 commit