当前位置: 首页>>代码示例>>C++>>正文


C++ ApiTraceFrame::setCalls方法代码示例

本文整理汇总了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);
    }
}
开发者ID:rawoul,项目名称:apitrace,代码行数:60,代码来源:traceloader.cpp

示例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);
    }
}
开发者ID:Acidburn0zzz,项目名称:apitrace,代码行数:56,代码来源:traceloader.cpp

示例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);
    }
}
开发者ID:is00hcw,项目名称:apitrace,代码行数:84,代码来源:traceloader.cpp


注:本文中的ApiTraceFrame::setCalls方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。