Re: [PATCH 04/11] perf data: Make perf_data__size to work over directory
From: Jiri Olsa
Date: Sat Mar 09 2019 - 12:26:49 EST
On Fri, Mar 08, 2019 at 02:33:05PM -0300, Arnaldo Carvalho de Melo wrote:
> Em Fri, Mar 08, 2019 at 02:47:38PM +0100, Jiri Olsa escreveu:
> > Making perf_data__size to return proper size
> > for directory data.
> >
> > Link: http://lkml.kernel.org/n/tip-t4dm8cctat2ginmy2bb08xe8@xxxxxxxxxxxxxx
> > Signed-off-by: Jiri Olsa <jolsa@xxxxxxxxxx>
> > ---
> > tools/perf/util/data.c | 17 +++++++++++++++++
> > tools/perf/util/data.h | 6 +-----
> > 2 files changed, 18 insertions(+), 5 deletions(-)
> >
> > diff --git a/tools/perf/util/data.c b/tools/perf/util/data.c
> > index d568975c5ee3..498c531e2cb9 100644
> > --- a/tools/perf/util/data.c
> > +++ b/tools/perf/util/data.c
> > @@ -393,3 +393,20 @@ int perf_data__switch(struct perf_data *data,
> > free(new_filepath);
> > return ret;
> > }
> > +
> > +unsigned long perf_data__size(struct perf_data *data)
> > +{
> > + u64 size = data->file.size;
> > + int i;
> > +
> > + if (!data->is_dir)
> > + return size;
>
> So you do the sum over dir.files[i] _plus_ what is in data->file.size,
> what is in data->file.size? Zero for the dir case? Or some non-per-cpu
> metadata?
yes, saw the updated changelong, thanks
jirka