[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH] xenpm: Add option to report average CPU frequency



On 19/01/16 10:50, Malcolm Crossley wrote:
> @@ -343,10 +348,44 @@ void pxstat_func(int argc, char *argv[])
>          show_pxstat_by_cpuid(xc_handle, cpuid);
>  }
>  
> +static int show_cpufreq_by_cpuid(xc_interface *xc_handle, int cpuid)
> +{
> +    int ret = 0;
> +
> +    ret = get_avgfreq_by_cpuid(xc_handle, cpuid, &avgfreq[cpuid]);
> +    if ( ret )
> +        return ret;
> +
> +    printf("cpu id               : %d\n", cpuid);
> +    printf("average cpu frequency: %d\n", avgfreq[cpuid]);
> +    printf("\n");
> +    return 0;
> +}
> +
> +void cpufreq_func(int argc, char *argv[])
> +{
> +    int cpuid = -1;
> +
> +    if ( argc > 0 )
> +        parse_cpuid(argv[0], &cpuid);
> +
> +    avgfreq = calloc(max_cpu_nr, sizeof(*avgfreq));

You need a NULL check here.

~Andrew

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.