Valgrind: Clean up a bit after class merge

Change-Id: I1df02a93ebca318424461c3e48b9bb51133eec8d
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
This commit is contained in:
hjk
2022-05-31 13:43:14 +02:00
parent 72aa77ced7
commit 16aaf8c59c
2 changed files with 16 additions and 69 deletions

View File

@@ -62,18 +62,18 @@ CallgrindToolRunner::CallgrindToolRunner(RunControl *runControl)
connect(&m_parser, &Callgrind::Parser::parserDataReady,
this, &CallgrindToolRunner::slotFinished);
connect(&m_runner, &ValgrindRunner::valgrindStarted,
this, &CallgrindToolRunner::setValgrindPid);
connect(&m_runner, &ValgrindRunner::valgrindStarted, this, [this](qint64 pid) {
m_pid = pid;
});
connect(&m_runner, &ValgrindRunner::extraProcessFinished, this, [this] {
triggerParse();
});
setValgrindRunnable(runControl->runnable());
m_valgrindRunnable = runControl->runnable();
static int fileCount = 100;
m_valgrindOutputFile = runControl->workingDirectory() / QString("callgrind.out.f%1").arg(++fileCount);
setValgrindOutputFile(m_valgrindOutputFile);
setupCallgrindRunner(this);
}
@@ -125,11 +125,6 @@ void CallgrindToolRunner::start()
return ValgrindToolRunner::start();
}
void CallgrindToolRunner::dump()
{
run(Dump);
}
void CallgrindToolRunner::setPaused(bool paused)
{
if (m_markAsPaused == paused)
@@ -152,21 +147,6 @@ void CallgrindToolRunner::setToggleCollectFunction(const QString &toggleCollectF
m_argumentForToggleCollect = "--toggle-collect=" + toggleCollectFunction;
}
void CallgrindToolRunner::reset()
{
run(ResetEventCounters);
}
void CallgrindToolRunner::pause()
{
run(Pause);
}
void CallgrindToolRunner::unpause()
{
run(UnPause);
}
Callgrind::ParseData *CallgrindToolRunner::takeParserData()
{
return m_parser.takeData();
@@ -182,12 +162,6 @@ void CallgrindToolRunner::showStatusMessage(const QString &message)
Debugger::showPermanentStatusMessage(message);
}
void CallgrindToolRunner::triggerParse()
{
getLocalDataFile();
}
static QString toOptionString(CallgrindToolRunner::Option option)
{
/* callgrind_control help from v3.9.0
@@ -261,11 +235,6 @@ void CallgrindToolRunner::run(Option option)
m_controllerProcess->start();
}
void CallgrindToolRunner::setValgrindPid(qint64 pid)
{
m_pid = pid;
}
void CallgrindToolRunner::controllerProcessDone()
{
const QString error = m_controllerProcess->errorString();
@@ -286,36 +255,24 @@ void CallgrindToolRunner::controllerProcessDone()
run(Dump);
return;
case Pause:
m_paused = true;
break;
case Dump:
showStatusMessage(tr("Callgrind dumped profiling info"));
triggerParse();
break;
case UnPause:
m_paused = false;
showStatusMessage(tr("Callgrind unpaused."));
break;
default:
break;
}
switch (m_lastOption)
{
case Pause:
m_paused = true;
break;
case UnPause:
m_paused = false;
break;
case Dump:
triggerParse();
break;
default:
break; // do nothing
}
m_lastOption = Unknown;
}
void CallgrindToolRunner::getLocalDataFile()
void CallgrindToolRunner::triggerParse()
{
cleanupTempFile();
{
@@ -341,10 +298,5 @@ void CallgrindToolRunner::cleanupTempFile()
m_hostOutputFile.clear();
}
void CallgrindToolRunner::setValgrindRunnable(const Runnable &runnable)
{
m_valgrindRunnable = runnable;
}
} // Internal
} // Valgrind

View File

@@ -48,10 +48,10 @@ public:
Valgrind::Callgrind::ParseData *takeParserData();
/// controller actions
void dump();
void reset();
void pause();
void unpause();
void dump() { run(Dump); }
void reset() { run(ResetEventCounters); }
void pause() { run(Pause); }
void unpause() { run(UnPause); }
/// marks the callgrind process as paused
/// calls pause() and unpause() if there's an active run
@@ -80,21 +80,16 @@ private:
void slotFinished();
void showStatusMessage(const QString &message);
void triggerParse();
void controllerFinished(Option option);
void run(Option option);
/**
* Make data file available locally, triggers @c localParseDataAvailable.
*
* If the valgrind process was run remotely, this transparently
* downloads the data file first and returns a local path.
*/
void getLocalDataFile();
void setValgrindPid(qint64 pid);
void setValgrindRunnable(const ProjectExplorer::Runnable &runnable);
void setValgrindOutputFile(const Utils::FilePath &output) { m_valgrindOutputFile = output; }
void triggerParse();
void controllerFinished(Option option);
void run(Option option);
void cleanupTempFile();
void controllerProcessDone();