@@ -1319,13 +1319,22 @@ PerfParser::PerfParser(QObject* parent)
13191319 m_decompressed.reset ();
13201320 };
13211321
1322+ auto diffResults = [this ](const Data::BottomUpResults& first, const Data::BottomUpResults& second) {
1323+ m_bottomUpResults = Data::BottomUpResults::mergeBottomUpResults (first, second);
1324+ emit bottomUpDataAvailable (m_bottomUpResults);
1325+ emit topDownDataAvailable (Data::TopDownResults::fromBottomUp (m_bottomUpResults));
1326+ m_callerCalleeResults = {};
1327+ Data::callerCalleesFromBottomUpData (m_bottomUpResults, &m_callerCalleeResults);
1328+ emit callerCalleeDataAvailable (m_callerCalleeResults);
1329+ };
1330+
13221331 connect (this , &PerfParser::parsingFailed, this , parsingStopped);
13231332 connect (this , &PerfParser::parsingFinished, this , parsingStopped);
13241333}
13251334
13261335PerfParser::~PerfParser () = default ;
13271336
1328- void PerfParser::startParseFile (const QString& path)
1337+ void PerfParser::startParseFile (const QString& path, const QString& diffFile )
13291338{
13301339 Q_ASSERT (!m_isParsing);
13311340
@@ -1351,6 +1360,7 @@ void PerfParser::startParseFile(const QString& path)
13511360
13521361 auto parserArgs = [this ](const QString& filename) {
13531362 const auto settings = Settings::instance ();
1363+
13541364 QStringList parserArgs = {QStringLiteral (" --input" ), decompressIfNeeded (filename),
13551365 QStringLiteral (" --max-frames" ), QStringLiteral (" 1024" )};
13561366 const auto sysroot = settings->sysroot ();
@@ -1398,12 +1408,12 @@ void PerfParser::startParseFile(const QString& path)
13981408
13991409 emit parsingStarted ();
14001410 using namespace ThreadWeaver ;
1401- stream () << make_job ([path, parserBinary, parserArgs , env, this ]() {
1411+ stream () << make_job ([path, diffFile, parserBinary , env, this ]() {
14021412 PerfParserPrivate d;
14031413 connect (&d, &PerfParserPrivate::progress, this , &PerfParser::progress);
14041414 connect (this , &PerfParser::stopRequested, &d, &PerfParserPrivate::stop);
14051415
1406- auto finalize = [&d, this ]() {
1416+ auto finalize = [&d, diffFile, this ]() {
14071417 d.finalize ();
14081418 emit bottomUpDataAvailable (d.bottomUpResult );
14091419 emit topDownDataAvailable (d.topDownResult );
@@ -1443,55 +1453,55 @@ void PerfParser::startParseFile(const QString& path)
14431453
14441454 d.setInput (&process);
14451455
1456+ const auto exitCodeHandler = [finalize, this ](int exitCode, QProcess::ExitStatus exitStatus) {
1457+ if (m_stopRequested) {
1458+ emit parsingFailed (tr (" Parsing stopped." ));
1459+ return ;
1460+ }
1461+ qCDebug (LOG_PERFPARSER) << exitCode << exitStatus;
1462+
1463+ enum ErrorCodes
1464+ {
1465+ NoError,
1466+ TcpSocketError,
1467+ CannotOpen,
1468+ BadMagic,
1469+ HeaderError,
1470+ DataError,
1471+ MissingData,
1472+ InvalidOption
1473+ };
1474+ switch (exitCode) {
1475+ case NoError:
1476+ finalize ();
1477+ break ;
1478+ case TcpSocketError:
1479+ emit parsingFailed (
1480+ tr (" The hotspot-perfparser binary exited with code %1 (TCP socket error)." ).arg (exitCode));
1481+ break ;
1482+ case CannotOpen:
1483+ emit parsingFailed (
1484+ tr (" The hotspot-perfparser binary exited with code %1 (file could not be opened)." ).arg (exitCode));
1485+ break ;
1486+ case BadMagic:
1487+ case HeaderError:
1488+ case DataError:
1489+ case MissingData:
1490+ emit parsingFailed (
1491+ tr (" The hotspot-perfparser binary exited with code %1 (invalid perf data file)." ).arg (exitCode));
1492+ break ;
1493+ case InvalidOption:
1494+ emit parsingFailed (
1495+ tr (" The hotspot-perfparser binary exited with code %1 (invalid option)." ).arg (exitCode));
1496+ break ;
1497+ default :
1498+ emit parsingFailed (tr (" The hotspot-perfparser binary exited with code %1." ).arg (exitCode));
1499+ break ;
1500+ }
1501+ };
1502+
14461503 connect (&process, static_cast <void (QProcess::*)(int , QProcess::ExitStatus)>(&QProcess::finished), &process,
1447- [finalize, this ](int exitCode, QProcess::ExitStatus exitStatus) {
1448- if (m_stopRequested) {
1449- emit parsingFailed (tr (" Parsing stopped." ));
1450- return ;
1451- }
1452- qCDebug (LOG_PERFPARSER) << exitCode << exitStatus;
1453-
1454- enum ErrorCodes
1455- {
1456- NoError,
1457- TcpSocketError,
1458- CannotOpen,
1459- BadMagic,
1460- HeaderError,
1461- DataError,
1462- MissingData,
1463- InvalidOption
1464- };
1465- switch (exitCode) {
1466- case NoError:
1467- finalize ();
1468- break ;
1469- case TcpSocketError:
1470- emit parsingFailed (
1471- tr (" The hotspot-perfparser binary exited with code %1 (TCP socket error)." ).arg (exitCode));
1472- break ;
1473- case CannotOpen:
1474- emit parsingFailed (
1475- tr (" The hotspot-perfparser binary exited with code %1 (file could not be opened)." )
1476- .arg (exitCode));
1477- break ;
1478- case BadMagic:
1479- case HeaderError:
1480- case DataError:
1481- case MissingData:
1482- emit parsingFailed (
1483- tr (" The hotspot-perfparser binary exited with code %1 (invalid perf data file)." )
1484- .arg (exitCode));
1485- break ;
1486- case InvalidOption:
1487- emit parsingFailed (
1488- tr (" The hotspot-perfparser binary exited with code %1 (invalid option)." ).arg (exitCode));
1489- break ;
1490- default :
1491- emit parsingFailed (tr (" The hotspot-perfparser binary exited with code %1." ).arg (exitCode));
1492- break ;
1493- }
1494- });
1504+ exitCodeHandler);
14951505
14961506 connect (&process, &QProcess::errorOccurred, &process, [&d, &process, this ](QProcess::ProcessError error) {
14971507 if (m_stopRequested) {
@@ -1515,6 +1525,14 @@ void PerfParser::startParseFile(const QString& path)
15151525 &QEventLoop::quit);
15161526 loop.exec ();
15171527 });
1528+
1529+ if (diffFile.isEmpty ()) {
1530+ return ;
1531+ }
1532+
1533+ PerfParser otherData;
1534+
1535+ otherData.startParseFile (diffFile);
15181536}
15191537
15201538void PerfParser::filterResults (const Data::FilterAction& filter)
0 commit comments