Example #1
0
    DiString DiProfiler::GetData(bool showUnused, bool showTotal, unsigned maxDepth) const
    {
        DiString output;

        if (!showTotal)
            output += DiString("Block                            Cnt     Avg      Max     Frame     Total\n\n");
        else
        {
            output += DiString("Block                                       Last frame                       Whole execution time\n\n");
            output += DiString("                                 Cnt     Avg      Max      Total      Cnt      Avg       Max        Total\n\n");
        }

        if (!maxDepth)
            maxDepth = 1;

        GetData(mRoot, output, 0, maxDepth, showUnused, showTotal);

        return output;
    }
Example #2
0
    void DiProfiler::GetData(DiProfilerBlock* block, DiString& output, unsigned depth, unsigned maxDepth, bool showUnused, bool showTotal) const
    {
        char line[LINE_MAX_LENGTH];
        char indentedName[LINE_MAX_LENGTH];

        unsigned intervalFrames = DiMath::Max(mIntervalFrames, 1);

        if (depth >= maxDepth)
            return;

        // Do not print the root block as it does not collect any actual data
        if (block != mRoot)
        {
            if (showUnused || block->mIntervalCount || (showTotal && block->mTotalCount))
            {
                memset(indentedName, ' ', NAME_MAX_LENGTH);
                indentedName[depth] = 0;
                strcat(indentedName, block->mName);
                indentedName[strlen(indentedName)] = ' ';
                indentedName[NAME_MAX_LENGTH] = 0;

                if (!showTotal)
                {
                    double avg = (block->mIntervalCount ? block->mIntervalTime / block->mIntervalCount : 0.0f);
                    double max = block->mIntervalMaxTime;
                    double frame = block->mIntervalTime / intervalFrames;
                    double all = block->mIntervalTime;

                    sprintf(line, "%s %5u %8.3f %8.3f %8.3f %9.3f\n", indentedName, block->mIntervalCount, avg, max, frame, all);
                }
                else
                {
                    double avg = (block->mFrameCount ? block->mFrameTime / block->mFrameCount : 0.0f);
                    double max = block->mFrameMaxTime;
                    double all = block->mFrameTime;

                    double totalAvg = (block->mTotalCount ? block->mTotalTime / block->mTotalCount : 0.0f);
                    double totalMax = block->mTotalMaxTime;
                    double totalAll = block->mTotalTime;

                    sprintf(line, "%s %5u %8.3f %8.3f %9.3f  %7u %9.3f %9.3f %11.3f\n", indentedName, block->mFrameCount, avg, max,
                        all, block->mTotalCount, totalAvg, totalMax, totalAll);
                }

                output += DiString(line);
            }

            ++depth;
        }

        for (auto i = block->mChildren.begin(); i != block->mChildren.end(); ++i)
            GetData(*i, output, depth, maxDepth, showUnused, showTotal);
    }
Example #3
0
    void FilesView::notifyTreeNodeSelected(MyGUI::TreeControl* pTreeControl, MyGUI::TreeControl::Node* pNode)
    {
        if (!pNode || pNode->emptyData())
            return;

        DiFileTree* filetree = *(pNode->getData<DiFileTree*>(false));
        if (!filetree || filetree->folder)
            return;

        DiString fullpath = pNode->getText().asUTF8().c_str();
        MyGUI::TreeControl::Node* cur = pNode->getParent();
        while (cur->getParent())
        {
            fullpath = cur->getText().asUTF8().c_str() + DiString("/") + fullpath;
            cur = cur->getParent();
        }
        DI_DEBUG("Model %s selected", fullpath.c_str());
        HonViewerApp::GetViewerApp()->GetModelViewer()->LoadModel(fullpath);
    }