pcp
[Top] [All Lists]

Re: PMAPI observations re. converting an app to pcp

To: "Frank Ch. Eigler" <fche@xxxxxxxxxx>
Subject: Re: PMAPI observations re. converting an app to pcp
From: Mark Goodwin <mgoodwin@xxxxxxxxxx>
Date: Tue, 07 Oct 2014 22:45:41 +1100
Cc: pcp developers <pcp@xxxxxxxxxxx>
Delivered-to: pcp@xxxxxxxxxxx
In-reply-to: <y0moatp14kg.fsf@xxxxxxxx>
References: <20140925180407.GA18679@xxxxxxxxxx> <y0my4sw3kcc.fsf@xxxxxxxx> <5431FDFD.6020208@xxxxxxxxxx> <y0moatp14kg.fsf@xxxxxxxx>
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.7.0
On 10/07/2014 04:38 AM, Frank Ch. Eigler wrote:
[..]

Thanks, I'll study your code and steal lots of bits.  I'm leaning
toward a little simpler solution in some ways.  For example, how about
just use one pcp context per "fetch-group"?

IIRC, the optFetch API that fetchGroup uses decides how many contexts
to use based (in part) on the instance profiles.


That would make it less
necessary to have special time-setting or profile-manipulation
wrappers, since it would compose with the normal PMAPI functions.

well, you'll still need the pmSetMode() wrapper for multiple contexts
because multiple hosts or archives are supported. So __pmFetchGroupArchiveMode just walks all of the contexts in each of the fetch groups, vis :

void
__pmFetchGroupArchiveMode(int mode, const struct timeval *when, int interval)
{
    int fg;
    int c;
    fetchGroup *group;
    int curcontext = pmWhichContext();

    for (fg=0; fg < nfetchGroups; fg++) {
        group = &fetchGroups[fg];
        for (c=0; c < group->ncontexts; c++) {
            if (group->contexts[c] >= 0) {
                pmUseContext(group->contexts[c]);
                pmSetMode(mode, when, interval);
            }
        }
    }

    if (curcontext >= 0)
        pmUseContext(curcontext);
}

BTW, I doubt this code is thread safe ...


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