pcp
[Top] [All Lists]

Re: [pcp] Help with Python API

To: Ken McDonell <kenj@xxxxxxxxxxxxxxxx>, pcp@xxxxxxxxxxx
Subject: Re: [pcp] Help with Python API
From: Rohan Arora <rarora2012@xxxxxxxxx>
Date: Wed, 08 Jul 2015 14:04:30 +0000
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 :content-type; bh=SXFmjlPSKaV1deHwe4kJELlw3c+CNmVQsfRq7WirC7Q=; b=YX0x8CZwGW47gVOPIWclylCILpvWxPV6HgcyfnqgqeUG5E7ysHvQ7V5ZD66RyoeBnS gP9XJ2e4bgPYHvOYg5l3nrLxlzlBCB5YhyAXvsD3CfReiegL8jEVQLlWfwfwd5GDaei6 wWBMkkeOBIW1+1S6OhJrkOHuOrrONUYzXkTTfUoMIeJc6TBUP8CTUkM8+jOcUWn52IYW LIukTgD1yi/A6NsEO1QGPRv8lrTA0FuK6FpmBvj7q52NyRA6RNw81wUzkGXopPdyREdu WIFoaHDtuoZ9Dtd8/lIsHoeQTUBtk3HrkYNZIIv/Zrw9PXT8WqPfDn9+AiQxOaZrzrc5 h3FA==
In-reply-to: <559C4552.2010407@xxxxxxxxxxxxxxxx>
References: <CANbxzdXmsRFyF_J_7c93uBuKWJHZikoRs6xmSPQC91rALtZbNA@xxxxxxxxxxxxxx> <CANbxzdXGZosHkKZXrcvJMoaPb=2YOY7_Rhw6cs2y-vp0Jhj8Vg@xxxxxxxxxxxxxx> <CANbxzdXVmBE1qRoHQQTy9VvbAt4rqppwEL-xizSUH7cKOswNzQ@xxxxxxxxxxxxxx> <CANbxzdV7Vndvczvo9OLgc8CpQ20wBK=YUD6v87ewVBa6yrTXKQ@xxxxxxxxxxxxxx> <CANbxzdXcqg=sRYa0JwETB+RHChw42uAeZE-n+bABUjV-FD9TDg@xxxxxxxxxxxxxx> <587447889.27462536.1435530714712.JavaMail.zimbra@xxxxxxxxxx> <CANbxzdX_4yDiOBqU954wjfbKOFOXnB8SJ_uiRsKEBdUk-hxF1w@xxxxxxxxxxxxxx> <CANbxzdUHygK=0NuO7L3pV+FERXa-LRL59=sumY5TznT0xzonxg@xxxxxxxxxxxxxx> <337532723.28653925.1435618315696.JavaMail.zimbra@xxxxxxxxxx> <CANbxzdVqbstVAue-GKW5moDkkKJKeg5pvtRdg1eHNET_7dHxeQ@xxxxxxxxxxxxxx> <559466FE.8090107@xxxxxxxxxxxxxxxx> <CANbxzdXqUj3i-MR2xF_NrTkYV11MMLBCX0B-+Btt45JQa77NQA@xxxxxxxxxxxxxx> <CANbxzdUn0Q8BkJUm-KAuTGxQAhQTz0CmSLdXEHKLT8UVKuBx4A@xxxxxxxxxxxxxx> <559AF629.5090609@xxxxxxxxxxxxxxxx> <CANbxzdWWozajgdEWpzX-MbndB=4EeLM-8p3QZRytJHhw+rrakQ@xxxxxxxxxxxxxx> <559C4552.2010407@xxxxxxxxxxxxxxxx>
Sorry, I did not mean "longer" in terms of going farther in the archive. What I meant was if I were to change the value for timeval.tv_sec from 0x7ff... to 0x8ff... would it get me the end of the archive in say 2045 whereas 0x7ff... would stop getting me the end of the archive in ~2038?

Thanks,
Rohan

On Tue, Jul 7, 2015 at 5:32 PM Ken McDonell <kenj@xxxxxxxxxxxxxxxx> wrote:
On 08/07/15 00:35, Rohan Arora wrote:
> Would it work for longer if I used a larger number, i.e. changing the 7
> to an 8? ...

The man page example shows going to the end of an existing archive and
reading data backwards. There is no concept of "longer" here ... the
end of the archive is the end of the archive.

If the argument to pmSetMode is outside the bounds of the archive
(either before or, in your case, after) then the next pmFetch will
retrieve the first (or in your case, last) record in the archive.

If the archive was _growing_ and you wanted to repeatedly read the last
N records then you'd need something like

loop
    pmGetArchiveEnd(&mytime)
    pmSetMode(PM_MODE_BACK, mytime, 0)
    loop N times
        pmFetch(...)
    sleep a while

Note that PM_MODE_BACK reads each physical record, and hence delta to
pmSetMode() is ignored. If you want the last N samples, say at 5 second
intervals then you probably want logical records with interpolation and
so should use
    pmSetMode(PM_MODE_INTERP, mytime, -5000)
or
    pmSetMode(PM_MODE_INTERP|PM_XTB_SET(PM_TIME_SEC), mytime, -5)

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