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:	Sun, 26 Jul 2015 18:31:44 +0200
From:	Jiri Olsa <jolsa@...hat.com>
To:	kan.liang@...el.com
Cc:	a.p.zijlstra@...llo.nl, acme@...nel.org, luto@...nel.org,
	mingo@...hat.com, eranian@...gle.com, ak@...ux.intel.com,
	mark.rutland@....com, adrian.hunter@...el.com, jolsa@...nel.org,
	namhyung@...nel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH V2 1/6] perf,tools: save cpu max freq in perf header

On Fri, Jul 24, 2015 at 09:48:27AM -0400, kan.liang@...el.com wrote:

SNIP

>  			      struct perf_header *h __maybe_unused,
>  		       struct perf_evlist *evlist __maybe_unused)
> @@ -1158,6 +1168,11 @@ static void print_cpuid(struct perf_header *ph, int fd __maybe_unused, FILE *fp)
>  	fprintf(fp, "# cpuid : %s\n", ph->env.cpuid);
>  }
>  
> +static void print_cpu_max_freq(struct perf_header *ph, int fd __maybe_unused, FILE *fp)
> +{
> +	fprintf(fp, "# CPU max frequency : %u MHz\n", ph->env.cpu_max_freq);
> +}
> +
>  static void print_branch_stack(struct perf_header *ph __maybe_unused,
>  			       int fd __maybe_unused, FILE *fp)
>  {
> @@ -1471,6 +1486,25 @@ static int process_cpuid(struct perf_file_section *section __maybe_unused,
>  	return ph->env.cpuid ? 0 : -ENOMEM;
>  }
>  
> +static int process_cpu_max_freq(struct perf_file_section *section __maybe_unused,
> +				struct perf_header *ph, int fd,
> +				void *data __maybe_unused)
> +{
> +	ssize_t ret;
> +	u32 nr;
> +
> +	ret = readn(fd, &nr, sizeof(nr));
> +	if (ret != sizeof(nr))
> +		return -1;
> +
> +	if (ph->needs_swap)
> +		nr = bswap_32(nr);
> +
> +	ph->env.cpu_max_freq = nr;
> +
> +	return 0;
> +}
> +
>  static int process_total_mem(struct perf_file_section *section __maybe_unused,
>  			     struct perf_header *ph, int fd,
>  			     void *data __maybe_unused)
> @@ -1885,6 +1919,7 @@ static const struct feature_ops feat_ops[HEADER_LAST_FEATURE] = {
>  	FEAT_OPP(HEADER_NRCPUS,		nrcpus),
>  	FEAT_OPP(HEADER_CPUDESC,	cpudesc),
>  	FEAT_OPP(HEADER_CPUID,		cpuid),
> +	FEAT_OPP(HEADER_CPU_MAX_FREQ,	cpu_max_freq),

I wonder we should start generic FEAT for CPU related data
stored in some expandable way tag-value or such

jirka
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ