diff options
author | Igor Pashev <pashev.igor@gmail.com> | 2014-10-26 12:33:50 +0400 |
---|---|---|
committer | Igor Pashev <pashev.igor@gmail.com> | 2014-10-26 12:33:50 +0400 |
commit | 47e6e7c84f008a53061e661f31ae96629bc694ef (patch) | |
tree | 648a07f3b5b9d67ce19b0fd72e8caa1175c98f1a /qa/pmdas/bigun | |
download | pcp-debian.tar.gz |
Debian 3.9.10debian/3.9.10debian
Diffstat (limited to 'qa/pmdas/bigun')
-rw-r--r-- | qa/pmdas/bigun/GNUmakefile | 32 | ||||
-rw-r--r-- | qa/pmdas/bigun/GNUmakefile.install | 43 | ||||
-rwxr-xr-x | qa/pmdas/bigun/Install | 24 | ||||
-rwxr-xr-x | qa/pmdas/bigun/Remove | 11 | ||||
-rw-r--r-- | qa/pmdas/bigun/bigun.c | 71 | ||||
-rw-r--r-- | qa/pmdas/bigun/domain.h | 2 | ||||
-rw-r--r-- | qa/pmdas/bigun/help | 1 | ||||
-rw-r--r-- | qa/pmdas/bigun/pmns | 4 | ||||
-rw-r--r-- | qa/pmdas/bigun/root | 5 |
9 files changed, 193 insertions, 0 deletions
diff --git a/qa/pmdas/bigun/GNUmakefile b/qa/pmdas/bigun/GNUmakefile new file mode 100644 index 0000000..a4160d9 --- /dev/null +++ b/qa/pmdas/bigun/GNUmakefile @@ -0,0 +1,32 @@ +# +# Copyright (c) 2012 Red Hat. +# Copyright (c) 2011 Ken McDonell. All Rights Reserved. +# + +TOPDIR = ../../.. +include $(TOPDIR)/src/include/builddefs + +TESTDIR = $(PCP_VAR_DIR)/testsuite/pmdas/bigun + +CFILES = bigun.c +LIBTARGET = bigun.$(DSOSUFFIX) +TARGETS = $(LIBTARGET) +MYFILES = domain.h help pmns root +MYSCRIPTS = Install Remove +LSRCFILES = $(MYFILES) $(MYSCRIPTS) GNUmakefile.install +LDIRT = help.pag help.dir + +LLDFLAGS = $(PCP_LIBS) +LLDLIBS = $(PCP_PMDALIB) + +default default_pcp setup: $(TARGETS) + +$(LIBTARGET): bigun.o + +install install_pcp: + $(INSTALL) -m 755 -d $(TESTDIR) + $(INSTALL) -m 644 $(CFILES) $(MYFILES) $(TESTDIR) + $(INSTALL) -m 755 $(MYSCRIPTS) $(TARGETS) $(TESTDIR) + $(INSTALL) -m 644 GNUmakefile.install $(TESTDIR)/GNUmakefile + +include $(BUILDRULES) diff --git a/qa/pmdas/bigun/GNUmakefile.install b/qa/pmdas/bigun/GNUmakefile.install new file mode 100644 index 0000000..bc8f87e --- /dev/null +++ b/qa/pmdas/bigun/GNUmakefile.install @@ -0,0 +1,43 @@ +#!gmake +# +# Copyright (c) 2011 Ken McDonell. All Rights Reserved. +# + +SHELL = sh + +ifdef PCP_CONF +include $(PCP_CONF) +else +include $(PCP_DIR)/etc/pcp.conf +endif +include $(PCP_INC_DIR)/builddefs + +# remove -Lpath and -Ipath options from builddefs CFLAGS value +# +PCP_LIBS = +TMP := $(CFLAGS:-I%=) +ifdef PCP_DIR +# put -Ipath and -Lpath back but use paths for run-time environment +# +CFLAGS = $(TMP) -I$(PCP_INC_DIR)/.. +LDFLAGS = -L$(PCP_LIB_DIR) +else +CFLAGS = $(TMP) +endif + +CFILES = bigun.c +LIBTARGET = bigun.$(DSOSUFFIX) +TARGETS = $(LIBTARGET) +MYFILES = domain.h help pmns root +MYSCRIPTS = Install Remove +LDIRT = help.pag help.dir + +LLDLIBS = -lpcp_pmda -lpcp $(LIB_FOR_MATH) $(LIB_FOR_DLOPEN) $(LIB_FOR_PTHREADS) + +default default_pcp setup: $(TARGETS) + +$(LIBTARGET): bigun.o + +install install_pcp: + +include $(PCP_INC_DIR)/buildrules diff --git a/qa/pmdas/bigun/Install b/qa/pmdas/bigun/Install new file mode 100755 index 0000000..4845424 --- /dev/null +++ b/qa/pmdas/bigun/Install @@ -0,0 +1,24 @@ +#! /bin/sh + +. $PCP_DIR/etc/pcp.env +. $PCP_SHARE_DIR/lib/pmdaproc.sh + +if [ -f GNUmakefile.install ] +then + # running within the source tree, not in the 'testsuite' directory + # + PCP_MAKE_PROG="$PCP_MAKE_PROG -f GNUmakefile.install" +fi + +# Make sure DSO PMDA exists +make + +iam=bigun +pmda_interface=4 +dso_opt=true +dso_name=`pwd`/bigun.${dso_suffix} +daemon_opt=false + +pmdaSetup +pmdaInstall +exit 0 diff --git a/qa/pmdas/bigun/Remove b/qa/pmdas/bigun/Remove new file mode 100755 index 0000000..1061fd5 --- /dev/null +++ b/qa/pmdas/bigun/Remove @@ -0,0 +1,11 @@ +#! /bin/sh + +. $PCP_DIR/etc/pcp.env +. $PCP_SHARE_DIR/lib/pmdaproc.sh + +iam=bigun + +pmdaSetup +pmdaRemove + +exit 0 diff --git a/qa/pmdas/bigun/bigun.c b/qa/pmdas/bigun/bigun.c new file mode 100644 index 0000000..735d952 --- /dev/null +++ b/qa/pmdas/bigun/bigun.c @@ -0,0 +1,71 @@ +/* + * bigun PMDA ... one big value for QA + * + * Copyright (c) 2011 Ken McDonell. All Rights Reserved. + * + */ + +#include <pcp/pmapi.h> +#include <pcp/impl.h> +#include <pcp/pmda.h> + +static pmdaMetric metrics[] = { + { NULL, + { PMDA_PMID(0,0), PM_TYPE_AGGREGATE_STATIC, PM_INDOM_NULL, PM_SEM_DISCRETE, + PMDA_PMUNITS(0, 0, 0, 0, 0, 0) } } +}; + +#define MYSIZE (1024*1024) +static pmValueBlock *vbp; + +/* + * callback provided to pmdaFetch + */ +static int +bigun_fetchCallBack(pmdaMetric *mdesc, unsigned int inst, pmAtomValue *atom) +{ + if (pmid_cluster(mdesc->m_desc.pmid) != 0 || + pmid_item(mdesc->m_desc.pmid) != 0) + return PM_ERR_PMID; + if (inst != PM_IN_NULL) + return PM_ERR_INST; + + atom->vbp = vbp; + return 1; +} + +/* Initialise the DSO agent */ +void +bigun_init(pmdaInterface *dp) +{ + int i; + int sep = __pmPathSeparator(); + char helppath[MAXPATHLEN]; + + /* + * Note: helpfile is only available if the PMDA has been installed + * from $PCP_VAR_DIR/testsuite/pmdas/bigun ... when the PMDA install + * comes from QA run from some other directory, the helpfile may not + * be found ... fortunately nothing in QA depends on the helpfile + * being available for the bigun PMDA. + */ + snprintf(helppath, sizeof(helppath), + "%s%c" "testsuite" "%c" "pmdas" "%c" "bigun" "%c" "help", + pmGetConfig("PCP_VAR_DIR"), sep, sep, sep, sep); + pmdaDSO(dp, PMDA_INTERFACE_4, "bigun DSO", helppath); + if (dp->status != 0) + return; + + pmdaSetFetchCallBack(dp, bigun_fetchCallBack); + pmdaInit(dp, NULL, 0, metrics, sizeof(metrics)/sizeof(metrics[0])); + + vbp = (pmValueBlock *)malloc(PM_VAL_HDR_SIZE+MYSIZE); + if (vbp == NULL) { + fprintf(stderr, "bigun_init: malloc failed: %s\n", pmErrStr(-errno)); + exit(1); + } + vbp->vtype = PM_TYPE_AGGREGATE_STATIC; + vbp->vlen = PM_VAL_HDR_SIZE+MYSIZE; + for (i = 0; i < MYSIZE; i += sizeof(int)) + memcpy((void *)&vbp->vbuf[i], (void *)&i, sizeof(int)); +} diff --git a/qa/pmdas/bigun/domain.h b/qa/pmdas/bigun/domain.h new file mode 100644 index 0000000..6f108f2 --- /dev/null +++ b/qa/pmdas/bigun/domain.h @@ -0,0 +1,2 @@ +/* reuse the QA BROKEN domain id */ +#define BIGUN 249 diff --git a/qa/pmdas/bigun/help b/qa/pmdas/bigun/help new file mode 100644 index 0000000..70fd765 --- /dev/null +++ b/qa/pmdas/bigun/help @@ -0,0 +1 @@ +@ bigun.sumo one big value diff --git a/qa/pmdas/bigun/pmns b/qa/pmdas/bigun/pmns new file mode 100644 index 0000000..8d52234 --- /dev/null +++ b/qa/pmdas/bigun/pmns @@ -0,0 +1,4 @@ +bigun { + sumo 249:0:0 +} + diff --git a/qa/pmdas/bigun/root b/qa/pmdas/bigun/root new file mode 100644 index 0000000..80ad70e --- /dev/null +++ b/qa/pmdas/bigun/root @@ -0,0 +1,5 @@ +root { + bigun +} + +#include "pmns" |