diff options
Diffstat (limited to 'tests/manual/perf2text/perf2text.cpp')
-rw-r--r-- | tests/manual/perf2text/perf2text.cpp | 45 |
1 files changed, 4 insertions, 41 deletions
diff --git a/tests/manual/perf2text/perf2text.cpp b/tests/manual/perf2text/perf2text.cpp index e57082f..d77f518 100644 --- a/tests/manual/perf2text/perf2text.cpp +++ b/tests/manual/perf2text/perf2text.cpp @@ -39,7 +39,6 @@ int main(int argc, char **argv) args.removeFirst(); QProcess process; - PerfParserTestClient client; process.setProcessChannelMode(QProcess::ForwardedErrorChannel); QObject::connect(&process, &QProcess::errorOccurred, &app, [&process](QProcess::ProcessError error) { qWarning() << "perfparser process error:" << error << process.errorString(); @@ -53,47 +52,11 @@ int main(int argc, char **argv) if (!process.waitForStarted() || !process.waitForFinished()) return 1; - client.extractTrace(&process); - QTextStream out(stdout); - for (const auto &sample : client.samples()) { - out << client.string(client.command(sample.pid).name) << '\t' - << sample.pid << '\t' << sample.tid << '\t' - << sample.time / 1000000000 << '.' << qSetFieldWidth(9) << qSetPadChar(QLatin1Char('0')) - << sample.time % 1000000000 << qSetFieldWidth(0) << qSetPadChar(QLatin1Char(' ')) << '\n'; - for (const auto &value : sample.values) { - const auto attribute = client.attribute(value.first); - const auto cost = attribute.usesFrequency ? value.second : attribute.frequencyOrPeriod; - out << '\t' << client.string(attribute.name) << ": "; - if (attribute.type == 2) { - const auto format = client.tracePointFormat(static_cast<qint32>(attribute.config)); - out << client.string(format.system) << ' ' << client.string(format.name) << ' ' << hex << format.flags << dec << '\n'; - for (auto it = sample.tracePointData.begin(); it != sample.tracePointData.end(); ++it) { - out << "\t\t" << client.string(it.key()) << '=' << it.value().toString() << '\n'; - } - } else { - out << cost << '\n'; - } - } - out << '\n'; - auto printFrame = [&out, &client](qint32 locationId) -> qint32 { - const auto location = client.location(locationId); - out << '\t' << hex << location.address << dec; - const auto symbol = client.symbol(locationId); - if (location.file != -1) - out << '\t' << client.string(location.file) << ':' << location.line << ':' << location.column; - if (symbol.path != -1) - out << '\t' << client.string(symbol.name) << ' ' << client.string(symbol.binary) << ' ' << client.string(symbol.path) << ' ' << (symbol.isKernel ? "[kernel]" : ""); - out << '\n'; - return location.parentLocationId; - }; - for (const auto &frame : sample.frames) { - auto locationId = printFrame(frame); - while (locationId != -1) - locationId = printFrame(locationId); - } - out << '\n'; - } + + PerfParserTestClient client; + client.extractTrace(&process); + client.convertToText(out); return 0; } |