Exemple #1
0
static void
myeventdump(pmValueSet *vsp, int inst, int highres)
{
    int		r;		/* event records */
    int		p;		/* event parameters */
    int		nrecords;
    int		flags;

    if (highres) {
        pmHighResResult	**hr;

        if ((nrecords = pmUnpackHighResEventRecords(vsp, inst, &hr)) < 0) {
            fprintf(stderr, "pmUnpackHighResEventRecords: %s\n",
                    pmErrStr(nrecords));
            return;
        }
        setup_event_derived_metrics();
        for (r = 0; r < nrecords; r++) {
            printf("    --- event record [%d] timestamp ", r);
            __pmPrintHighResStamp(stdout, &hr[r]->timestamp);
            if (dump_nparams(hr[r]->numpmid) < 0)
                continue;
            flags = 0;
            for (p = 0; p < hr[r]->numpmid; p++)
                dump_parameter(hr[r]->vset[p], p, &flags);
        }
        pmFreeHighResEventResult(hr);
    }
    else {
        pmResult	**res;

        if ((nrecords = pmUnpackEventRecords(vsp, inst, &res)) < 0) {
            fprintf(stderr, "pmUnpackEventRecords: %s\n", pmErrStr(nrecords));
            return;
        }
        setup_event_derived_metrics();
        for (r = 0; r < nrecords; r++) {
            printf("    --- event record [%d] timestamp ", r);
            __pmPrintStamp(stdout, &res[r]->timestamp);
            if (dump_nparams(res[r]->numpmid) < 0)
                continue;
            flags = 0;
            for (p = 0; p < res[r]->numpmid; p++)
                dump_parameter(res[r]->vset[p], p, &flags);
        }
        pmFreeEventResult(res);
    }
}
Exemple #2
0
static unsigned char *
dump_body(BODY * c, unsigned char *d, int *off, int convert)
{
  BODY nb;

  memcpy (&nb, c, sizeof (BODY));

  /* some fields are not safe to cache */
  nb.content = NULL;
  nb.charset = NULL;
  nb.next = NULL;
  nb.parts = NULL;
  nb.hdr = NULL;
  nb.aptr = NULL;

  lazy_realloc(&d, *off + sizeof (BODY));
  memcpy(d + *off, &nb, sizeof (BODY));
  *off += sizeof (BODY);

  d = dump_char(nb.xtype, d, off, 0);
  d = dump_char(nb.subtype, d, off, 0);

  d = dump_parameter(nb.parameter, d, off, convert);

  d = dump_char(nb.description, d, off, convert);
  d = dump_char(nb.form_name, d, off, convert);
  d = dump_char(nb.filename, d, off, convert);
  d = dump_char(nb.d_filename, d, off, convert);

  return d;
}
Exemple #3
0
void
dump_param_list(ParameterList * p, int level)
{
    struct parameter *q;

    for (q = p->first; q != 0; q = q->next) {
	dump_parameter(q, level);
    }
}
Exemple #4
0
		parameter_error_t(const state_t &state, std::string && msg)
			: state_(state)
			, msg_(std::move(msg))
		{
			std::ostringstream os;
			os << std::endl << "lua parameter:" << std::endl;

			dump_parameter(state_, os);

			msg_ += os.str();
		}
	inline bool check_stack(state_t &state, std::int32_t offset, std::true_type)
	{
		int n = ::lua_gettop(state) - offset;
		if( n != N )
		{
			dump_parameter(state, std::cerr);
			
			parameter_error_t error(state, "expect parameter count error ");
			error.dump(std::cerr);
			assert(!"lua stack parameter error");

			throw error;

			return false;
		}

		return true;
	}
Exemple #6
0
static void
dump_event(int numnames, char **names, pmValueSet *vsp, int index, int indom, int type)
{
    int		r;		/* event records */
    int		p;		/* event parameters */
    int		flags;
    int		nrecords;
    int		nmissed = 0;
    int		highres = (type == PM_TYPE_HIGHRES_EVENT);
    char	*iname;
    pmValue	*vp = &vsp->vlist[index];

    if (index > 0)
	printf("            ");
    printf("  %s (", pmIDStr(vsp->pmid));
    __pmPrintMetricNames(stdout, numnames, names, " or ");
    if (indom != PM_INDOM_NULL) {
	putchar('[');
	if (pmNameInDom(indom, vp->inst, &iname) < 0)
	    printf("%d or ???])", vp->inst);
	else {
	    printf("%d or \"%s\"])", vp->inst, iname);
	    free(iname);
	}
    }
    else {
	printf(")");
    }
    printf(": ");

    if (highres) {
	pmHighResResult	**hr;

	if ((nrecords = pmUnpackHighResEventRecords(vsp, index, &hr)) < 0)
	    return;
	if (nrecords == 0) {
	    printf("No event records\n");
	    pmFreeHighResEventResult(hr);
	    return;
	}
	setup_event_derived_metrics();

	for (r = 0; r < nrecords; r++) {
	    if (hr[r]->numpmid == 2 && hr[r]->vset[0]->pmid == pmid_flags &&
		(hr[r]->vset[0]->vlist[0].value.lval & PM_EVENT_FLAG_MISSED) &&
		hr[r]->vset[1]->pmid == pmid_missed) {
		nmissed += hr[r]->vset[1]->vlist[0].value.lval;
	    }
	}
	dump_nrecords(nrecords, nmissed);

	for (r = 0; r < nrecords; r++) {
	    printf("              --- event record [%d] timestamp ", r);
	    __pmPrintHighResStamp(stdout, &hr[r]->timestamp);
	    if (dump_nparams(hr[r]->numpmid) < 0)
		continue;
	    flags = 0;
	    for (p = 0; p < hr[r]->numpmid; p++)
		dump_parameter(hr[r]->vset[p], p, &flags);
	}
	pmFreeHighResEventResult(hr);
    }
    else {
	pmResult	**res;

	if ((nrecords = pmUnpackEventRecords(vsp, index, &res)) < 0)
	    return;
	if (nrecords == 0) {
	    printf("No event records\n");
	    pmFreeEventResult(res);
	    return;
	}
	setup_event_derived_metrics();

	for (r = 0; r < nrecords; r++) {
	    if (res[r]->numpmid == 2 && res[r]->vset[0]->pmid == pmid_flags &&
		(res[r]->vset[0]->vlist[0].value.lval & PM_EVENT_FLAG_MISSED) &&
		res[r]->vset[1]->pmid == pmid_missed) {
		nmissed += res[r]->vset[1]->vlist[0].value.lval;
	    }
	}
	dump_nrecords(nrecords, nmissed);

	for (r = 0; r < nrecords; r++) {
	    printf("              --- event record [%d] timestamp ", r);
	    __pmPrintStamp(stdout, &res[r]->timestamp);
	    if (dump_nparams(res[r]->numpmid) < 0)
		continue;
	    flags = 0;
	    for (p = 0; p < res[r]->numpmid; p++)
		dump_parameter(res[r]->vset[p], p, &flags);
	}
	pmFreeEventResult(res);
    }
}