@@ -142,6 +142,15 @@ AnalyzeDialog::AnalyzeDialog(QWidget *parent)
142
142
m_frame_count_layout->addWidget (m_frame_count_label);
143
143
m_frame_count_layout->addWidget (m_frame_count_box);
144
144
145
+ // Replay Warning
146
+ m_replay_warning_layout = new QHBoxLayout ();
147
+ m_replay_warning_label = new QLabel (tr (" WARNING: Initiating replay will clear any temporary "
148
+ " artifacts produced by previous replays. Please save "
149
+ " them manually in a different folder before proceeding, "
150
+ " if those artifacts are desired." ));
151
+ m_replay_warning_label->setWordWrap (true );
152
+ m_replay_warning_layout->addWidget (m_replay_warning_label);
153
+
145
154
// Left Panel Layout
146
155
m_left_panel_layout = new QVBoxLayout ();
147
156
m_left_panel_layout->addWidget (m_settings_list_label);
@@ -158,6 +167,7 @@ AnalyzeDialog::AnalyzeDialog(QWidget *parent)
158
167
m_right_panel_layout->addLayout (m_dump_pm4_layout);
159
168
m_right_panel_layout->addLayout (m_gpu_time_layout);
160
169
m_right_panel_layout->addLayout (m_frame_count_layout);
170
+ m_right_panel_layout->addLayout (m_replay_warning_layout);
161
171
m_right_panel_layout->addLayout (m_button_layout);
162
172
163
173
// Main Layout
@@ -550,34 +560,17 @@ void AnalyzeDialog::SetReplayButton(const std::string &message, bool is_enabled)
550
560
QApplication::processEvents ();
551
561
}
552
562
553
- void AnalyzeDialog::UpdatePerfTabView (const std::string remote_file_name)
554
- {
555
- QString directory = m_capture_file_directory.value ().c_str ();
556
-
557
- // Get the original filename from the remote path
558
- QFileInfo original_file_info (QString::fromStdString (remote_file_name));
559
- QString file_name = original_file_info.completeBaseName () + Dive::kProfilingMetricsCsvSuffix ;
560
-
561
- // Construct the new full path.
562
- QString full_path = QDir (directory).filePath (file_name);
563
- std::string output_path = full_path.toStdString ();
564
-
565
- emit OnDisplayPerfCounterResults (output_path.c_str ());
566
- }
567
-
568
- void AnalyzeDialog::UpdateGpuTimingTabView (const std::string remote_file_name)
563
+ std::filesystem::path AnalyzeDialog::GetFullLocalPath (const std::string &gfxr_stem,
564
+ const std::string &suffix) const
569
565
{
570
- QString directory = m_capture_file_directory.value ().c_str ();
571
-
572
- // Get the original filename from the original remote path
573
- QFileInfo original_file_info (QString::fromStdString (remote_file_name));
574
- QString file_name = original_file_info.completeBaseName () + Dive::kGpuTimingCsvSuffix ;
575
-
576
- // Construct the new full path.
577
- QString full_path = QDir (directory).filePath (file_name);
578
- std::string output_path = full_path.toStdString ();
566
+ if (!m_local_capture_file_directory.ok ())
567
+ {
568
+ return " " ;
569
+ }
579
570
580
- emit OnDisplayGpuTimingResults (output_path.c_str ());
571
+ std::filesystem::path full_path = m_local_capture_file_directory.value ();
572
+ full_path /= (gfxr_stem + suffix);
573
+ return full_path;
581
574
}
582
575
583
576
// --------------------------------------------------------------------------------------------------
@@ -599,7 +592,7 @@ absl::Status AnalyzeDialog::Pm4Replay(Dive::DeviceManager &device_manager,
599
592
return device_manager.RunReplayApk (remote_gfxr_file,
600
593
replay_args,
601
594
m_dump_pm4_enabled,
602
- m_capture_file_directory .value ());
595
+ m_local_capture_file_directory .value ());
603
596
}
604
597
605
598
// --------------------------------------------------------------------------------------------------
@@ -610,7 +603,7 @@ absl::Status AnalyzeDialog::PerfCounterReplay(Dive::DeviceManager &device_manage
610
603
611
604
return device_manager.RunProfilingOnReplay (remote_gfxr_file,
612
605
*m_enabled_settings_vector,
613
- m_capture_file_directory .value ());
606
+ m_local_capture_file_directory .value ());
614
607
}
615
608
616
609
// --------------------------------------------------------------------------------------------------
@@ -624,7 +617,7 @@ absl::Status AnalyzeDialog::GpuTimeReplay(Dive::DeviceManager &device_manager,
624
617
return device_manager.RunReplayApk (remote_gfxr_file,
625
618
replay_args,
626
619
false ,
627
- m_capture_file_directory .value ());
620
+ m_local_capture_file_directory .value ());
628
621
}
629
622
630
623
// --------------------------------------------------------------------------------------------------
@@ -690,17 +683,41 @@ void AnalyzeDialog::OnReplay()
690
683
}
691
684
692
685
// Set the download directory to the directory of the current capture file
693
- m_capture_file_directory = GetCaptureFileDirectory ();
694
- if (!m_capture_file_directory .ok ())
686
+ m_local_capture_file_directory = GetCaptureFileDirectory ();
687
+ if (!m_local_capture_file_directory .ok ())
695
688
{
696
689
std::string err_msg = absl::StrCat (" Failed to set download directory: " ,
697
- m_capture_file_directory .status ().message ());
690
+ m_local_capture_file_directory .status ().message ());
698
691
qDebug () << err_msg.c_str ();
699
692
ShowErrorMessage (err_msg);
700
693
SetReplayButton (kDefaultReplayButtonText , true );
701
694
return ;
702
695
}
703
696
697
+ // Delete any temporary artifacts from previous runs (.rd, .csv, etc)
698
+ std::filesystem::path gfxr_filename_stem = std::filesystem::path (remote_file.value ()).stem ();
699
+ std::filesystem::path perf_counter_csv = GetFullLocalPath (gfxr_filename_stem.string (),
700
+ Dive::kProfilingMetricsCsvSuffix );
701
+ std::filesystem::path gpu_timing_csv = GetFullLocalPath (gfxr_filename_stem.string (),
702
+ Dive::kGpuTimingCsvSuffix );
703
+ qDebug () << " Attempting to delete temporary artifacts from previous runs..." ;
704
+ if (std::filesystem::remove (perf_counter_csv))
705
+ {
706
+ qDebug () << " Successfully deleted: " << perf_counter_csv.string ().c_str ();
707
+ }
708
+ else
709
+ {
710
+ qDebug () << " Was not present: " << perf_counter_csv.string ().c_str ();
711
+ }
712
+ if (std::filesystem::remove (gpu_timing_csv))
713
+ {
714
+ qDebug () << " Successfully deleted: " << gpu_timing_csv.string ().c_str ();
715
+ }
716
+ else
717
+ {
718
+ qDebug () << " Was not present: " << gpu_timing_csv.string ().c_str ();
719
+ }
720
+
704
721
// Get the enabled settings
705
722
m_dump_pm4_enabled = m_dump_pm4_box->currentIndex () == 0 ;
706
723
m_gpu_time_enabled = m_gpu_time_box->currentIndex () == 0 ;
@@ -740,12 +757,18 @@ void AnalyzeDialog::OnReplay()
740
757
SetReplayButton (kDefaultReplayButtonText , true );
741
758
return ;
742
759
}
743
-
744
- UpdatePerfTabView (remote_file.value ());
745
760
WaitForReplay (*device);
761
+ qDebug () << " Loading perf counter data: " << perf_counter_csv.string ().c_str ();
762
+ emit OnDisplayPerfCounterResults (QString::fromStdString (perf_counter_csv.string ()));
763
+ }
764
+ else
765
+ {
766
+ qDebug () << " Cleared perf counter data" ;
767
+ emit OnDisplayPerfCounterResults (" " );
746
768
}
747
769
748
770
// Run the gpu_time replay
771
+ std::string gpu_time_csv_stem = " " ;
749
772
if (m_gpu_time_enabled)
750
773
{
751
774
ret = GpuTimeReplay (device_manager, remote_file.value ());
@@ -757,8 +780,14 @@ void AnalyzeDialog::OnReplay()
757
780
SetReplayButton (kDefaultReplayButtonText , true );
758
781
return ;
759
782
}
760
- UpdateGpuTimingTabView (remote_file.value ());
761
783
WaitForReplay (*device);
784
+ qDebug () << " Loading gpu timing data: " << perf_counter_csv.string ().c_str ();
785
+ emit OnDisplayGpuTimingResults (QString::fromStdString (gpu_timing_csv.string ()));
786
+ }
787
+ else
788
+ {
789
+ qDebug () << " Cleared gpu timing data" ;
790
+ emit OnDisplayGpuTimingResults (" " );
762
791
}
763
792
764
793
SetReplayButton (kDefaultReplayButtonText , true );
0 commit comments