• Namhyung Kim's avatar
    perf hists browser: Fix event group display · d9ea48bc
    Namhyung Kim authored
    Milian reported that the event group on TUI shows duplicated overhead.
    This was due to a bug on calculating hpp->buf position.  The
    hpp_advance() was called from __hpp__slsmg_color_printf() on TUI but
    it's already called from the hpp__call_print_fn macro in __hpp__fmt().
    The end result is that the print function returns number of bytes it
    printed but the buffer advanced twice of the length.
    
    This is generally not a problem since it doesn't need to access the
    buffer again.  But with event group, overhead needs to be printed
    multiple times and hist_entry__snprintf_alignment() tries to fill the
    space with buffer after it printed.  So it (brokenly) showed the last
    overhead again.
    
    The bug was there from the beginning, but I think it's only revealed
    when the alignment function was added.
    Reported-by: default avatarMilian Wolff <milian.wolff@kdab.com>
    Signed-off-by: default avatarNamhyung Kim <namhyung@kernel.org>
    Cc: Andi Kleen <andi@firstfloor.org>
    Cc: Jiri Olsa <jolsa@kernel.org>
    Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
    Fixes: 89fee709 ("perf hists: Do column alignment on the format iterator")
    Link: http://lkml.kernel.org/r/20160912061958.16656-2-namhyung@kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
    d9ea48bc
hists.c 81.2 KB