1
0
Fork 0

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; duint addr;
TRACEINDEX index; 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. // 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; return a.addr > b.addr || a.addr == b.addr && a.index > b.index;
@ -32,11 +32,11 @@ public:
TraceFileDump(); TraceFileDump();
~TraceFileDump(); ~TraceFileDump();
void clear(); void clear();
inline void setEnabled() inline void setEnabled() noexcept
{ {
enabled = true; enabled = true;
} }
inline bool isEnabled() const inline bool isEnabled() const noexcept
{ {
return enabled; return enabled;
} }
@ -48,11 +48,11 @@ public:
void addMemAccess(duint addr, const void* oldData, const void* newData, size_t size); void addMemAccess(duint addr, const void* oldData, const void* newData, size_t size);
// Find pattern // Find pattern
void findAllMem(const unsigned char* data, const unsigned char* mask, size_t size, std::function<bool(duint, TRACEINDEX, TRACEINDEX)> matchFunction) const; 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++; maxIndex++;
} }
inline TRACEINDEX getMaxIndex() inline TRACEINDEX getMaxIndex() noexcept
{ {
return maxIndex; return maxIndex;
} }

View File

@ -145,9 +145,8 @@ void TraceWidget::traceSelectionChanged(TRACEINDEX selection)
void TraceWidget::xrefSlot(duint addr) void TraceWidget::xrefSlot(duint addr)
{ {
if(!mDump) if(!loadDumpFully())
if(!loadDumpFully()) return;
return;
if(!mXrefDlg) if(!mXrefDlg)
mXrefDlg = new TraceXrefBrowseDialog(this); mXrefDlg = new TraceXrefBrowseDialog(this);
mXrefDlg->setup(mTraceBrowser->getInitialSelection(), addr, mTraceFile, [this](duint addr) mXrefDlg->setup(mTraceBrowser->getInitialSelection(), addr, mTraceFile, [this](duint addr)
@ -248,8 +247,15 @@ bool TraceWidget::loadDumpFully()
if(!loadDump()) if(!loadDump())
return false; return false;
QTime ticks;
ticks.start();
// Fully build dump index // Fully build dump index
mTraceFile->buildDumpTo(mTraceFile->Length() - 1); 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; return true;
} }