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


C++ PlanStage::getCommonStats方法代码示例

本文整理汇总了C++中PlanStage::getCommonStats方法的典型用法代码示例。如果您正苦于以下问题:C++ PlanStage::getCommonStats方法的具体用法?C++ PlanStage::getCommonStats怎么用?C++ PlanStage::getCommonStats使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PlanStage的用法示例。


在下文中一共展示了PlanStage::getCommonStats方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: getSummaryStats

    // static
    void Explain::getSummaryStats(PlanExecutor* exec, PlanSummaryStats* statsOut) {
        invariant(NULL != statsOut);

        PlanStage* root = exec->getRootStage();

        // We can get some of the fields we need from the common stats stored in the
        // root stage of the plan tree.
        const CommonStats* common = root->getCommonStats();
        statsOut->nReturned = common->advanced;
        statsOut->executionTimeMillis = common->executionTimeMillis;

        // Generate the plan summary string.
        statsOut->summaryStr = getPlanSummary(root);

        // The other fields are aggregations over the stages in the plan tree. We flatten
        // the tree into a list and then compute these aggregations.
        vector<PlanStage*> stages;
        flattenExecTree(root, &stages);

        for (size_t i = 0; i < stages.size(); i++) {
            statsOut->totalKeysExamined += getKeysExamined(stages[i]->stageType(),
                                                           stages[i]->getSpecificStats());
            statsOut->totalDocsExamined += getDocsExamined(stages[i]->stageType(),
                                                           stages[i]->getSpecificStats());

            if (STAGE_IDHACK == stages[i]->stageType()) {
                statsOut->isIdhack = true;
            }
            if (STAGE_SORT == stages[i]->stageType()) {
                statsOut->hasSortStage = true;
            }
        }
    }
开发者ID:FromPointer,项目名称:mongo,代码行数:34,代码来源:explain.cpp

示例2: getSummaryStats

    void Explain::getSummaryStats(PlanExecutor* exec, PlanSummaryStats* statsOut) {
        invariant(NULL != statsOut);

        PlanStage* root = exec->getStages();

        // We can get some of the fields we need from the common stats stored in the
        // root stage of the plan tree.
        const CommonStats* common = root->getCommonStats();
        statsOut->nReturned = common->advanced;
        statsOut->executionTimeMillis = common->executionTimeMillis;

        // The other fields are aggregations over the stages in the plan tree. We flatten
        // the tree into a list and then compute these aggregations.
        vector<PlanStage*> stages;
        flattenExecTree(root, &stages);

        // Use this stream to build the plan summary string.
        mongoutils::str::stream ss;
        bool seenLeaf = false;

        for (size_t i = 0; i < stages.size(); i++) {
            statsOut->totalKeysExamined += getKeysExamined(stages[i]->stageType(),
                                                           stages[i]->getSpecificStats());
            statsOut->totalDocsExamined += getDocsExamined(stages[i]->stageType(),
                                                           stages[i]->getSpecificStats());

            if (STAGE_IDHACK == stages[i]->stageType()) {
                statsOut->isIdhack = true;
            }
            if (STAGE_SORT == stages[i]->stageType()) {
                statsOut->hasSortStage = true;
            }

            if (stages[i]->getChildren().empty()) {
                // This is a leaf node. Add to the plan summary string accordingly. Unless
                // this is the first leaf we've seen, add a delimiting string first.
                if (seenLeaf) {
                    ss << ", ";
                }
                else {
                    seenLeaf = true;
                }
                addStageSummaryStr(stages[i], ss);
            }
        }

        statsOut->summaryStr = ss;
    }
开发者ID:DeathBorn,项目名称:mongo,代码行数:48,代码来源:explain.cpp


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