Re: S390 support to be removed from next oprofile release

Maynard Johnson <[email protected]>
Newsgroups gmane.linux.oprofile
Message-ID <[email protected]>
On 08/01/2014 06:16 AM, Andreas Arnez wrote:
> On Thu, Jul 31 2014, Andreas Arnez wrote:
> 
>> [...] I think I can provide you with a patch that implements
>> _get_s390_cpu_type() by tomorrow.
> 
> OK, here you go.  Note that I only unit-tested the new function
> _get_s390_cpu_type(), but I didn't build (and test) oprofile with this
> change.

Patch committed.  Pretty simple. Now operf and ocount support s390.  Thanks!

-Maynard
> 
> 
> -- >8 --
> From: Andreas Arnez <[email protected]>
> Date: Fri, 1 Aug 2014 13:12:01 +0200
> Subject: [PATCH] Determine s390 cpu type from /proc/cpuinfo.
> 
> Signed-off-by: Andreas Arnez <[email protected]>
> ---
>  libop/op_cpu_type.c |   36 ++++++++++++++++++++++++++++++++++++
>  1 file changed, 36 insertions(+)
> 
> diff --git a/libop/op_cpu_type.c b/libop/op_cpu_type.c
> index 055c64b..94d832f 100644
> --- a/libop/op_cpu_type.c
> +++ b/libop/op_cpu_type.c
> @@ -629,6 +629,39 @@ static op_cpu _get_mips_cpu_type(void)
>  	return CPU_NO_GOOD;
>  }
> 
> +static op_cpu _get_s390_cpu_type(void)
> +{
> +	char line[100];
> +	char *ptr;
> +	const char prefix[] = "machine = ";
> +	unsigned model;
> +
> +	ptr = _get_cpuinfo_cpu_type_line(line, sizeof(line), "processor", 0);
> +	if (!ptr)
> +		return CPU_NO_GOOD;
> +
> +	ptr = strstr(ptr, prefix);
> +	if (!ptr)
> +		return CPU_NO_GOOD;
> +
> +	ptr += sizeof(prefix) - 1;
> +	if (sscanf(ptr, "%u", &model) != 1)
> +		return CPU_NO_GOOD;
> +
> +	switch (model) {
> +	case 2097:
> +	case 2098:
> +		return CPU_S390_Z10;
> +	case 2817:
> +	case 2818:
> +		return CPU_S390_Z196;
> +	case 2827:
> +	case 2828:
> +		return CPU_S390_ZEC12;
> +	}
> +	return CPU_NO_GOOD;
> +}
> +
>  static op_cpu __get_cpu_type_alt_method(void)
>  {
>  	struct utsname uname_info;
> @@ -654,6 +687,9 @@ static op_cpu __get_cpu_type_alt_method(void)
>  	if (strncmp(uname_info.machine, "mips", 4) == 0) {
>  		return _get_mips_cpu_type();
>  	}
> +	if (strncmp(uname_info.machine, "s390", 4) == 0) {
> +		return _get_s390_cpu_type();
> +	}
>  	return CPU_NO_GOOD;
>  }
> 


------------------------------------------------------------------------------
Want fast and easy access to all the code in your enterprise? Index and
search up to 200,000 lines of code with a free copy of Black Duck
Code Sight - the same software that powers the world's largest code
search on Ohloh, the Black Duck Open Hub! Try it now.
http://p.sf.net/sfu/bds
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.