1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
/*
* Copyright (c) 1997-2001 Silicon Graphics, Inc. All Rights Reserved.
*/
/*
* pmcd pmda was botched
*/
#include <pcp/pmapi.h>
#include <pcp/impl.h>
int
main()
{
pmID pmid;
__pmID_int *p = (__pmID_int *)&pmid;
pmResult *rp;
int sts;
pmid = 0;
p->domain = 2; /* pmcd */
p->cluster = 13; /* bogus */
sts = pmNewContext(PM_CONTEXT_HOST, "localhost");
if (sts < 0) {
fprintf(stderr, "pmNewContext(localhost) failed: %s\n", pmErrStr(sts));
exit(1);
}
sts = pmFetch(1, &pmid, &rp);
if (sts != 0)
printf("expect no error, got: %d %s\n", sts, pmErrStr(sts));
if (rp->numpmid != 1)
printf("expect 1 pmid, got %d\n", rp->numpmid);
if (rp->vset[0]->pmid != pmid) {
printf("pmid mismatch! %s", pmIDStr(pmid));
printf(" != %s\n", pmIDStr(rp->vset[0]->pmid));
}
if (rp->vset[0]->numval == 1)
printf("%d values is bogus\n", rp->vset[0]->numval);
else
printf("no value in pmResult -- expected\n");
exit(0);
}
|