pcp
[Top] [All Lists]

Re: [pcp] Floating point problem

To: Ken McDonell <kenj@xxxxxxxxxxxxxxxx>
Subject: Re: [pcp] Floating point problem
From: Martin Spier <mspier@xxxxxxxxxxx>
Date: Mon, 28 Jul 2014 12:47:31 -0700
Cc: pcp@xxxxxxxxxxx, Amer Ather <aather@xxxxxxxxxxx>, Coburn Watson <cwatson@xxxxxxxxxxx>, Brendan Gregg <bgregg@xxxxxxxxxxx>
Delivered-to: pcp@xxxxxxxxxxx
Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=netflix.com; s=google; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=ZqfyCoeEyleuC3qh3BWl+twJIjsYN/jNAfxRKMUF10U=; b=VYYfbCKzBRpUAlnlecfMxkKzm3gz2/+GAifX4m7+4LRFT+o4Sm9OSHnZRZCULlYGzT aO4QbtViN71OjnrpE81EesOwL7ff/GCAcaFOgHr//KEkDFfg30iCYY0yu9idxOUZQf3d tL4xIbksQZnZp7DYZyFcVrRNTsE/r7fH6wg3k=
In-reply-to: <033501cfa8a4$fd091ed0$f71b5c70$@internode.on.net>
References: <CAEp4+dU2kE9JJztBPc=N5oSyoEyBvN5Of19rohC3DxXGeomuRw@xxxxxxxxxxxxxx> <033501cfa8a4$fd091ed0$f71b5c70$@internode.on.net>
Here it is:

kernel.pct.cpu.user = 100 * kernel.all.cpu.user / hinv.ncpu
kernel.pct.cpu.sys Â= 100 * kernel.all.cpu.sys / hinv.ncpu

Same definition Amer posted before. Think it came from:


Here are two sample responses I just took, 1 second apart:

{
 "timestamp": {
  "s": 1406575780,
  "us": 397728
 },
 "values": [
  {
   "pmid": 2143289345,
   "name": "kernel.pct.cpu.user",
   "instances": [
    {
     "value": 5.35574E+8
    }
   ]
  }
 ]
}

{
 "timestamp": {
  "s": 1406575781,
  "us": 393553
 },
 "values": [
  {
   "pmid": 2143289345,
   "name": "kernel.pct.cpu.user",
   "instances": [
    {
     "value": 5.35574E+8
    }
   ]
  }
 ]
}

Since I'm calculating deltas, the precision only gives me full percentage points at this stage. In this case, since the system was idle, it was either 0 (like the response samples) or 1.


â
Let me know if there's anything wrong with the definitions.

Thanks,
Martin



On Sat, Jul 26, 2014 at 12:40 AM, Ken McDonell <kenj@xxxxxxxxxxxxxxxx> wrote:

I think there is a problem with the derived metric definition â looks like the number is a counter, which probably is not correct.

Â

Can you send me the derived metric definition please?

Â

From: pcp-bounces@xxxxxxxxxxx [mailto:pcp-bounces@xxxxxxxxxxx] On Behalf Of Martin Spier
Sent: Saturday, 26 July 2014 10:59 AM
To: pcp@xxxxxxxxxxx
Cc: Amer Ather; Coburn Watson; Brendan Gregg
Subject: [pcp] Floating point problem

Â

Ran into a small problem with "value" floating point precision on pmwebd json responses.

Â

Cumulative values get too big and I start having problems like this:

Â

{

 "timestamp": {

  "s": 1406323733,

  "us": 288692

 },

 "values": [

  {

   "pmid": 2143289348,

   "name": "kernel.pct.cpu.user",

   "instances": [

    {

     "value": 7.94874E+10

    }

   ]

  }

 ]

}

Â

Since I'm trying to calculate % usage in this case, subtracting previous value from current and normalizing by delta in time, at this point I can't get any useful information to plot due to the low precision.

Â

Any suggestions?

Â

-Martin


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