зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1159506
- Make GC events use TimeStamp. r=terrence
This commit is contained in:
Родитель
1c7eb5ac99
Коммит
c32fef3104
|
@ -285,8 +285,8 @@ class GarbageCollectionEvent
|
|||
// Represents a single slice of a possibly multi-slice incremental garbage
|
||||
// collection.
|
||||
struct Collection {
|
||||
int64_t startTimestamp;
|
||||
int64_t endTimestamp;
|
||||
double startTimestamp;
|
||||
double endTimestamp;
|
||||
};
|
||||
|
||||
// The set of garbage collection slices that made up this GC cycle.
|
||||
|
|
|
@ -931,7 +931,7 @@ Statistics::beginSlice(const ZoneGCStats& zoneStats, JSGCInvocationKind gckind,
|
|||
if (first)
|
||||
beginGC(gckind);
|
||||
|
||||
SliceData data(budget, reason, PRMJ_Now(), GetPageFaultCount());
|
||||
SliceData data(budget, reason, PRMJ_Now(), JS_GetCurrentEmbedderTime(), GetPageFaultCount());
|
||||
if (!slices.append(data)) {
|
||||
// OOM testing fails if we CrashAtUnhandlableOOM here.
|
||||
aborted = true;
|
||||
|
@ -954,6 +954,7 @@ Statistics::endSlice()
|
|||
{
|
||||
if (!aborted) {
|
||||
slices.back().end = PRMJ_Now();
|
||||
slices.back().endTimestamp = JS_GetCurrentEmbedderTime();
|
||||
slices.back().endFaults = GetPageFaultCount();
|
||||
|
||||
int64_t sliceTime = slices.back().end - slices.back().start;
|
||||
|
|
|
@ -211,10 +211,12 @@ struct Statistics
|
|||
static const size_t MAX_NESTING = 20;
|
||||
|
||||
struct SliceData {
|
||||
SliceData(SliceBudget budget, JS::gcreason::Reason reason, int64_t start, size_t startFaults)
|
||||
SliceData(SliceBudget budget, JS::gcreason::Reason reason, int64_t start,
|
||||
double startTimestamp, size_t startFaults)
|
||||
: budget(budget), reason(reason),
|
||||
resetReason(nullptr),
|
||||
start(start), startFaults(startFaults)
|
||||
start(start), startTimestamp(startTimestamp),
|
||||
startFaults(startFaults)
|
||||
{
|
||||
for (auto i : mozilla::MakeRange(NumTimingArrays))
|
||||
mozilla::PodArrayZero(phaseTimes[i]);
|
||||
|
@ -224,6 +226,7 @@ struct Statistics
|
|||
JS::gcreason::Reason reason;
|
||||
const char* resetReason;
|
||||
int64_t start, end;
|
||||
double startTimestamp, endTimestamp;
|
||||
size_t startFaults, endFaults;
|
||||
PhaseTimeTable phaseTimes;
|
||||
|
||||
|
|
|
@ -8056,8 +8056,8 @@ GarbageCollectionEvent::Create(JSRuntime* rt, ::js::gcstats::Statistics& stats,
|
|||
if (!data->collections.growBy(1))
|
||||
return nullptr;
|
||||
|
||||
data->collections.back().startTimestamp = range.front().start;
|
||||
data->collections.back().endTimestamp = range.front().end;
|
||||
data->collections.back().startTimestamp = range.front().startTimestamp;
|
||||
data->collections.back().endTimestamp = range.front().endTimestamp;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -182,9 +182,6 @@ let Timeline = exports.Timeline = Class({
|
|||
*/
|
||||
start: Task.async(function *({ withMemory, withTicks }) {
|
||||
let startTime = this._startTime = this.docShells[0].now();
|
||||
// Store the start time from unix epoch so we can normalize
|
||||
// markers from the memory actor
|
||||
this._unixStartTime = Date.now();
|
||||
|
||||
if (this._isRecording) {
|
||||
return startTime;
|
||||
|
@ -266,9 +263,6 @@ let Timeline = exports.Timeline = Class({
|
|||
return;
|
||||
}
|
||||
|
||||
// Normalize the start time to docshell start time, and convert it
|
||||
// to microseconds.
|
||||
let startTime = (this._unixStartTime - this._startTime) * 1000;
|
||||
let endTime = this.docShells[0].now();
|
||||
|
||||
events.emit(this, "markers", collections.map(({ startTimestamp: start, endTimestamp: end }) => {
|
||||
|
@ -277,8 +271,8 @@ let Timeline = exports.Timeline = Class({
|
|||
causeName: reason,
|
||||
nonincrementalReason: nonincrementalReason,
|
||||
// Both timestamps are in microseconds -- convert to milliseconds to match other markers
|
||||
start: (start - startTime) / 1000,
|
||||
end: (end - startTime) / 1000
|
||||
start: start,
|
||||
end: end
|
||||
};
|
||||
}), endTime);
|
||||
},
|
||||
|
|
Загрузка…
Ссылка в новой задаче