示例#1
0
Statistics::Statistics(JSRuntime *rt)
  : runtime(rt),
    startupTime(PRMJ_Now()),
    fp(NULL),
    fullFormat(false),
    gcDepth(0),
    collectedCount(0),
    compartmentCount(0),
    nonincrementalReason(NULL)
{
    PodArrayZero(phaseTotals);
    PodArrayZero(counts);

    char *env = getenv("MOZ_GCTIMER");
    if (!env || strcmp(env, "none") == 0) {
        fp = NULL;
        return;
    }

    if (strcmp(env, "stdout") == 0) {
        fullFormat = false;
        fp = stdout;
    } else if (strcmp(env, "stderr") == 0) {
        fullFormat = false;
        fp = stderr;
    } else {
        fullFormat = true;

        fp = fopen(env, "a");
        JS_ASSERT(fp);
    }
}
示例#2
0
void
Statistics::beginGC()
{
    PodArrayZero(phaseStarts);
    PodArrayZero(phaseTimes);

    slices.clearAndFree();
    wasReset = false;

    Probes::GCStart();
}
示例#3
0
void
Statistics::beginGC()
{
    PodArrayZero(phaseStartTimes);
    PodArrayZero(phaseTimes);

    slices.clearAndFree();
    nonincrementalReason = NULL;

    preBytes = runtime->gcBytes;

    Probes::GCStart();
}
示例#4
0
void
Statistics::endSlice()
{
    slices.back().end = PRMJ_Now();
    slices.back().endFaults = gc::GetPageFaultCount();

    if (JSAccumulateTelemetryDataCallback cb = runtime->telemetryCallback) {
        (*cb)(JS_TELEMETRY_GC_SLICE_MS, t(slices.back().end - slices.back().start));
        (*cb)(JS_TELEMETRY_GC_RESET, !!slices.back().resetReason);
    }

    bool last = runtime->gcIncrementalState == gc::NO_INCREMENTAL;
    if (last)
        endGC();

    // Slice callbacks should only fire for the outermost level
    if (--gcDepth == 0) {
        bool wasFullGC = collectedCount == compartmentCount;
        if (GCSliceCallback cb = runtime->gcSliceCallback)
            (*cb)(runtime, last ? GC_CYCLE_END : GC_SLICE_END, GCDescription(!wasFullGC));
    }

    /* Do this after the slice callback since it uses these values. */
    if (last)
        PodArrayZero(counts);
}
示例#5
0
void
Statistics::endSlice()
{
    slices.back().end = PRMJ_Now();

    if (JSAccumulateTelemetryDataCallback cb = runtime->telemetryCallback) {
        (*cb)(JS_TELEMETRY_GC_SLICE_MS, t(slices.back().end - slices.back().start));
        (*cb)(JS_TELEMETRY_GC_RESET, !!slices.back().resetReason);
    }

    bool last = runtime->gcIncrementalState == gc::NO_INCREMENTAL;
    if (last)
        endGC();

    if (GCSliceCallback cb = runtime->gcSliceCallback) {
        if (last)
            (*cb)(runtime, GC_CYCLE_END, GCDescription(!!compartment));
        else
            (*cb)(runtime, GC_SLICE_END, GCDescription(!!compartment));
    }

    /* Do this after the slice callback since it uses these values. */
    if (last)
        PodArrayZero(counts);
}
示例#6
0
void
Statistics::endGC()
{
    Probes::GCEnd();
    crash::SnapshotGCStack();

    for (int i = 0; i < PHASE_LIMIT; i++)
        phaseTotals[i] += phaseTimes[i];

    if (JSAccumulateTelemetryDataCallback cb = runtime->telemetryCallback) {
        (*cb)(JS_TELEMETRY_GC_IS_COMPARTMENTAL, compartment ? 1 : 0);
        (*cb)(JS_TELEMETRY_GC_MS, t(gcDuration()));
        (*cb)(JS_TELEMETRY_GC_MARK_MS, t(phaseTimes[PHASE_MARK]));
        (*cb)(JS_TELEMETRY_GC_SWEEP_MS, t(phaseTimes[PHASE_SWEEP]));
        (*cb)(JS_TELEMETRY_GC_RESET, wasReset);
        (*cb)(JS_TELEMETRY_GC_INCREMENTAL_DISABLED, !runtime->gcIncrementalEnabled);

        double mmu50 = computeMMU(50 * PRMJ_USEC_PER_MSEC);
        (*cb)(JS_TELEMETRY_GC_MMU_50, mmu50 * 100);
    }

    if (fp)
        printStats();

    PodArrayZero(counts);
}
示例#7
0
 virtual void AddBox(nsIFrame* aFrame) override
 {
   nsIFrame* f = aFrame;
   nsRect box = GetBoxRectForFrame(&f, mBoxType);
   nsPoint appUnits[4] =
     { box.TopLeft(), box.TopRight(), box.BottomRight(), box.BottomLeft() };
   CSSPoint points[4];
   for (uint32_t i = 0; i < 4; ++i) {
     points[i] = CSSPoint(nsPresContext::AppUnitsToFloatCSSPixels(appUnits[i].x),
                          nsPresContext::AppUnitsToFloatCSSPixels(appUnits[i].y));
   }
   nsLayoutUtils::TransformResult rv =
     nsLayoutUtils::TransformPoints(f, mRelativeToFrame, 4, points);
   if (rv == nsLayoutUtils::TRANSFORM_SUCCEEDED) {
     CSSPoint delta(nsPresContext::AppUnitsToFloatCSSPixels(mRelativeToBoxTopLeft.x),
                    nsPresContext::AppUnitsToFloatCSSPixels(mRelativeToBoxTopLeft.y));
     for (uint32_t i = 0; i < 4; ++i) {
       points[i] -= delta;
     }
   } else {
     PodArrayZero(points);
   }
   mResult.AppendElement(new DOMQuad(mParentObject, points));
 }