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: Tue, 07 Jul 2015 14:47:33 +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=r1igEnCb6aK7Na3chPcT4IZyMrpfxs/CDhgflFab2ps=; b=YLWQTrFARteARS0xX22/ElrT244O4Wjp0RitUhm6Ju92pNIMqX9W7lB1bhTCRMIt26 XQxfo3rX7hOhrVpU0MiAu7gDcov9NejmiZOD3q6Gi/l9FskOM0B1t1kq7bSlKoxGp0vp Nc8bK4QkJgVmHHEzQUqINLKCeLaQ57F63DbQpPIfetY/Dw2bA16zFW/suf8kRre6E9eb BttbtyC9pQPk28PwHwPTVwwB0qR1V8fzYeNmI2tPRucEMlDbNo6iNBJOEot264LbmSNP 2sncxU6LukO+egw+GGyFx8DbuczWciZz0JwoWTgjFmEp3LPPQdV9zjSD1SuhrLW7eOHB OOtA==
In-reply-to: <CANbxzdWWozajgdEWpzX-MbndB=4EeLM-8p3QZRytJHhw+rrakQ@xxxxxxxxxxxxxx>
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>
I am able to get the tv_sec and tv_usec properties from the result using "result.contents.timestamp.tv_sec", but I don't know how to convert that back into an actual timestamp with format, say, "MM/dd/yyy HH:mm:ss". Is there a way to do this?

Thanks,
Rohan

On Tue, Jul 7, 2015 at 10:34 AM Rohan Arora <rarora2012@xxxxxxxxx> wrote:
Would it work for longer if I used a larger number, i.e. changing the 7 to an 8? Also, how can I retrieve "result's" timestamp after getting it using pmFetch in Python? Is there a way to do this? result.timestamp gives me an error saying that there is no attribute timestamp.

Thanks,
Rohan

On Mon, Jul 6, 2015 at 5:42 PM Ken McDonell <kenj@xxxxxxxxxxxxxxxx> wrote:
On 07/07/15 03:27, Rohan Arora wrote:
> Also, I see that in the pmSetMode() documentation, to read an archive in
> reverse order you use pmSetMode(PM_MODE_BACK, timeval, delta). The
> example gave the value 0x7fffffff for timeval.tv_sec, but I was
> wondering, is that guaranteed to read from the end of the archive? In my
> case, I always just want to read the last x entries in the log.

For all practical purposes (at least for a few more years, till around
2038) this will work.

Alternatively, use
    pmGetArchiveEnd(&mytime)
<Prev in Thread] Current Thread [Next in Thread>