pcp
[Top] [All Lists]

Re: [pcp] Fetch User CPU Usage as a Percentage?

To: Nathan Scott <nathans@xxxxxxxxxx>
Subject: Re: [pcp] Fetch User CPU Usage as a Percentage?
From: Rohan Arora <rarora2012@xxxxxxxxx>
Date: Thu, 30 Jul 2015 14:01:19 +0000
Cc: pcp@xxxxxxxxxxx
Delivered-to: pcp@xxxxxxxxxxx
Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-type; bh=N2LaEw4lKKMc8lWHNV4UfMk5XrJP0eZnm2sTdoU33Fw=; b=a2MrqmaPQ6dvJt5MK+r6lIoJ+tPK5qPsx6k06Ngro97AtfJBm3kqD1m0T50CDGsVkG eC5UDzZKWxt2PbhUuG64+jBDOnDf0Y5kDeyhN4eXz/2Z6KvRrroL9P/slymOTkxvG6VF +bmU+6rLv5M3E3dr/Im/XMMbHoPgz5/ylhVl6ZcE6HsRy4r7QKhPGT0eau49VM/qIgNX g4HDhyQm35aKVzCWli/qcSWaoVkZNKsCFvBLVLNNId5SXnUHZm6O/bbLfl2b0azWHWro ++4kW9apvhzc8Iz77O/F0GC/o1aJ4Hah4bVDIa4QwhMfJ0YzrMK1IESI5YebAQXHTN+G M6Wg==
In-reply-to: <706968281.687935.1438217114363.JavaMail.zimbra@xxxxxxxxxx>
References: <CANbxzdXXmYefH5B1in5zYSkAT8gOieN387sNXDTvTR=9gyUNOw@xxxxxxxxxxxxxx> <706968281.687935.1438217114363.JavaMail.zimbra@xxxxxxxxxx>
As far as I can tell, there is no metricConvert() function defined in pmcc.py. Is it available in the Python version of pmcc?

Thanks,
Rohan

On Wed, Jul 29, 2015 at 8:45 PM Nathan Scott <nathans@xxxxxxxxxx> wrote:
Hi Rohan,

----- Original Message -----
> Is there a way to fetch the User CPU Usage as a Percentage directly, having
> PCP take more than one sample, and doing the rate-conversion itself using
> the Python API? Currently what I am doing is running pmFetch twice for the
> "kernel.all.cpu.user". I then calculate the percentage using (val2 - val1) /
> (timestamp2 - timestamp1) * 100. Is there a way that I can just have PCP do
> this automatically? This would also be really nice for working with an
> archive, as I wouldn't have to do this for each and every result that I get.
>
> If there is not a way to get the percentage directly, is there a better way
> of going about doing this?

The pcp.pmcc module will do rate conversion for you - see the Metric class,
metricConvert() method. You'll still need to do the percentage conversion,
but that's the easy bit.

cheers.

--
Nathan
<Prev in Thread] Current Thread [Next in Thread>