mirror of
https://github.com/wolfpld/tracy.git
synced 2024-11-27 00:04:35 +00:00
Collapse separate find zone histogram paths into one.
This commit is contained in:
parent
bb9da36f7e
commit
8152e213f8
@ -4676,13 +4676,9 @@ void View::DrawFindZone()
|
|||||||
memset( selBin.get(), 0, sizeof( int64_t ) * numBins );
|
memset( selBin.get(), 0, sizeof( int64_t ) * numBins );
|
||||||
|
|
||||||
int64_t selectionTime = 0;
|
int64_t selectionTime = 0;
|
||||||
if( m_findZone.highlight.active )
|
|
||||||
{
|
|
||||||
const auto s = std::min( m_findZone.highlight.start, m_findZone.highlight.end );
|
const auto s = std::min( m_findZone.highlight.start, m_findZone.highlight.end );
|
||||||
const auto e = std::max( m_findZone.highlight.start, m_findZone.highlight.end );
|
const auto e = std::max( m_findZone.highlight.start, m_findZone.highlight.end );
|
||||||
|
|
||||||
if( selGroup != m_findZone.Unselected )
|
|
||||||
{
|
|
||||||
if( m_findZone.logTime )
|
if( m_findZone.logTime )
|
||||||
{
|
{
|
||||||
const auto tMinLog = log10fast( tmin );
|
const auto tMinLog = log10fast( tmin );
|
||||||
@ -4695,11 +4691,11 @@ void View::DrawFindZone()
|
|||||||
const auto bin = std::min( numBins - 1, int64_t( ( log10fast( timeSpan ) - tMinLog ) * idt ) );
|
const auto bin = std::min( numBins - 1, int64_t( ( log10fast( timeSpan ) - tMinLog ) * idt ) );
|
||||||
bins[bin]++;
|
bins[bin]++;
|
||||||
binTime[bin] += timeSpan;
|
binTime[bin] += timeSpan;
|
||||||
if( selGroup == GetSelectionTarget( ev, groupBy ) )
|
if( selGroup != m_findZone.Unselected && selGroup == GetSelectionTarget( ev, groupBy ) )
|
||||||
{
|
{
|
||||||
if( cumulateTime ) selBin[bin] += timeSpan; else selBin[bin]++;
|
if( cumulateTime ) selBin[bin] += timeSpan; else selBin[bin]++;
|
||||||
}
|
}
|
||||||
if( timeSpan >= s && timeSpan <= e ) selectionTime += timeSpan;
|
if( m_findZone.highlight.active && timeSpan >= s && timeSpan <= e ) selectionTime += timeSpan;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -4714,122 +4710,11 @@ void View::DrawFindZone()
|
|||||||
const auto bin = std::min( numBins - 1, int64_t( ( timeSpan - tmin ) * idt ) );
|
const auto bin = std::min( numBins - 1, int64_t( ( timeSpan - tmin ) * idt ) );
|
||||||
bins[bin]++;
|
bins[bin]++;
|
||||||
binTime[bin] += timeSpan;
|
binTime[bin] += timeSpan;
|
||||||
if( selGroup == GetSelectionTarget( ev, groupBy ) )
|
if( selGroup != m_findZone.Unselected && selGroup == GetSelectionTarget( ev, groupBy ) )
|
||||||
{
|
{
|
||||||
if( cumulateTime ) selBin[bin] += timeSpan; else selBin[bin]++;
|
if( cumulateTime ) selBin[bin] += timeSpan; else selBin[bin]++;
|
||||||
}
|
}
|
||||||
if( timeSpan >= s && timeSpan <= e ) selectionTime += timeSpan;
|
if( m_findZone.highlight.active && timeSpan >= s && timeSpan <= e ) selectionTime += timeSpan;
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if( m_findZone.logTime )
|
|
||||||
{
|
|
||||||
const auto tMinLog = log10fast( tmin );
|
|
||||||
const auto idt = numBins / ( log10fast( tmax ) - tMinLog );
|
|
||||||
for( auto& ev : zones )
|
|
||||||
{
|
|
||||||
const auto timeSpan = m_worker.GetZoneEndDirect( *ev.zone ) - ev.zone->start;
|
|
||||||
if( timeSpan != 0 )
|
|
||||||
{
|
|
||||||
const auto bin = std::min( numBins - 1, int64_t( ( log10fast( timeSpan ) - tMinLog ) * idt ) );
|
|
||||||
bins[bin]++;
|
|
||||||
binTime[bin] += timeSpan;
|
|
||||||
if( timeSpan >= s && timeSpan <= e ) selectionTime += timeSpan;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
const auto idt = numBins / dt;
|
|
||||||
for( auto& ev : zones )
|
|
||||||
{
|
|
||||||
const auto timeSpan = m_worker.GetZoneEndDirect( *ev.zone ) - ev.zone->start;
|
|
||||||
if( timeSpan != 0 )
|
|
||||||
{
|
|
||||||
const auto bin = std::min( numBins - 1, int64_t( ( timeSpan - tmin ) * idt ) );
|
|
||||||
bins[bin]++;
|
|
||||||
binTime[bin] += timeSpan;
|
|
||||||
if( timeSpan >= s && timeSpan <= e ) selectionTime += timeSpan;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if( selGroup != m_findZone.Unselected )
|
|
||||||
{
|
|
||||||
if( m_findZone.logTime )
|
|
||||||
{
|
|
||||||
const auto tMinLog = log10fast( tmin );
|
|
||||||
const auto idt = numBins / ( log10fast( tmax ) - tMinLog );
|
|
||||||
for( auto& ev : zones )
|
|
||||||
{
|
|
||||||
const auto timeSpan = m_worker.GetZoneEndDirect( *ev.zone ) - ev.zone->start;
|
|
||||||
if( timeSpan != 0 )
|
|
||||||
{
|
|
||||||
const auto bin = std::min( numBins - 1, int64_t( ( log10fast( timeSpan ) - tMinLog ) * idt ) );
|
|
||||||
bins[bin]++;
|
|
||||||
binTime[bin] += timeSpan;
|
|
||||||
if( selGroup == GetSelectionTarget( ev, groupBy ) )
|
|
||||||
{
|
|
||||||
if( cumulateTime ) selBin[bin] += timeSpan; else selBin[bin]++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
const auto idt = numBins / dt;
|
|
||||||
for( auto& ev : zones )
|
|
||||||
{
|
|
||||||
const auto timeSpan = m_worker.GetZoneEndDirect( *ev.zone ) - ev.zone->start;
|
|
||||||
if( timeSpan != 0 )
|
|
||||||
{
|
|
||||||
const auto bin = std::min( numBins - 1, int64_t( ( timeSpan - tmin ) * idt ) );
|
|
||||||
bins[bin]++;
|
|
||||||
binTime[bin] += timeSpan;
|
|
||||||
if( selGroup == GetSelectionTarget( ev, groupBy ) )
|
|
||||||
{
|
|
||||||
if( cumulateTime ) selBin[bin] += timeSpan; else selBin[bin]++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if( m_findZone.logTime )
|
|
||||||
{
|
|
||||||
const auto tMinLog = log10fast( tmin );
|
|
||||||
const auto idt = numBins / ( log10fast( tmax ) - tMinLog );
|
|
||||||
for( auto& ev : zones )
|
|
||||||
{
|
|
||||||
const auto timeSpan = m_worker.GetZoneEndDirect( *ev.zone ) - ev.zone->start;
|
|
||||||
if( timeSpan != 0 )
|
|
||||||
{
|
|
||||||
const auto bin = std::min( numBins - 1, int64_t( ( log10fast( timeSpan ) - tMinLog ) * idt ) );
|
|
||||||
bins[bin]++;
|
|
||||||
binTime[bin] += timeSpan;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
const auto idt = numBins / dt;
|
|
||||||
for( auto& ev : zones )
|
|
||||||
{
|
|
||||||
const auto timeSpan = m_worker.GetZoneEndDirect( *ev.zone ) - ev.zone->start;
|
|
||||||
if( timeSpan != 0 )
|
|
||||||
{
|
|
||||||
const auto bin = std::min( numBins - 1, int64_t( ( timeSpan - tmin ) * idt ) );
|
|
||||||
bins[bin]++;
|
|
||||||
binTime[bin] += timeSpan;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user