lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAM9d7ciBYF5zXTHzdubeE1nVw8SewLO=UBwmsxKhjhExujLgQw@mail.gmail.com>
Date:   Tue, 11 Oct 2022 16:48:47 -0700
From:   Namhyung Kim <namhyung@...nel.org>
To:     Ian Rogers <irogers@...gle.com>
Cc:     Arnaldo Carvalho de Melo <acme@...nel.org>,
        Jiri Olsa <jolsa@...nel.org>, Ingo Molnar <mingo@...nel.org>,
        Peter Zijlstra <peterz@...radead.org>,
        LKML <linux-kernel@...r.kernel.org>,
        Adrian Hunter <adrian.hunter@...el.com>,
        linux-perf-users <linux-perf-users@...r.kernel.org>,
        Kan Liang <kan.liang@...ux.intel.com>,
        Leo Yan <leo.yan@...aro.org>, Andi Kleen <ak@...ux.intel.com>,
        Athira Rajeev <atrajeev@...ux.vnet.ibm.com>,
        James Clark <james.clark@....com>,
        Xing Zhengjun <zhengjun.xing@...ux.intel.com>
Subject: Re: [PATCH 12/19] perf stat: Reset aggr counts for each interval

On Mon, Oct 10, 2022 at 4:20 PM Ian Rogers <irogers@...gle.com> wrote:
>
> On Sun, Oct 9, 2022 at 10:36 PM Namhyung Kim <namhyung@...nel.org> wrote:
> >
> > The evsel->stats->aggr->count should be reset for interval processing
> > since we want to use the values directly for display.
> >
> > Signed-off-by: Namhyung Kim <namhyung@...nel.org>
> > ---
> >  tools/perf/builtin-stat.c |  3 +++
> >  tools/perf/util/stat.c    | 13 +++++++++++++
> >  tools/perf/util/stat.h    |  1 +
> >  3 files changed, 17 insertions(+)
> >
> > diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c
> > index 983f38cd4caa..38036f40e993 100644
> > --- a/tools/perf/builtin-stat.c
> > +++ b/tools/perf/builtin-stat.c
> > @@ -492,6 +492,8 @@ static void process_interval(void)
> >         diff_timespec(&rs, &ts, &ref_time);
> >
> >         perf_stat__reset_shadow_per_stat(&rt_stat);
> > +       evlist__reset_aggr_stats(evsel_list);
> > +
> >         read_counters(&rs);
> >
> >         if (STAT_RECORD) {
> > @@ -965,6 +967,7 @@ static int __run_perf_stat(int argc, const char **argv, int run_idx)
> >
> >                 evlist__copy_prev_raw_counts(evsel_list);
> >                 evlist__reset_prev_raw_counts(evsel_list);
> > +               evlist__reset_aggr_stats(evsel_list);
> >                 perf_stat__reset_shadow_per_stat(&rt_stat);
> >         } else {
> >                 update_stats(&walltime_nsecs_stats, t1 - t0);
> > diff --git a/tools/perf/util/stat.c b/tools/perf/util/stat.c
> > index 279aa4ea342d..4edfc1c5dc07 100644
> > --- a/tools/perf/util/stat.c
> > +++ b/tools/perf/util/stat.c
> > @@ -276,6 +276,19 @@ void evlist__reset_stats(struct evlist *evlist)
> >         }
> >  }
> >
> > +void evlist__reset_aggr_stats(struct evlist *evlist)
> > +{
> > +       struct evsel *evsel;
> > +
> > +       evlist__for_each_entry(evlist, evsel) {
> > +               struct perf_stat_evsel *ps = evsel->stats;
> > +               struct perf_stat_aggr *aggr = ps->aggr;
> > +
> > +               if (aggr)
> > +                       memset(aggr, 0, sizeof(*aggr) * ps->nr_aggr);
>
> Perhaps this would be cleaner with helper functions on perf_stat_evsel
> and perf_stat_aggr?

Sounds good.  Will add.

Thanks,
Namhyung

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ