@@ -91,9 +91,9 @@ RecordType selectedRecordType(const QScopedPointer<Ui::RecordPage>& ui)
9191 return ui->recordTypeComboBox ->currentData ().value <RecordType>();
9292}
9393
94- void updateStartRecordingButtonState (const QScopedPointer<Ui::RecordPage>& ui)
94+ void updateStartRecordingButtonState (PerfRecord* record, const QScopedPointer<Ui::RecordPage>& ui)
9595{
96- if (!PerfRecord:: isPerfInstalled ()) {
96+ if (!record-> isPerfInstalled ()) {
9797 ui->startRecordingButton ->setEnabled (false );
9898 ui->applicationRecordErrorMessage ->setText (QObject::tr (" Please install perf before trying to record." ));
9999 ui->applicationRecordErrorMessage ->setVisible (true );
@@ -380,7 +380,7 @@ RecordPage::RecordPage(QWidget* parent)
380380 ui->processesTableView ->setSelectionBehavior (QAbstractItemView::SelectRows);
381381 ui->processesTableView ->setSelectionMode (QAbstractItemView::MultiSelection);
382382 connect (ui->processesTableView ->selectionModel (), &QItemSelectionModel::selectionChanged, this ,
383- [this ]() { updateStartRecordingButtonState (ui); });
383+ [this ]() { updateStartRecordingButtonState (m_perfRecord, ui); });
384384
385385 ResultsUtil::connectFilter (ui->processesFilterBox , m_processProxyModel);
386386
@@ -406,7 +406,7 @@ RecordPage::RecordPage(QWidget* parent)
406406 ui->sampleCpuCheckBox ->setChecked (config ().readEntry (QStringLiteral (" sampleCpu" ), true ));
407407 ui->mmapPagesSpinBox ->setValue (config ().readEntry (QStringLiteral (" mmapPages" ), 0 ));
408408 ui->mmapPagesUnitComboBox ->setCurrentIndex (config ().readEntry (QStringLiteral (" mmapPagesUnit" ), 2 ));
409- ui->useAioCheckBox ->setChecked (config ().readEntry (QStringLiteral (" useAio" ), PerfRecord:: canUseAio ()));
409+ ui->useAioCheckBox ->setChecked (config ().readEntry (QStringLiteral (" useAio" ), m_perfRecord-> canUseAio ()));
410410
411411 const auto callGraph = config ().readEntry (" callGraph" , ui->callGraphComboBox ->currentData ());
412412 const auto callGraphIdx = ui->callGraphComboBox ->findData (callGraph);
@@ -438,19 +438,19 @@ RecordPage::RecordPage(QWidget* parent)
438438 }
439439 });
440440
441- if (!PerfRecord:: canSampleCpu ()) {
441+ if (!m_perfRecord-> canSampleCpu ()) {
442442 ui->sampleCpuCheckBox ->hide ();
443443 ui->sampleCpuLabel ->hide ();
444444 }
445- if (!PerfRecord:: canSwitchEvents ()) {
445+ if (!m_perfRecord-> canSwitchEvents ()) {
446446 ui->offCpuCheckBox ->hide ();
447447 ui->offCpuLabel ->hide ();
448448 }
449- if (!PerfRecord:: canUseAio ()) {
449+ if (!m_perfRecord-> canUseAio ()) {
450450 ui->useAioCheckBox ->hide ();
451451 ui->useAioLabel ->hide ();
452452 }
453- if (!PerfRecord:: canCompress ()) {
453+ if (!m_perfRecord-> canCompress ()) {
454454 ui->compressionComboBox ->hide ();
455455 ui->compressionLabel ->hide ();
456456 } else {
@@ -523,24 +523,24 @@ void RecordPage::onStartRecordingButtonClicked(bool checked)
523523 perfOptions += KShell::splitArgs (customOptions);
524524
525525 const bool offCpuProfilingEnabled = ui->offCpuCheckBox ->isChecked ();
526- if (offCpuProfilingEnabled && PerfRecord:: canSwitchEvents ()) {
526+ if (offCpuProfilingEnabled && m_perfRecord-> canSwitchEvents ()) {
527527 if (eventType.isEmpty ()) {
528528 // TODO: use clock event in VM context
529529 perfOptions += QStringLiteral (" --event" );
530530 perfOptions += QStringLiteral (" cycles" );
531531 }
532- perfOptions += PerfRecord:: offCpuProfilingOptions ();
532+ perfOptions += m_perfRecord-> offCpuProfilingOptions ();
533533 }
534534 config ().writeEntry (QStringLiteral (" offCpuProfiling" ), offCpuProfilingEnabled);
535535
536536 const bool useAioEnabled = ui->useAioCheckBox ->isChecked ();
537- if (useAioEnabled && PerfRecord:: canUseAio ()) {
537+ if (useAioEnabled && m_perfRecord-> canUseAio ()) {
538538 perfOptions += QStringLiteral (" --aio" );
539539 }
540540 config ().writeEntry (QStringLiteral (" useAio" ), useAioEnabled);
541541
542542 const auto compressionLevel = ui->compressionComboBox ->currentData ().toInt ();
543- if (PerfRecord:: canCompress () && compressionLevel >= 0 ) {
543+ if (m_perfRecord-> canCompress () && compressionLevel >= 0 ) {
544544 if (compressionLevel == 0 )
545545 perfOptions += QStringLiteral (" -z" );
546546 else
@@ -551,7 +551,7 @@ void RecordPage::onStartRecordingButtonClicked(bool checked)
551551 const bool elevatePrivileges = ui->elevatePrivilegesCheckBox ->isChecked ();
552552
553553 const bool sampleCpuEnabled = ui->sampleCpuCheckBox ->isChecked ();
554- if (sampleCpuEnabled && PerfRecord:: canSampleCpu ()) {
554+ if (sampleCpuEnabled && m_perfRecord-> canSampleCpu ()) {
555555 perfOptions += QStringLiteral (" --sample-cpu" );
556556 }
557557
@@ -672,7 +672,7 @@ void RecordPage::onApplicationNameChanged(const QString& filePath)
672672
673673 m_multiConfig->setConfig (applicationConfig (ui->applicationName ->text ()));
674674 }
675- updateStartRecordingButtonState (ui);
675+ updateStartRecordingButtonState (m_perfRecord, ui);
676676}
677677
678678void RecordPage::onWorkingDirectoryNameChanged (const QString& folderPath)
@@ -688,7 +688,7 @@ void RecordPage::onWorkingDirectoryNameChanged(const QString& folderPath)
688688 } else {
689689 setError ({});
690690 }
691- updateStartRecordingButtonState (ui);
691+ updateStartRecordingButtonState (m_perfRecord, ui);
692692}
693693
694694void RecordPage::onViewPerfRecordResultsButtonClicked ()
@@ -714,7 +714,7 @@ void RecordPage::onOutputFileNameChanged(const QString& /*filePath*/)
714714 } else {
715715 setError ({});
716716 }
717- updateStartRecordingButtonState (ui);
717+ updateStartRecordingButtonState (m_perfRecord, ui);
718718}
719719
720720void RecordPage::onOutputFileNameSelected (const QString& filePath)
@@ -746,7 +746,7 @@ void RecordPage::updateProcessesFinished()
746746
747747 if (selectedRecordType (ui) == AttachToProcess) {
748748 // only update the state when we show the attach app page
749- updateStartRecordingButtonState (ui);
749+ updateStartRecordingButtonState (m_perfRecord, ui);
750750 QTimer::singleShot (1000 , this , &RecordPage::updateProcesses);
751751 }
752752}
@@ -773,23 +773,23 @@ void RecordPage::updateRecordType()
773773 m_perfOutput->setInputVisible (recordType == LaunchApplication);
774774 m_perfOutput->clear ();
775775 ui->elevatePrivilegesCheckBox ->setEnabled (recordType != ProfileSystem);
776- ui->sampleCpuCheckBox ->setEnabled (recordType != ProfileSystem && PerfRecord:: canSampleCpu ());
776+ ui->sampleCpuCheckBox ->setEnabled (recordType != ProfileSystem && m_perfRecord-> canSampleCpu ());
777777 if (recordType == ProfileSystem) {
778778 ui->elevatePrivilegesCheckBox ->setChecked (true );
779- ui->sampleCpuCheckBox ->setChecked (true && PerfRecord:: canSampleCpu ());
779+ ui->sampleCpuCheckBox ->setChecked (true && m_perfRecord-> canSampleCpu ());
780780 }
781781
782782 if (recordType == AttachToProcess) {
783783 updateProcesses ();
784784 }
785785
786- updateStartRecordingButtonState (ui);
786+ updateStartRecordingButtonState (m_perfRecord, ui);
787787}
788788
789789void RecordPage::updateOffCpuCheckboxState ()
790790{
791791 const bool enableOffCpuProfiling =
792- (ui->elevatePrivilegesCheckBox ->isChecked () || PerfRecord:: canProfileOffCpu ()) && PerfRecord:: canSwitchEvents ();
792+ (ui->elevatePrivilegesCheckBox ->isChecked () || m_perfRecord-> canProfileOffCpu ()) && m_perfRecord-> canSwitchEvents ();
793793
794794 if (enableOffCpuProfiling == ui->offCpuCheckBox ->isEnabled ()) {
795795 return ;
0 commit comments