• Jiri Olsa's avatar
    tracing: Fix function graph trace_pipe to properly display failed entries · be1eca39
    Jiri Olsa authored
    There is a case where the graph tracer might get confused and omits
    displaying of a single record.  This applies mostly with the trace_pipe
    since it is unlikely that the trace_seq buffer will overflow with the
    trace file.
    
    As the function_graph tracer goes through the trace entries keeping a
    pointer to the current record:
    
    current ->  func1 ENTRY
                func2 ENTRY
                func2 RETURN
                func1 RETURN
    
    When an function ENTRY is encountered, it moves the pointer to the
    next entry to check if the function is a nested or leaf function.
    
                func1 ENTRY
    current ->  func2 ENTRY
                func2 RETURN
                func1 RETURN
    
    If the rest of the writing of the function fills the trace_seq buffer,
    then the trace_pipe read will ignore this entry. The next read will
    Now start at the current location, but the first entry (func1) will
    be discarded.
    
    This patch keeps a copy of the current entry in the iterator private
    storage and will keep track of when the trace_seq buffer fills. When
    the trace_seq buffer fills, it will reuse the copy of the entry in the
    next iteration.
    
    [
      This patch has been largely modified by Steven Rostedt in order to
      clean it up and simplify it. The original idea and concept was from
      Jirka and for that, this patch will go under his name to give him
      the credit he deserves. But because this was modify by Steven Rostedt
      anything wrong with the patch should be blamed on Steven.
    ]
    Signed-off-by: default avatarJiri Olsa <jolsa@redhat.com>
    Cc: Frederic Weisbecker <fweisbec@gmail.com>
    LKML-Reference: <1259067458-27143-1-git-send-email-jolsa@redhat.com>
    Signed-off-by: default avatarSteven Rostedt <rostedt@goodmis.org>
    be1eca39
trace_functions_graph.c 27.8 KB