Dump load time statistics

This commit is contained in:
torusrxxx 2024-08-12 18:44:08 +08:00
parent 79b5c9789a
commit b9fa839efb
No known key found for this signature in database
GPG Key ID: A795C73A0F1CFADD
2 changed files with 14 additions and 8 deletions

View File

@ -15,7 +15,7 @@ public:
{
duint addr;
TRACEINDEX index;
friend bool operator <(const Key & a, const Key & b)
friend bool operator <(const Key & a, const Key & b) noexcept
{
// order is inverted, highest address is less! We want to use lower_bound() to find last memory access index.
return a.addr > b.addr || a.addr == b.addr && a.index > b.index;
@ -32,11 +32,11 @@ public:
TraceFileDump();
~TraceFileDump();
void clear();
inline void setEnabled()
inline void setEnabled() noexcept
{
enabled = true;
}
inline bool isEnabled() const
inline bool isEnabled() const noexcept
{
return enabled;
}
@ -48,11 +48,11 @@ public:
void addMemAccess(duint addr, const void* oldData, const void* newData, size_t size);
// Find pattern
void findAllMem(const unsigned char* data, const unsigned char* mask, size_t size, std::function<bool(duint, TRACEINDEX, TRACEINDEX)> matchFunction) const;
inline void increaseIndex()
inline void increaseIndex() noexcept
{
maxIndex++;
}
inline TRACEINDEX getMaxIndex()
inline TRACEINDEX getMaxIndex() noexcept
{
return maxIndex;
}

View File

@ -145,9 +145,8 @@ void TraceWidget::traceSelectionChanged(TRACEINDEX selection)
void TraceWidget::xrefSlot(duint addr)
{
if(!mDump)
if(!loadDumpFully())
return;
if(!loadDumpFully())
return;
if(!mXrefDlg)
mXrefDlg = new TraceXrefBrowseDialog(this);
mXrefDlg->setup(mTraceBrowser->getInitialSelection(), addr, mTraceFile, [this](duint addr)
@ -248,8 +247,15 @@ bool TraceWidget::loadDumpFully()
if(!loadDump())
return false;
QTime ticks;
ticks.start();
// Fully build dump index
mTraceFile->buildDumpTo(mTraceFile->Length() - 1);
auto elapsed = ticks.elapsed();
if(elapsed >= 200)
{
GuiAddLogMessage(tr("Loaded trace dump in %1ms\n").arg(elapsed).toUtf8().constData());
}
return true;
}