}
else if (strcasecmp (c->key, "CollectContextSwitch") == 0)
{
- if ((c->values_num != 1)
- || (c->values[0].type != OCONFIG_TYPE_BOOLEAN))
- {
- ERROR ("processes plugin: `CollectContextSwitch' needs exactly "
- "one boolean argument.");
- continue;
- }
- report_ctx_switch = c->values[0].value.boolean ? 1 : 0;
+ cf_util_get_boolean (c, &report_ctx_switch);
}
else
{
if ( report_ctx_switch )
{
- sstrncpy (vl.type, "ps_cswitch_vol", sizeof (vl.type));
+ sstrncpy (vl.type, "contextswitch", sizeof (vl.type));
+ sstrncpy (vl.type_instance, "voluntary", sizeof (vl.type_instance));
vl.values[0].derive = ps->cswitch_vol;
vl.values_len = 1;
plugin_dispatch_values (&vl);
- sstrncpy (vl.type, "ps_cswitch_invol", sizeof (vl.type));
+ sstrncpy (vl.type, "contextswitch", sizeof (vl.type));
+ sstrncpy (vl.type_instance, "involuntary", sizeof (vl.type_instance));
vl.values[0].derive = ps->cswitch_invol;
vl.values_len = 1;
plugin_dispatch_values (&vl);
char filename[64];
FILE *fh;
struct dirent *ent;
- unsigned long long cswitch_vol = 0;
- unsigned long long cswitch_invol = 0;
+ derive_t cswitch_vol = 0;
+ derive_t cswitch_invol = 0;
char buffer[1024];
char *fields[8];
int numfields;
while (fgets (buffer, sizeof(buffer), fh) != NULL)
{
- long long tmp;
+ derive_t tmp;
char *endptr;
if (strncmp (buffer, "voluntary_ctxt_switches", 23) != 0
errno = 0;
endptr = NULL;
- tmp = strtoll (fields[1], &endptr, /* base = */ 10);
+ tmp = (derive_t) strtoll (fields[1], &endptr, /* base = */ 10);
if ((errno == 0) && (endptr != fields[1]))
{
if (strncmp (buffer, "voluntary_ctxt_switches", 23) == 0)