| 41 | } |
| 42 | |
| 43 | void JProfiler::beginProfilingImpl(shared_qobject_ptr<LaunchTask> process) |
| 44 | { |
| 45 | listeningPort = globalSettings->get("JProfilerPort").toInt(); |
| 46 | QProcess* profiler = new QProcess(this); |
| 47 | QStringList profilerArgs = { "-d", QString::number(process->pid()), "--gui", "-p", QString::number(listeningPort) }; |
| 48 | auto basePath = globalSettings->get("JProfilerPath").toString(); |
| 49 | |
| 50 | #ifdef Q_OS_WIN |
| 51 | QString profilerProgram = QDir(basePath).absoluteFilePath("bin/jpenable.exe"); |
| 52 | #else |
| 53 | QString profilerProgram = QDir(basePath).absoluteFilePath("bin/jpenable"); |
| 54 | #endif |
| 55 | |
| 56 | profiler->setArguments(profilerArgs); |
| 57 | profiler->setProgram(profilerProgram); |
| 58 | |
| 59 | connect(profiler, &QProcess::started, this, &JProfiler::profilerStarted); |
| 60 | connect(profiler, QOverload<int, QProcess::ExitStatus>::of(&QProcess::finished), this, &JProfiler::profilerFinished); |
| 61 | |
| 62 | m_profilerProcess = profiler; |
| 63 | profiler->start(); |
| 64 | } |
| 65 | |
| 66 | void JProfilerFactory::registerSettings(SettingsObjectPtr settings) |
| 67 | { |