Ejemplo n.º 1
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);
}
Ejemplo n.º 2
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);
}
Ejemplo n.º 3
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));

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

    if (GCSliceCallback cb = runtime->gcSliceCallback) {
        if (last)
            (*cb)(runtime, GC_CYCLE_END, GCDescription(formatData(), !!compartment));
        else
            (*cb)(runtime, GC_SLICE_END, GCDescription(NULL, !!compartment));
    }
}
Ejemplo n.º 4
0
void
Statistics::beginSlice(JSCompartment *comp, gcreason::Reason reason)
{
    compartment = comp;

    bool first = runtime->gcIncrementalState == gc::NO_INCREMENTAL;
    if (first)
        beginGC();

    SliceData data(reason, PRMJ_Now());
    (void) slices.append(data); /* Ignore any OOMs here. */

    if (JSAccumulateTelemetryDataCallback cb = runtime->telemetryCallback)
        (*cb)(JS_TELEMETRY_GC_REASON, reason);

    if (GCSliceCallback cb = runtime->gcSliceCallback)
        (*cb)(runtime, first ? GC_CYCLE_BEGIN : GC_SLICE_BEGIN, GCDescription(!!compartment));
}
Ejemplo n.º 5
0
void
Statistics::beginSlice(int collectedCount, int compartmentCount, gcreason::Reason reason)
{
    this->collectedCount = collectedCount;
    this->compartmentCount = compartmentCount;

    bool first = runtime->gcIncrementalState == gc::NO_INCREMENTAL;
    if (first)
        beginGC();

    SliceData data(reason, PRMJ_Now(), gc::GetPageFaultCount());
    (void) slices.append(data); /* Ignore any OOMs here. */

    if (JSAccumulateTelemetryDataCallback cb = runtime->telemetryCallback)
        (*cb)(JS_TELEMETRY_GC_REASON, reason);

    // Slice callbacks should only fire for the outermost level
    if (++gcDepth == 1) {
        bool wasFullGC = collectedCount == compartmentCount;
        if (GCSliceCallback cb = runtime->gcSliceCallback)
            (*cb)(runtime, first ? GC_CYCLE_BEGIN : GC_SLICE_BEGIN, GCDescription(!wasFullGC));
    }
}