void QmcMetric::dumpEventMetric(QTextStream &os, bool srcFlag, uint instance) const { Q_ASSERT(event()); for (int i = 0; i < my.values.size(); i++) { int instID; if (srcFlag == true) dumpSource(os); os << name(); instID = PM_IN_NULL; if (hasInstances()) { if (instance != UINT_MAX) instID = (int)instance; else instID = my.values[i].instance(); QString inst = instName(instID); if (inst == QString::null) os << "[" << instID << "]"; else os << "[\"" << inst << "\"]"; } os << ": "; my.values[i].dumpEventRecords(os, instID); } }
void QmcMetric::dumpSampledMetric(QTextStream &stream, bool srcFlag, uint instance) const { Q_ASSERT(!event()); stream << name(); if (srcFlag == true) dumpSource(stream); if (my.status < 0) stream << ": " << pmErrStr(my.status) << endl; else if (hasInstances()) { if (instance == UINT_MAX) { if (numInst() == 1) stream << ": 1 instance"; else stream << ": " << numInst() << " instances"; if (indom()->changed()) stream << " (indom has changed)"; stream << endl; for (int i = 0; i < numInst(); i++) { stream << " [" << instID(i) << " or \"" << instName(i) << "\" (" << my.values[i].instance() << ")] = "; dumpValue(stream, i); stream << endl; } } else { stream << '[' << instID(instance) << " or \"" << instName(instance) << "\" (" << my.values[instance].instance() << ")] = "; dumpValue(stream, instance); stream << endl; } } else { stream << " = "; dumpValue(stream, 0); stream << endl; } }
QString QmcMetric::spec(bool srcFlag, bool instFlag, uint instance) const { QString str; int i, len = 4; if (srcFlag) len += context()->source().source().size(); len += name().size(); if (hasInstances() && instFlag) { if (instance != UINT_MAX) len += instName(instance).size() + 2; else for (i = 0; i < numInst(); i++) len += instName(i).size() + 4; } if (srcFlag) { str.append(context()->source().source()); if (context()->source().type() == PM_CONTEXT_ARCHIVE) str.append(QChar('/')); else str.append(QChar(':')); } str.append(name()); if (hasInstances() && instFlag) { str.append(QChar('[')); str.append(QChar('\"')); if (instance != UINT_MAX) str.append(instName(instance)); else if (numInst()) { str.append(instName(0)); for (i = 1; i < numInst(); i++) { str.append("\", \""); str.append(instName(i)); } } str.append("\"]"); } return str; }
void CopyInstanceDialog::updateDialogState() { ui->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(!instName().isEmpty()); }