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


C++ SliceData::duration方法代码示例

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


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

示例1:

void
Statistics::gcDuration(int64_t *total, int64_t *maxPause)
{
    *total = *maxPause = 0;
    for (SliceData *slice = slices.begin(); slice != slices.end(); slice++) {
        *total += slice->duration();
        if (slice->duration() > *maxPause)
            *maxPause = slice->duration();
    }
}
开发者ID:jrmuizel,项目名称:mozilla-central-skia,代码行数:10,代码来源:Statistics.cpp

示例2: DuplicateString

UniqueChars
Statistics::formatJsonSliceDescription(unsigned i, const SliceData& slice)
{
    int64_t duration = slice.duration();
    int64_t when = slice.start - slices[0].start;
    char budgetDescription[200];
    slice.budget.describe(budgetDescription, sizeof(budgetDescription) - 1);
    int64_t pageFaults = slice.endFaults - slice.startFaults;

    const char* format =
        "\"slice\":%d,"
        "\"pause\":%llu.%03llu,"
        "\"when\":%llu.%03llu,"
        "\"reason\":\"%s\","
        "\"initial_state\":\"%s\","
        "\"final_state\":\"%s\","
        "\"budget\":\"%s\","
        "\"page_faults\":%llu,"
        "\"start_timestamp\":%llu,"
        "\"end_timestamp\":%llu,";
    char buffer[1024];
    SprintfLiteral(buffer, format,
                   i,
                   duration / 1000, duration % 1000,
                   when / 1000, when % 1000,
                   ExplainReason(slice.reason),
                   gc::StateName(slice.initialState),
                   gc::StateName(slice.finalState),
                   budgetDescription,
                   pageFaults,
                   slice.start,
                   slice.end);
    return DuplicateString(buffer);
}
开发者ID:mephisto41,项目名称:gecko-dev,代码行数:34,代码来源:Statistics.cpp

示例3: DuplicateString

UniqueChars
Statistics::formatDetailedSliceDescription(unsigned i, const SliceData& slice)
{
    char budgetDescription[200];
    slice.budget.describe(budgetDescription, sizeof(budgetDescription) - 1);

    const char* format =
"\
  ---- Slice %u ----\n\
    Reason: %s\n\
    Reset: %s%s\n\
    State: %s -> %s\n\
    Page Faults: %ld\n\
    Pause: %.3fms of %s budget (@ %.3fms)\n\
";
    char buffer[1024];
    memset(buffer, 0, sizeof(buffer));
    JS_snprintf(buffer, sizeof(buffer), format, i,
                ExplainReason(slice.reason),
                slice.resetReason ? "yes - " : "no", slice.resetReason ? slice.resetReason : "",
                gc::StateName(slice.initialState), gc::StateName(slice.finalState),
                uint64_t(slice.endFaults - slice.startFaults),
                t(slice.duration()), budgetDescription, t(slice.start - slices[0].start));
    return DuplicateString(buffer);
}
开发者ID:cliqz-oss,项目名称:browser-f,代码行数:25,代码来源:Statistics.cpp

示例4: computeMMU

bool
Statistics::formatData(StatisticsSerializer &ss, uint64_t timestamp)
{
    int64_t total = 0, longest = 0;
    for (SliceData *slice = slices.begin(); slice != slices.end(); slice++) {
        total += slice->duration();
        if (slice->duration() > longest)
            longest = slice->duration();
    }

    double mmu20 = computeMMU(20 * PRMJ_USEC_PER_MSEC);
    double mmu50 = computeMMU(50 * PRMJ_USEC_PER_MSEC);

    ss.beginObject(NULL);
    if (ss.isJSON())
        ss.appendNumber("Timestamp", "%llu", "", (unsigned long long)timestamp);
    ss.appendDecimal("Total Time", "ms", t(total));
    ss.appendNumber("Compartments Collected", "%d", "", collectedCount);
    ss.appendNumber("Total Compartments", "%d", "", compartmentCount);
    ss.appendNumber("MMU (20ms)", "%d", "%", int(mmu20 * 100));
    ss.appendNumber("MMU (50ms)", "%d", "%", int(mmu50 * 100));
    if (slices.length() > 1 || ss.isJSON())
        ss.appendDecimal("Max Pause", "ms", t(longest));
    else
        ss.appendString("Reason", ExplainReason(slices[0].reason));
    if (nonincrementalReason || ss.isJSON()) {
        ss.appendString("Nonincremental Reason",
                        nonincrementalReason ? nonincrementalReason : "none");
    }
    ss.appendNumber("Allocated", "%u", "MB", unsigned(preBytes / 1024 / 1024));
    ss.appendNumber("+Chunks", "%d", "", counts[STAT_NEW_CHUNK]);
    ss.appendNumber("-Chunks", "%d", "", counts[STAT_DESTROY_CHUNK]);
    ss.endLine();

    if (slices.length() > 1 || ss.isJSON()) {
        ss.beginArray("Slices");
        for (size_t i = 0; i < slices.length(); i++) {
            int64_t width = slices[i].duration();
            if (i != 0 && i != slices.length() - 1 && width < SLICE_MIN_REPORT_TIME &&
                !slices[i].resetReason && !ss.isJSON())
            {
                continue;
            }

            ss.beginObject(NULL);
            ss.extra("    ");
            ss.appendNumber("Slice", "%d", "", i);
            ss.appendDecimal("Pause", "", t(width));
            ss.extra(" (");
            ss.appendDecimal("When", "ms", t(slices[i].end - slices[0].start));
            ss.appendString("Reason", ExplainReason(slices[i].reason));
            if (slices[i].resetReason)
                ss.appendString("Reset", slices[i].resetReason);
            ss.extra("): ");
            FormatPhaseTimes(ss, "Times", slices[i].phaseTimes);
            if (ss.isJSON())
                FormatPhaseFaults(ss, "Page Faults", slices[i].phaseFaults);
            ss.endLine();
            ss.endObject();
        }
        ss.endArray();
    }
    ss.extra("    Totals: ");
    FormatPhaseTimes(ss, "Totals", phaseTimes);
    if (ss.isJSON())
        FormatPhaseFaults(ss, "Total Page Faults", phaseFaults);
    ss.endObject();

    return !ss.isOOM();
}
开发者ID:marshall,项目名称:mozilla-central,代码行数:70,代码来源:Statistics.cpp


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