本文整理汇总了C++中ApiTraceFrame::setCalls方法的典型用法代码示例。如果您正苦于以下问题:C++ ApiTraceFrame::setCalls方法的具体用法?C++ ApiTraceFrame::setCalls怎么用?C++ ApiTraceFrame::setCalls使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ApiTraceFrame
的用法示例。
在下文中一共展示了ApiTraceFrame::setCalls方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: parseTrace
void TraceLoader::parseTrace()
{
QList<ApiTraceFrame*> frames;
ApiTraceFrame *currentFrame = 0;
int frameCount = 0;
QVector<ApiTraceCall*> calls;
quint64 binaryDataSize = 0;
int lastPercentReport = 0;
trace::Call *call = m_parser.parse_call();
while (call) {
//std::cout << *call;
if (!currentFrame) {
currentFrame = new ApiTraceFrame();
currentFrame->number = frameCount;
++frameCount;
}
ApiTraceCall *apiCall =
apiCallFromTraceCall(call, m_helpHash, currentFrame, this);
calls.append(apiCall);
if (apiCall->hasBinaryData()) {
QByteArray data =
apiCall->arguments()[apiCall->binaryDataIndex()].toByteArray();
binaryDataSize += data.size();
}
if (ApiTrace::isCallAFrameMarker(apiCall,
m_frameMarker)) {
calls.squeeze();
currentFrame->setCalls(calls, binaryDataSize);
calls.clear();
frames.append(currentFrame);
currentFrame = 0;
binaryDataSize = 0;
if (frames.count() >= FRAMES_TO_CACHE) {
emit framesLoaded(frames);
frames.clear();
}
if (m_parser.percentRead() - lastPercentReport >= 5) {
emit parsed(m_parser.percentRead());
lastPercentReport = m_parser.percentRead();
}
}
delete call;
call = m_parser.parse_call();
}
//last frames won't have markers
// it's just a bunch of Delete calls for every object
// after the last SwapBuffers
if (currentFrame) {
calls.squeeze();
currentFrame->setCalls(calls, binaryDataSize);
frames.append(currentFrame);
currentFrame = 0;
}
if (frames.count()) {
emit framesLoaded(frames);
}
}
示例2: parseTrace
void TraceLoader::parseTrace()
{
QList<ApiTraceFrame*> frames;
int frameCount = 0;
int lastPercentReport = 0;
ApiTraceFrame *currentFrame = new ApiTraceFrame();
currentFrame->number = frameCount;
FrameContents frameCalls;
while (frameCalls.load(this, currentFrame, m_helpHash, m_parser)) {
if (frameCalls.topLevelCount() == frameCalls.allCallsCount()) {
currentFrame->setCalls(frameCalls.allCalls(),
frameCalls.allCalls(),
frameCalls.binaryDataSize());
} else {
currentFrame->setCalls(frameCalls.topLevelCalls(),
frameCalls.allCalls(),
frameCalls.binaryDataSize());
}
frames.append(currentFrame);
if (frames.count() >= FRAMES_TO_CACHE) {
emit framesLoaded(frames);
frames.clear();
}
if (m_parser.percentRead() - lastPercentReport >= 5) {
emit parsed(m_parser.percentRead());
lastPercentReport = m_parser.percentRead();
}
++frameCount;
currentFrame = new ApiTraceFrame();
currentFrame->number = frameCount;
frameCalls.reset();
}
//last frames won't have markers
// it's just a bunch of Delete calls for every object
// after the last SwapBuffers
if (!frameCalls.isEmpty()) {
if (frameCalls.topLevelCount() == frameCalls.allCallsCount()) {
currentFrame->setCalls(frameCalls.allCalls(),
frameCalls.allCalls(),
frameCalls.binaryDataSize());
} else {
currentFrame->setCalls(frameCalls.topLevelCalls(),
frameCalls.allCalls(),
frameCalls.binaryDataSize());
}
frames.append(currentFrame);
}
if (frames.count()) {
emit framesLoaded(frames);
}
}
示例3: parseTrace
void TraceLoader::parseTrace()
{
QList<ApiTraceFrame*> frames;
ApiTraceFrame *currentFrame = 0;
int frameCount = 0;
QStack<ApiTraceCall*> groups;
QVector<ApiTraceCall*> topLevelItems;
QVector<ApiTraceCall*> allCalls;
quint64 binaryDataSize = 0;
int lastPercentReport = 0;
trace::Call *call = m_parser.parse_call();
while (call) {
//std::cout << *call;
if (!currentFrame) {
currentFrame = new ApiTraceFrame();
currentFrame->number = frameCount;
++frameCount;
}
ApiTraceCall *apiCall =
apiCallFromTraceCall(call, m_helpHash, currentFrame, groups.isEmpty() ? 0 : groups.top(), this);
allCalls.append(apiCall);
if (groups.count() == 0) {
topLevelItems.append(apiCall);
}
if (call->flags & trace::CALL_FLAG_MARKER_PUSH) {
groups.push(apiCall);
} else if (call->flags & trace::CALL_FLAG_MARKER_POP) {
groups.top()->finishedAddingChildren();
groups.pop();
}
if (!groups.isEmpty()) {
groups.top()->addChild(apiCall);
}
if (apiCall->hasBinaryData()) {
QByteArray data =
apiCall->arguments()[apiCall->binaryDataIndex()].toByteArray();
binaryDataSize += data.size();
}
if (call->flags & trace::CALL_FLAG_END_FRAME) {
allCalls.squeeze();
topLevelItems.squeeze();
if (topLevelItems.count() == allCalls.count()) {
currentFrame->setCalls(allCalls, allCalls, binaryDataSize);
} else {
currentFrame->setCalls(topLevelItems, allCalls, binaryDataSize);
}
allCalls.clear();
groups.clear();
topLevelItems.clear();
frames.append(currentFrame);
currentFrame = 0;
binaryDataSize = 0;
if (frames.count() >= FRAMES_TO_CACHE) {
emit framesLoaded(frames);
frames.clear();
}
if (m_parser.percentRead() - lastPercentReport >= 5) {
emit parsed(m_parser.percentRead());
lastPercentReport = m_parser.percentRead();
}
}
delete call;
call = m_parser.parse_call();
}
//last frames won't have markers
// it's just a bunch of Delete calls for every object
// after the last SwapBuffers
if (currentFrame) {
allCalls.squeeze();
if (topLevelItems.count() == allCalls.count()) {
currentFrame->setCalls(allCalls, allCalls, binaryDataSize);
} else {
currentFrame->setCalls(topLevelItems, allCalls, binaryDataSize);
}
frames.append(currentFrame);
currentFrame = 0;
}
if (frames.count()) {
emit framesLoaded(frames);
}
}