@@ -73,9 +73,9 @@ RecordType selectedRecordType(const QScopedPointer<Ui::RecordPage>& ui)
7373 return ui->recordTypeComboBox ->currentData ().value <RecordType>();
7474}
7575
76- void updateStartRecordingButtonState (const QScopedPointer<Ui::RecordPage>& ui)
76+ void updateStartRecordingButtonState (PerfRecord* record, const QScopedPointer<Ui::RecordPage>& ui)
7777{
78- if (!PerfRecord:: isPerfInstalled ()) {
78+ if (!record-> isPerfInstalled ()) {
7979 ui->startRecordingButton ->setEnabled (false );
8080 ui->applicationRecordErrorMessage ->setText (QObject::tr (" Please install perf before trying to record." ));
8181 ui->applicationRecordErrorMessage ->setVisible (true );
@@ -362,7 +362,7 @@ RecordPage::RecordPage(QWidget* parent)
362362 ui->processesTableView ->setSelectionBehavior (QAbstractItemView::SelectRows);
363363 ui->processesTableView ->setSelectionMode (QAbstractItemView::MultiSelection);
364364 connect (ui->processesTableView ->selectionModel (), &QItemSelectionModel::selectionChanged, this ,
365- [this ]() { updateStartRecordingButtonState (ui); });
365+ [this ]() { updateStartRecordingButtonState (m_perfRecord, ui); });
366366
367367 ResultsUtil::connectFilter (ui->processesFilterBox , m_processProxyModel);
368368
@@ -388,7 +388,7 @@ RecordPage::RecordPage(QWidget* parent)
388388 ui->sampleCpuCheckBox ->setChecked (config ().readEntry (QStringLiteral (" sampleCpu" ), true ));
389389 ui->mmapPagesSpinBox ->setValue (config ().readEntry (QStringLiteral (" mmapPages" ), 0 ));
390390 ui->mmapPagesUnitComboBox ->setCurrentIndex (config ().readEntry (QStringLiteral (" mmapPagesUnit" ), 2 ));
391- ui->useAioCheckBox ->setChecked (config ().readEntry (QStringLiteral (" useAio" ), PerfRecord:: canUseAio ()));
391+ ui->useAioCheckBox ->setChecked (config ().readEntry (QStringLiteral (" useAio" ), m_perfRecord-> canUseAio ()));
392392
393393 const auto callGraph = config ().readEntry (" callGraph" , ui->callGraphComboBox ->currentData ());
394394 const auto callGraphIdx = ui->callGraphComboBox ->findData (callGraph);
@@ -420,19 +420,19 @@ RecordPage::RecordPage(QWidget* parent)
420420 }
421421 });
422422
423- if (!PerfRecord:: canSampleCpu ()) {
423+ if (!m_perfRecord-> canSampleCpu ()) {
424424 ui->sampleCpuCheckBox ->hide ();
425425 ui->sampleCpuLabel ->hide ();
426426 }
427- if (!PerfRecord:: canSwitchEvents ()) {
427+ if (!m_perfRecord-> canSwitchEvents ()) {
428428 ui->offCpuCheckBox ->hide ();
429429 ui->offCpuLabel ->hide ();
430430 }
431- if (!PerfRecord:: canUseAio ()) {
431+ if (!m_perfRecord-> canUseAio ()) {
432432 ui->useAioCheckBox ->hide ();
433433 ui->useAioLabel ->hide ();
434434 }
435- if (!PerfRecord:: canCompress ()) {
435+ if (!m_perfRecord-> canCompress ()) {
436436 ui->compressionComboBox ->hide ();
437437 ui->compressionLabel ->hide ();
438438 } else {
@@ -505,24 +505,24 @@ void RecordPage::onStartRecordingButtonClicked(bool checked)
505505 perfOptions += KShell::splitArgs (customOptions);
506506
507507 const bool offCpuProfilingEnabled = ui->offCpuCheckBox ->isChecked ();
508- if (offCpuProfilingEnabled && PerfRecord:: canSwitchEvents ()) {
508+ if (offCpuProfilingEnabled && m_perfRecord-> canSwitchEvents ()) {
509509 if (eventType.isEmpty ()) {
510510 // TODO: use clock event in VM context
511511 perfOptions += QStringLiteral (" --event" );
512512 perfOptions += QStringLiteral (" cycles" );
513513 }
514- perfOptions += PerfRecord:: offCpuProfilingOptions ();
514+ perfOptions += m_perfRecord-> offCpuProfilingOptions ();
515515 }
516516 config ().writeEntry (QStringLiteral (" offCpuProfiling" ), offCpuProfilingEnabled);
517517
518518 const bool useAioEnabled = ui->useAioCheckBox ->isChecked ();
519- if (useAioEnabled && PerfRecord:: canUseAio ()) {
519+ if (useAioEnabled && m_perfRecord-> canUseAio ()) {
520520 perfOptions += QStringLiteral (" --aio" );
521521 }
522522 config ().writeEntry (QStringLiteral (" useAio" ), useAioEnabled);
523523
524524 const auto compressionLevel = ui->compressionComboBox ->currentData ().toInt ();
525- if (PerfRecord:: canCompress () && compressionLevel >= 0 ) {
525+ if (m_perfRecord-> canCompress () && compressionLevel >= 0 ) {
526526 if (compressionLevel == 0 )
527527 perfOptions += QStringLiteral (" -z" );
528528 else
@@ -533,7 +533,7 @@ void RecordPage::onStartRecordingButtonClicked(bool checked)
533533 const bool elevatePrivileges = ui->elevatePrivilegesCheckBox ->isChecked ();
534534
535535 const bool sampleCpuEnabled = ui->sampleCpuCheckBox ->isChecked ();
536- if (sampleCpuEnabled && PerfRecord:: canSampleCpu ()) {
536+ if (sampleCpuEnabled && m_perfRecord-> canSampleCpu ()) {
537537 perfOptions += QStringLiteral (" --sample-cpu" );
538538 }
539539
@@ -654,7 +654,7 @@ void RecordPage::onApplicationNameChanged(const QString& filePath)
654654
655655 m_multiConfig->setConfig (applicationConfig (ui->applicationName ->text ()));
656656 }
657- updateStartRecordingButtonState (ui);
657+ updateStartRecordingButtonState (m_perfRecord, ui);
658658}
659659
660660void RecordPage::onWorkingDirectoryNameChanged (const QString& folderPath)
@@ -670,7 +670,7 @@ void RecordPage::onWorkingDirectoryNameChanged(const QString& folderPath)
670670 } else {
671671 setError ({});
672672 }
673- updateStartRecordingButtonState (ui);
673+ updateStartRecordingButtonState (m_perfRecord, ui);
674674}
675675
676676void RecordPage::onViewPerfRecordResultsButtonClicked ()
@@ -696,7 +696,7 @@ void RecordPage::onOutputFileNameChanged(const QString& /*filePath*/)
696696 } else {
697697 setError ({});
698698 }
699- updateStartRecordingButtonState (ui);
699+ updateStartRecordingButtonState (m_perfRecord, ui);
700700}
701701
702702void RecordPage::onOutputFileNameSelected (const QString& filePath)
@@ -728,7 +728,7 @@ void RecordPage::updateProcessesFinished()
728728
729729 if (selectedRecordType (ui) == AttachToProcess) {
730730 // only update the state when we show the attach app page
731- updateStartRecordingButtonState (ui);
731+ updateStartRecordingButtonState (m_perfRecord, ui);
732732 QTimer::singleShot (1000 , this , &RecordPage::updateProcesses);
733733 }
734734}
@@ -755,23 +755,23 @@ void RecordPage::updateRecordType()
755755 m_perfOutput->setInputVisible (recordType == LaunchApplication);
756756 m_perfOutput->clear ();
757757 ui->elevatePrivilegesCheckBox ->setEnabled (recordType != ProfileSystem);
758- ui->sampleCpuCheckBox ->setEnabled (recordType != ProfileSystem && PerfRecord:: canSampleCpu ());
758+ ui->sampleCpuCheckBox ->setEnabled (recordType != ProfileSystem && m_perfRecord-> canSampleCpu ());
759759 if (recordType == ProfileSystem) {
760760 ui->elevatePrivilegesCheckBox ->setChecked (true );
761- ui->sampleCpuCheckBox ->setChecked (true && PerfRecord:: canSampleCpu ());
761+ ui->sampleCpuCheckBox ->setChecked (true && m_perfRecord-> canSampleCpu ());
762762 }
763763
764764 if (recordType == AttachToProcess) {
765765 updateProcesses ();
766766 }
767767
768- updateStartRecordingButtonState (ui);
768+ updateStartRecordingButtonState (m_perfRecord, ui);
769769}
770770
771771void RecordPage::updateOffCpuCheckboxState ()
772772{
773773 const bool enableOffCpuProfiling =
774- (ui->elevatePrivilegesCheckBox ->isChecked () || PerfRecord:: canProfileOffCpu ()) && PerfRecord:: canSwitchEvents ();
774+ (ui->elevatePrivilegesCheckBox ->isChecked () || m_perfRecord-> canProfileOffCpu ()) && m_perfRecord-> canSwitchEvents ();
775775
776776 if (enableOffCpuProfiling == ui->offCpuCheckBox ->isEnabled ()) {
777777 return ;
0 commit comments