| 48 | } |
| 49 | |
| 50 | void JProfiler::beginProfilingImpl(shared_qobject_ptr<LaunchTask> process) |
| 51 | { |
| 52 | listeningPort = globalSettings->get("JProfilerPort").toInt(); |
| 53 | QProcess *profiler = new QProcess(this); |
| 54 | QStringList profilerArgs = |
| 55 | { |
| 56 | "-d", QString::number(process->pid()), |
| 57 | "--gui", |
| 58 | "-p", QString::number(listeningPort) |
| 59 | }; |
| 60 | auto basePath = globalSettings->get("JProfilerPath").toString(); |
| 61 | |
| 62 | #ifdef Q_OS_WIN |
| 63 | QString profilerProgram = QDir(basePath).absoluteFilePath("bin/jpenable.exe"); |
| 64 | #else |
| 65 | QString profilerProgram = QDir(basePath).absoluteFilePath("bin/jpenable"); |
| 66 | #endif |
| 67 | |
| 68 | profiler->setArguments(profilerArgs); |
| 69 | profiler->setProgram(profilerProgram); |
| 70 | |
| 71 | connect(profiler, SIGNAL(started()), SLOT(profilerStarted())); |
| 72 | connect(profiler, SIGNAL(finished(int, QProcess::ExitStatus)), SLOT(profilerFinished(int,QProcess::ExitStatus))); |
| 73 | |
| 74 | m_profilerProcess = profiler; |
| 75 | profiler->start(); |
| 76 | } |
| 77 | |
| 78 | void JProfilerFactory::registerSettings(SettingsObjectPtr settings) |
| 79 | { |