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]
Date:   Fri, 8 Mar 2019 14:33:05 -0300
From:   Arnaldo Carvalho de Melo <arnaldo.melo@...il.com>
To:     Jiri Olsa <jolsa@...nel.org>
Cc:     lkml <linux-kernel@...r.kernel.org>,
        Ingo Molnar <mingo@...nel.org>,
        Namhyung Kim <namhyung@...nel.org>,
        Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
        Peter Zijlstra <a.p.zijlstra@...llo.nl>,
        Adrian Hunter <adrian.hunter@...el.com>,
        Andi Kleen <ak@...ux.intel.com>,
        Stephane Eranian <eranian@...gle.com>,
        Alexey Budankov <alexey.budankov@...ux.intel.com>
Subject: Re: [PATCH 04/11] perf data: Make perf_data__size to work over
 directory

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@git.kernel.org
> Signed-off-by: Jiri Olsa <jolsa@...nel.org>
> ---
>  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?

- Arnaldo

> +
> +	for (i = 0; i < data->dir.nr; i++) {
> +		struct perf_data_file *file = &data->dir.files[i];
> +
> +		size += file->size;
> +	}
> +
> +	return size;
> +}
> diff --git a/tools/perf/util/data.h b/tools/perf/util/data.h
> index 0deeb1af9f54..d342469bdfda 100644
> --- a/tools/perf/util/data.h
> +++ b/tools/perf/util/data.h
> @@ -54,11 +54,6 @@ static inline int perf_data__fd(struct perf_data *data)
>  	return data->file.fd;
>  }
>  
> -static inline unsigned long perf_data__size(struct perf_data *data)
> -{
> -	return data->file.size;
> -}
> -
>  int perf_data__open(struct perf_data *data);
>  void perf_data__close(struct perf_data *data);
>  ssize_t perf_data__write(struct perf_data *data,
> @@ -80,4 +75,5 @@ int perf_data__create_dir(struct perf_data *data, int nr);
>  int perf_data__open_dir(struct perf_data *data);
>  void perf_data__close_dir(struct perf_data *data);
>  int perf_data__update_dir(struct perf_data *data);
> +unsigned long perf_data__size(struct perf_data *data);
>  #endif /* __PERF_DATA_H */
> -- 
> 2.17.2

-- 

- Arnaldo

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ