From: Andrew Cooper <andrew.cooper3@citrix.com>
To: Malcolm Crossley <malcolm.crossley@citrix.com>,
ian.jackson@eu.citrix.com, stefano.stabellini@eu.citrix.com,
ian.campbell@citrix.com, wei.liu2@citrix.com
Cc: xen-devel@lists.xen.org
Subject: Re: [PATCH] xenpm: Add option to report average CPU frequency
Date: Tue, 19 Jan 2016 11:16:09 +0000 [thread overview]
Message-ID: <569E1AF9.5000805@citrix.com> (raw)
In-Reply-To: <1453200631-11818-1-git-send-email-malcolm.crossley@citrix.com>
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
prev parent reply other threads:[~2016-01-19 11:16 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-01-19 10:50 [PATCH] xenpm: Add option to report average CPU frequency Malcolm Crossley
2016-01-19 11:06 ` Ian Campbell
2016-01-19 11:10 ` Malcolm Crossley
2016-01-19 11:35 ` Ian Campbell
2016-01-19 11:39 ` Malcolm Crossley
2016-01-19 11:16 ` Andrew Cooper [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=569E1AF9.5000805@citrix.com \
--to=andrew.cooper3@citrix.com \
--cc=ian.campbell@citrix.com \
--cc=ian.jackson@eu.citrix.com \
--cc=malcolm.crossley@citrix.com \
--cc=stefano.stabellini@eu.citrix.com \
--cc=wei.liu2@citrix.com \
--cc=xen-devel@lists.xen.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).