blob: 35cfe0ed77a952af64b4ac66ce2c27a39aa1983e (
plain)
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
|
/*
* Copyright (c) 1997-2001 Silicon Graphics, Inc. All Rights Reserved.
*/
#include <pcp/pmapi.h>
#include <pcp/impl.h>
#include <time.h>
int
main(int argc, char *argv[])
{
time_t clock;
char *p;
int i;
char buf[28];
i = pmLoadNameSpace(PM_NS_DEFAULT);
if (i < 0) {
printf("pmLoadNameSpace: %s\n", pmErrStr(i));
exit(1);
}
for (--argc; argc > 0; argc--, argv++) {
printf("Trying %s ...\n", argv[1]);
i = pmNewContext(PM_CONTEXT_HOST, argv[1]);
if (i < 0) {
printf("pmNewContext: %s\n", pmErrStr(i));
goto more;
}
i = pmNewContextZone();
if (i < 0) {
printf("pmNewContextZone: %s\n", pmErrStr(i));
goto more;
}
i = pmWhichZone(&p);
time(&clock);
printf("zone: %d TZ: %s ctime: %s\n", i, p, pmCtime(&clock, buf));
more: continue;
}
exit(0);
}
|