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); } }
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); } }