add_executable (tracedump tracedump.cpp)
install (TARGETS tracedump RUNTIME DESTINATION bin)
-add_executable (loadertest loadertest.cpp)
-install (TARGETS loadertest RUNTIME DESTINATION bin)
-
##############################################################################
# API tracers
m_needsSaving = false;
emit invalidated();
-// m_loader->loadTrace(m_fileName);
emit loadTrace(m_fileName);
}
}
ApiTraceState ApiTrace::defaultState() const
{
ApiTraceFrame *frame = frameAt(0);
- if (!frame || !frame->loaded() || frame->isEmpty())
+ if (!frame || !frame->isLoaded() || frame->isEmpty())
return ApiTraceState();
ApiTraceCall *firstCall = frame->calls().first();
void ApiTrace::loadFrame(ApiTraceFrame *frame)
{
- Q_ASSERT(!frame->loaded());
+ Q_ASSERT(!frame->isLoaded());
emit requestFrame(frame);
}
void ApiTrace::finishedParsing()
{
ApiTraceFrame *firstFrame = m_frames[0];
- if (firstFrame && !firstFrame->loaded()) {
+ if (firstFrame && !firstFrame->isLoaded()) {
loadFrame(firstFrame);
}
}
ApiTraceCall *foundCall = 0;
int frameIdx = m_frames.indexOf(frame);
- if (frame->loaded()) {
+ if (frame->isLoaded()) {
foundCall = frame->findNextCall(from, str, sensitivity);
if (foundCall) {
- emit findResult(SearchFound, foundCall);
+ emit findResult(SearchResult_Found, foundCall);
return;
}
for (int i = frameIdx; i < m_frames.count(); ++i) {
ApiTraceFrame *frame = m_frames[i];
- if (!frame->loaded()) {
+ if (!frame->isLoaded()) {
emit loaderSearchNext(i, str, sensitivity);
return;
} else {
ApiTraceCall *call = frame->findNextCall(0, str, sensitivity);
if (call) {
- emit findResult(SearchFound, call);
+ emit findResult(SearchResult_Found, call);
return;
}
}
}
- emit findResult(SearchWrapped, 0);
+ emit findResult(SearchResult_Wrapped, 0);
}
void ApiTrace::findPrev(ApiTraceFrame *frame,
ApiTraceCall *foundCall = 0;
int frameIdx = m_frames.indexOf(frame);
- if (frame->loaded()) {
+ if (frame->isLoaded()) {
foundCall = frame->findPrevCall(from, str, sensitivity);
if (foundCall) {
- emit findResult(SearchFound, foundCall);
+ emit findResult(SearchResult_Found, foundCall);
return;
}
for (int i = frameIdx; i >= 0; --i) {
ApiTraceFrame *frame = m_frames[i];
- if (!frame->loaded()) {
+ if (!frame->isLoaded()) {
emit loaderSearchPrev(i, str, sensitivity);
return;
} else {
ApiTraceCall *call = frame->findPrevCall(0, str, sensitivity);
if (call) {
- emit findResult(SearchFound, call);
+ emit findResult(SearchResult_Found, call);
return;
}
}
}
- emit findResult(SearchWrapped, 0);
+ emit findResult(SearchResult_Wrapped, 0);
}
void ApiTrace::loaderSearchResult(ApiTrace::SearchResult result,
void ApiTrace::findFrameStart(ApiTraceFrame *frame)
{
- if (frame->loaded()) {
+ if (frame->isLoaded()) {
emit foundFrameStart(frame);
} else {
emit loaderFindFrameStart(frame);
void ApiTrace::findFrameEnd(ApiTraceFrame *frame)
{
- if (frame->loaded()) {
+ if (frame->isLoaded()) {
emit foundFrameEnd(frame);
} else {
emit loaderFindFrameEnd(frame);
frame = m_frames[frameIdx];
if (frame) {
- if (frame->loaded()) {
+ if (frame->isLoaded()) {
ApiTraceCall *call = frame->callWithIndex(index);
emit foundCallIndex(call);
} else {
for (int frameIdx = 0; frameIdx <= m_frames.size(); ++frameIdx) {
const ApiTraceFrame *frame = m_frames[frameIdx];
- unsigned numCallsInFrame = frame->loaded()
+ unsigned numCallsInFrame = frame->isLoaded()
? frame->numChildren()
: frame->numChildrenToLoad();
unsigned firstCall = numCalls;
}
frame = m_frames[frameIdx];
- if (frame->loaded()) {
+ if (frame->isLoaded()) {
ApiTraceCall *call = frame->callWithIndex(error.callIndex);
call->setError(error.message);
if (call->hasError()) {
FrameMarker_Clear
};
enum SearchResult {
- SearchNotFound,
- SearchFound,
- SearchWrapped
+ SearchResult_NotFound,
+ SearchResult_Found,
+ SearchResult_Wrapped
};
static bool isCallAFrameMarker(const ApiTraceCall *call,
m_staticText = 0;
}
-bool ApiTraceFrame::loaded() const
+bool ApiTraceFrame::isLoaded() const
{
return m_loaded;
}
int binaryDataSize() const;
- bool loaded() const;
+ bool isLoaded() const;
void setLoaded(bool l);
void setLastCallIndex(unsigned index);
}
}
- int numCalls = frame->loaded()
+ int numCalls = frame->isLoaded()
? frame->numChildren()
: frame->numChildrenToLoad();
ApiTraceEvent *event = item(parent);
if (event && event->type() == ApiTraceEvent::Frame) {
ApiTraceFrame *frame = static_cast<ApiTraceFrame*>(event);
- return !frame->loaded() && !m_loadingFrames.contains(frame);
+ return !frame->isLoaded() && !m_loadingFrames.contains(frame);
} else
return false;
} else {
ApiTraceFrame *frame = static_cast<ApiTraceFrame*>(event);
QModelIndex index = createIndex(frame->number, 0, frame);
- Q_ASSERT(!frame->loaded());
+ Q_ASSERT(!frame->isLoaded());
m_loadingFrames.insert(frame);
m_trace->loadFrame(frame);
m_trace->frameAt(0);
if (!firstFrame)
return;
- if (!firstFrame->loaded()) {
+ if (!firstFrame->isLoaded()) {
m_trace->loadFrame(firstFrame);
return;
}
ApiTraceCall *call)
{
switch (result) {
- case ApiTrace::SearchNotFound:
+ case ApiTrace::SearchResult_NotFound:
m_searchWidget->setFound(false);
break;
- case ApiTrace::SearchFound: {
+ case ApiTrace::SearchResult_Found: {
QModelIndex index = m_proxyModel->indexForCall(call);
m_ui.callView->setCurrentIndex(index);
m_searchWidget->setFound(true);
}
break;
- case ApiTrace::SearchWrapped:
+ case ApiTrace::SearchResult_Wrapped:
m_searchWidget->setFound(false);
break;
}
void MainWindow::slotFoundFrameStart(ApiTraceFrame *frame)
{
- Q_ASSERT(frame->loaded());
+ Q_ASSERT(frame->isLoaded());
if (!frame || frame->isEmpty()) {
return;
}
void MainWindow::slotFoundFrameEnd(ApiTraceFrame *frame)
{
- Q_ASSERT(frame->loaded());
+ Q_ASSERT(frame->isLoaded());
if (!frame || frame->isEmpty()) {
return;
}
fetchFrameContents(frame);
for (int i = 0; i < calls.count(); ++i) {
if (calls[i]->index() == call->no) {
- emit searchResult(ApiTrace::SearchFound, calls[i]);
+ emit searchResult(ApiTrace::SearchResult_Found, calls[i]);
break;
}
}
delete call;
}
}
- emit searchResult(ApiTrace::SearchNotFound, 0);
+ emit searchResult(ApiTrace::SearchResult_NotFound, 0);
}
void TraceLoader::searchPrev(int startFrame,
}
}
}
- emit searchResult(ApiTrace::SearchNotFound, 0);
+ emit searchResult(ApiTrace::SearchResult_NotFound, 0);
}
bool TraceLoader::searchCallsBackwards(const QList<Trace::Call*> &calls,
fetchFrameContents(frame);
for (int i = 0; i < apiCalls.count(); ++i) {
if (apiCalls[i]->index() == call->no) {
- emit searchResult(ApiTrace::SearchFound, apiCalls[i]);
+ emit searchResult(ApiTrace::SearchResult_Found, apiCalls[i]);
break;
}
}
+++ /dev/null
-#include "trace_loader.hpp"
-#include "os.hpp"
-
-#include <iostream>
-
-
-static const double msecsInSec = 1000000;
-
-static void timeFrameFetch(Trace::Loader &loader, unsigned frameIdx)
-{
- long long t1, t2;
- std::vector<Trace::Call*> frame;
-
- t1 = OS::GetTime();
- frame = loader.frame(frameIdx);
- t2 = OS::GetTime();
- std::cout << "Time to fetch the frame["
- << frameIdx
- << "] size "
- << frame.size()
- << " is = "
- << (t2 - t1)/msecsInSec
- << " secs "<<std::endl;
-
- for (unsigned i = 0; i < frame.size(); ++i) {
- delete frame[i];
- }
-}
-
-
-int main(int argc, char **argv)
-{
- int i;
-
- for (i = 1; i < argc; ++i) {
- Trace::Loader loader;
-
- long long t1 = OS::GetTime();
- if (!loader.open(argv[i])) {
- std::cerr << "error: failed to open " << argv[i] << "\n";
- return 1;
- }
- long long t2 = OS::GetTime();
- std::cout << "Time to scan file = "<< (t2 - t1)/msecsInSec
- << " secs "<<std::endl;
-
- std::cout << "Number of frames = "
- << loader.numberOfFrames()
- << std::endl;
- std::cout << "Number of calls in frame 0 = "
- << loader.numberOfCallsInFrame(0)
- << std::endl;
- int lastFrame = loader.numberOfFrames() - 1;
- std::cout << "Number of calls in frame "
- << lastFrame << " = "
- << loader.numberOfCallsInFrame(lastFrame)
- << std::endl;
-
- unsigned biggestFrameIdx = 0;
- unsigned maxFrameSize = 0;
- for (unsigned i = 0; i < loader.numberOfFrames(); ++i) {
- if (loader.numberOfCallsInFrame(i) > maxFrameSize) {
- maxFrameSize = loader.numberOfCallsInFrame(i);
- biggestFrameIdx = i;
- }
- }
-
- timeFrameFetch(loader, loader.numberOfFrames()/2);
- timeFrameFetch(loader, 0);
- timeFrameFetch(loader, loader.numberOfFrames() - 1);
- timeFrameFetch(loader, biggestFrameIdx);
- }
-
- return 0;
-}
-