1
0
mirror of https://github.com/wolfpld/tracy.git synced 2025-03-20 07:40:02 +08:00

Cache bin containers in compare view.

This commit is contained in:
Bartosz Taudul 2018-06-06 23:09:46 +02:00
parent da5d35c364
commit d49be792ba
2 changed files with 18 additions and 9 deletions

View File

@ -4059,12 +4059,6 @@ void View::DrawFindZone()
ImGui::End();
}
struct CompVal
{
double v0;
double v1;
};
void View::DrawCompare()
{
ImGui::Begin( "Compare traces", &m_compare.show );
@ -4258,10 +4252,17 @@ void View::DrawCompare()
const auto numBins = int64_t( w - 4 );
if( numBins > 1 )
{
auto bins = std::make_unique<CompVal[]>( numBins );
memset( bins.get(), 0, sizeof( CompVal ) * numBins );
if( numBins != m_compare.numBins )
{
m_compare.numBins = numBins;
m_compare.bins = std::make_unique<CompVal[]>( numBins );
m_compare.binTime = std::make_unique<CompVal[]>( numBins );
}
auto binTime = std::make_unique<CompVal[]>( numBins );
const auto& bins = m_compare.bins;
const auto& binTime = m_compare.binTime;
memset( bins.get(), 0, sizeof( CompVal ) * numBins );
memset( binTime.get(), 0, sizeof( CompVal ) * numBins );
if( m_compare.normalize )

View File

@ -238,6 +238,12 @@ private:
}
} m_findZone;
struct CompVal
{
double v0;
double v1;
};
struct {
bool show = false;
std::unique_ptr<Worker> second;
@ -249,6 +255,8 @@ private:
bool logTime = true;
bool cumulateTime = false;
bool normalize = false;
int64_t numBins = -1;
std::unique_ptr<CompVal[]> bins, binTime;
void Reset()
{