• Kan Liang's avatar
    perf stat: Fix duplicate PMU name for interval print · 80ee8c58
    Kan Liang authored
    PMU name is printed repeatedly for interval print, for example:
    
      perf stat --no-merge -e 'unc_m_clockticks' -a -I 1000
      #           time             counts unit events
         1.001053069        243,702,144      unc_m_clockticks [uncore_imc_4]
         1.001053069        244,268,304      unc_m_clockticks [uncore_imc_2]
         1.001053069        244,427,386      unc_m_clockticks [uncore_imc_0]
         1.001053069        244,583,760      unc_m_clockticks [uncore_imc_5]
         1.001053069        244,738,971      unc_m_clockticks [uncore_imc_3]
         1.001053069        244,880,309      unc_m_clockticks [uncore_imc_1]
         2.002024821        240,818,200      unc_m_clockticks [uncore_imc_4] [uncore_imc_4]
         2.002024821        240,767,812      unc_m_clockticks [uncore_imc_2] [uncore_imc_2]
         2.002024821        240,764,215      unc_m_clockticks [uncore_imc_0] [uncore_imc_0]
         2.002024821        240,759,504      unc_m_clockticks [uncore_imc_5] [uncore_imc_5]
         2.002024821        240,755,992      unc_m_clockticks [uncore_imc_3] [uncore_imc_3]
         2.002024821        240,750,403      unc_m_clockticks [uncore_imc_1] [uncore_imc_1]
    
    For each print, the PMU name is unconditionally appended to the
    counter->name.
    
    Need to check the counter->name first. If the PMU name is already
    appended, do nothing.
    
    Committer notes:
    
    Add and use perf_evsel->uniquified_name bool instead of doing the more
    expensive strstr(event->name, pmu->name).
    Signed-off-by: default avatarKan Liang <kan.liang@linux.intel.com>
    Tested-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
    Cc: Agustin Vega-Frias <agustinv@codeaurora.org>
    Cc: Andi Kleen <ak@linux.intel.com>
    Cc: Ganapatrao Kulkarni <ganapatrao.kulkarni@cavium.com>
    Cc: Jin Yao <yao.jin@linux.intel.com>
    Cc: Jiri Olsa <jolsa@redhat.com>
    Cc: Namhyung Kim <namhyung@kernel.org>
    Cc: Peter Zijlstra <peterz@infradead.org>
    Cc: Shaokun Zhang <zhangshaokun@hisilicon.com>
    Cc: Will Deacon <will.deacon@arm.com>
    Fixes: 8c5421c0 ("perf pmu: Display pmu name when printing unmerged events in stat")
    Link: http://lkml.kernel.org/r/1524594014-79243-5-git-send-email-kan.liang@linux.intel.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
    80ee8c58
builtin-stat.c 74.7 KB