Section items lister.

This commit is contained in:
Bartosz Taudul
2026-07-14 16:54:00 +02:00
parent 42fc8d8d8f
commit e49b96ec03
2 changed files with 22 additions and 0 deletions

View File

@@ -247,4 +247,25 @@ void PrintLocalStack( const CallstackFrameData* frame, const Worker& worker, con
}
}
RangeSlim ListSections( const Vector<SectionItem>& sections, const Worker& worker )
{
RangeSlim out = {};
int id = 0;
for( auto& v : sections )
{
ImGui::PushID( id++ );
const auto end = v.end.IsNonNegative() ? v.end.Val() : worker.GetLastTime();
if( ImGui::MenuItem( worker.GetString( v.text ) ) )
{
out.min = v.start.Val();
out.max = end;
out.active = true;
}
ImGui::PopID();
ImGui::SameLine();
ImGui::TextDisabled( "%s - %s (%s)", TimeToStringExact( v.start.Val() ), TimeToStringExact( end ), TimeToString( end - v.start.Val() ) );
}
return out;
}
}

View File

@@ -59,6 +59,7 @@ const char* FormatPlotValue( double val, PlotValueFormatting format );
std::vector<std::string> SplitLines( const char* data, size_t sz );
void PrintLocalStack( const CallstackFrameData* frame, const Worker& worker, const View& view );
RangeSlim ListSections( const Vector<SectionItem>& sections, const Worker& worker );
}