mirror of
https://github.com/wolfpld/tracy.git
synced 2025-03-20 07:40:02 +08:00
Calculate and display group times.
This commit is contained in:
parent
d03356c1f5
commit
cacbac8915
@ -4295,21 +4295,25 @@ void View::DrawFindZone()
|
|||||||
}
|
}
|
||||||
|
|
||||||
processed++;
|
processed++;
|
||||||
|
FindZone::Group* group;
|
||||||
switch( groupBy )
|
switch( groupBy )
|
||||||
{
|
{
|
||||||
case FindZone::GroupBy::Thread:
|
case FindZone::GroupBy::Thread:
|
||||||
m_findZone.groups[ev.thread].push_back( ev.zone );
|
group = &m_findZone.groups[ev.thread];
|
||||||
break;
|
break;
|
||||||
case FindZone::GroupBy::UserText:
|
case FindZone::GroupBy::UserText:
|
||||||
m_findZone.groups[ev.zone->text.active ? ev.zone->text.idx : std::numeric_limits<uint64_t>::max()].push_back( ev.zone );
|
group = &m_findZone.groups[ev.zone->text.active ? ev.zone->text.idx : std::numeric_limits<uint64_t>::max()];
|
||||||
break;
|
break;
|
||||||
case FindZone::GroupBy::Callstack:
|
case FindZone::GroupBy::Callstack:
|
||||||
m_findZone.groups[ev.zone->callstack].push_back( ev.zone );
|
group = &m_findZone.groups[ev.zone->callstack];
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
group = nullptr;
|
||||||
assert( false );
|
assert( false );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
group->time += timespan;
|
||||||
|
group->zones.push_back( ev.zone );
|
||||||
}
|
}
|
||||||
m_findZone.processed = processed;
|
m_findZone.processed = processed;
|
||||||
|
|
||||||
@ -4322,7 +4326,7 @@ void View::DrawFindZone()
|
|||||||
}
|
}
|
||||||
if( m_findZone.sortByCounts )
|
if( m_findZone.sortByCounts )
|
||||||
{
|
{
|
||||||
pdqsort_branchless( groups.begin(), groups.end(), []( const auto& lhs, const auto& rhs ) { return lhs->second.size() > rhs->second.size(); } );
|
pdqsort_branchless( groups.begin(), groups.end(), []( const auto& lhs, const auto& rhs ) { return lhs->second.zones.size() > rhs->second.zones.size(); } );
|
||||||
}
|
}
|
||||||
|
|
||||||
ImGui::BeginChild( "##zonesScroll", ImVec2( ImGui::GetWindowContentRegionWidth(), std::max( 200.f, ImGui::GetContentRegionAvail().y ) ) );
|
ImGui::BeginChild( "##zonesScroll", ImVec2( ImGui::GetWindowContentRegionWidth(), std::max( 200.f, ImGui::GetContentRegionAvail().y ) ) );
|
||||||
@ -4362,7 +4366,7 @@ void View::DrawFindZone()
|
|||||||
}
|
}
|
||||||
ImGui::PopID();
|
ImGui::PopID();
|
||||||
ImGui::SameLine();
|
ImGui::SameLine();
|
||||||
ImGui::TextColored( ImVec4( 0.5f, 0.5f, 0.5f, 1.0f ), "(%s)", RealToString( v->second.size(), true ) );
|
ImGui::TextColored( ImVec4( 0.5f, 0.5f, 0.5f, 1.0f ), "(%s) %s", RealToString( v->second.zones.size(), true ), TimeToString( v->second.time ) );
|
||||||
if( groupBy == FindZone::GroupBy::Callstack )
|
if( groupBy == FindZone::GroupBy::Callstack )
|
||||||
{
|
{
|
||||||
ImGui::SameLine();
|
ImGui::SameLine();
|
||||||
@ -4389,7 +4393,7 @@ void View::DrawFindZone()
|
|||||||
ImGui::NextColumn();
|
ImGui::NextColumn();
|
||||||
ImGui::Separator();
|
ImGui::Separator();
|
||||||
|
|
||||||
for( auto& ev : v->second )
|
for( auto& ev : v->second.zones )
|
||||||
{
|
{
|
||||||
const auto end = m_worker.GetZoneEndDirect( *ev );
|
const auto end = m_worker.GetZoneEndDirect( *ev );
|
||||||
const auto timespan = end - ev->start;
|
const auto timespan = end - ev->start;
|
||||||
|
|||||||
@ -221,9 +221,15 @@ private:
|
|||||||
enum : uint64_t { Unselected = std::numeric_limits<uint64_t>::max() - 1 };
|
enum : uint64_t { Unselected = std::numeric_limits<uint64_t>::max() - 1 };
|
||||||
enum class GroupBy : int { Thread, UserText, Callstack };
|
enum class GroupBy : int { Thread, UserText, Callstack };
|
||||||
|
|
||||||
|
struct Group
|
||||||
|
{
|
||||||
|
Vector<ZoneEvent*> zones;
|
||||||
|
int64_t time = 0;
|
||||||
|
};
|
||||||
|
|
||||||
bool show = false;
|
bool show = false;
|
||||||
std::vector<int32_t> match;
|
std::vector<int32_t> match;
|
||||||
std::map<uint64_t, Vector<ZoneEvent*>> groups;
|
std::map<uint64_t, Group> groups;
|
||||||
size_t processed;
|
size_t processed;
|
||||||
int selMatch = 0;
|
int selMatch = 0;
|
||||||
uint64_t selGroup = Unselected;
|
uint64_t selGroup = Unselected;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user