Skip to content

Commit 2bcb141

Browse files
committed
[profiler] add csv recording status on profiler IMGUI section
1 parent 2b63244 commit 2bcb141

3 files changed

Lines changed: 12 additions & 3 deletions

File tree

source/editor/Widgets/Profiler.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -181,15 +181,18 @@ void Profiler::OnTickVisible()
181181

182182
ImGui::Text("CSV:");
183183
ImGui::SameLine();
184-
if (ImGui::Button("Start Recording"))
184+
if (ImGui::Button("Start"))
185185
{
186186
spartan::CsvExporter::StartRecording();
187187
}
188188
ImGui::SameLine();
189-
if (ImGui::Button("Stop Recording"))
189+
if (ImGui::Button("Stop"))
190190
{
191191
spartan::CsvExporter::StopRecording();
192192
}
193+
ImGui::SameLine();
194+
bool isCSVExporterRecording = spartan::CsvExporter::IsRecording();
195+
ImGui::TextColored(isCSVExporterRecording ? ImVec4(1.0f, 0.0f, 0.0f, 1.0f) : ImVec4(1.0f, 1.0f, 0.0f, 1.0f), isCSVExporterRecording ? "Recording" : "Not Recording");
193196

194197
ImGui::Separator();
195198
}

source/runtime/Profiling/CsvExporter.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,11 @@ namespace spartan
8080
}
8181
}
8282

83+
bool CsvExporter::IsRecording()
84+
{
85+
return csv_export_file.is_open();
86+
}
87+
8388
void CsvExporter::WriteFrameData(const TimeBlock& current_time_block, const uint64_t frame_number)
8489
{
8590
if (csv_export_file.is_open())
@@ -122,7 +127,7 @@ namespace spartan
122127
current_csv_row = 0;
123128
SP_LOG_INFO("Stopped recording profiling data for CSV report: %s", file_path.generic_string().c_str());
124129
}
125-
else if (!csv_export_file.is_open())
130+
else
126131
{
127132
SP_LOG_WARNING("Invalid action. There is no active CSV recording.");
128133
}

source/runtime/Profiling/CsvExporter.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ namespace spartan
3131
{
3232
public:
3333
static void StartRecording();
34+
static bool IsRecording();
3435
static void WriteFrameData(const TimeBlock& current_time_block, uint64_t frame_number);
3536
static void NextInterval();
3637
static void StopRecording();

0 commit comments

Comments
 (0)