More references.

This commit is contained in:
Bartosz Taudul 2019-01-29 22:10:14 +01:00
parent 5e3390894d
commit 852fe03cbc
2 changed files with 14 additions and 10 deletions

View File

@ -3240,7 +3240,8 @@ int View::DrawPlots( int offset, double pxns, const ImVec2& wpos, bool hover, fl
showFull = !showFull;
}
const auto tr = v->data.back().time - v->data.front().time;
const auto lastTime = v->data.back().time;
const auto tr = lastTime - v->data.front().time;
ImGui::BeginTooltip();
ImGui::Text( "Plot \"%s\"", txt );
@ -3252,8 +3253,8 @@ int View::DrawPlots( int offset, double pxns, const ImVec2& wpos, bool hover, fl
TextFocused( "Time range:", TimeToString( tr ) );
TextFocused( "Data/second:", RealToString( double( v->data.size() ) / tr * 1000000000ll, true ) );
const auto it = std::lower_bound( v->data.begin(), v->data.end(), v->data.back().time - 1000000000ll * 10, [] ( const auto& l, const auto& r ) { return l.time < r; } );
const auto tr10 = v->data.back().time - it->time;
const auto it = std::lower_bound( v->data.begin(), v->data.end(), lastTime - 1000000000ll * 10, [] ( const auto& l, const auto& r ) { return l.time < r; } );
const auto tr10 = lastTime - it->time;
if( tr10 != 0 )
{
TextFocused( "D/s (10s):", RealToString( double( std::distance( it, v->data.end() ) ) / tr10 * 1000000000ll, true ) );

View File

@ -1168,9 +1168,10 @@ int64_t Worker::GetFrameTime( const FrameData& fd, size_t idx ) const
}
else
{
if( fd.frames[idx].end >= 0 )
const auto& frame = fd.frames[idx];
if( frame.end >= 0 )
{
return fd.frames[idx].end - fd.frames[idx].start;
return frame.end - frame.start;
}
else
{
@ -3124,7 +3125,8 @@ void Worker::ReconstructMemAllocPlot()
if( aptr != aend && fptr != fend )
{
auto atime = aptr->timeAlloc;
auto ftime = mem.data[*fptr].timeFree;
const auto& memData = mem.data[*fptr];
auto ftime = memData.timeFree;
for(;;)
{
@ -3142,7 +3144,7 @@ void Worker::ReconstructMemAllocPlot()
}
else
{
usage -= int64_t( mem.data[*fptr].size );
usage -= int64_t( memData.size );
assert( usage >= 0 );
if( max < usage ) max = usage;
ptr->time = ftime;
@ -3150,7 +3152,7 @@ void Worker::ReconstructMemAllocPlot()
ptr++;
fptr++;
if( fptr == fend ) break;
ftime = mem.data[*fptr].timeFree;
ftime = memData.timeFree;
}
}
}
@ -3169,8 +3171,9 @@ void Worker::ReconstructMemAllocPlot()
}
while( fptr != fend )
{
int64_t time = mem.data[*fptr].timeFree;
usage -= int64_t( mem.data[*fptr].size );
const auto& memData = mem.data[*fptr];
int64_t time = memData.timeFree;
usage -= int64_t( memData.size );
assert( usage >= 0 );
assert( max >= usage );
ptr->time = time;