Bug 1666222: Cut over a ton of NowUnfuzzed calls -> Now 4/5 r=smaug,extension-reviewers,zombie

With Fuzzyfox removed, Now() does what NowUnfuzzed() did.

Differential Revision: https://phabricator.services.mozilla.com/D119639
This commit is contained in:
Tom Ritter
2021-07-14 18:18:17 +00:00
parent ab5c4d9436
commit 7830c4464f
37 changed files with 98 additions and 106 deletions

View File

@@ -1064,7 +1064,7 @@ nsresult EventDispatcher::Dispatch(nsISupports* aTarget,
}
};
auto startTime = TimeStamp::NowUnfuzzed();
auto startTime = TimeStamp::Now();
profiler_add_marker("DOMEvent", geckoprofiler::category::DOM,
{MarkerTiming::IntervalStart(),
MarkerInnerWindowId(innerWindowId)},

View File

@@ -105,7 +105,7 @@ void DocumentL10n::TriggerInitialTranslation() {
if (mState >= DocumentL10nState::InitialTranslationTriggered) {
return;
}
mInitialTranslationStart = mozilla::TimeStamp::NowUnfuzzed();
mInitialTranslationStart = mozilla::TimeStamp::Now();
AutoAllowLegacyScriptExecution exemption;
@@ -247,7 +247,7 @@ already_AddRefed<Promise> DocumentL10n::TranslateDocument(ErrorResult& aRv) {
}
void DocumentL10n::MaybeRecordTelemetry() {
mozilla::TimeStamp initialTranslationEnd = mozilla::TimeStamp::NowUnfuzzed();
mozilla::TimeStamp initialTranslationEnd = mozilla::TimeStamp::Now();
nsAutoString documentURI;
ErrorResult rv;

View File

@@ -123,7 +123,7 @@ class AsyncLogger {
auto* msg = new MPSCQueue<TracePayload>::Message();
msg->data.mTID = profiler_current_thread_id();
msg->data.mPhase = aPhase;
msg->data.mTimestamp = TimeStamp::NowUnfuzzed();
msg->data.mTimestamp = TimeStamp::Now();
msg->data.mDurationUs = 0; // unused, duration is end - begin
size_t len = std::min(strlen(aName), ArrayLength(msg->data.mName));
memcpy(msg->data.mName, aName, len);
@@ -151,7 +151,7 @@ class AsyncLogger {
auto* msg = new MPSCQueue<TracePayload>::Message();
msg->data.mTID = profiler_current_thread_id();
msg->data.mPhase = TracingPhase::COMPLETE;
msg->data.mTimestamp = TimeStamp::NowUnfuzzed();
msg->data.mTimestamp = TimeStamp::Now();
msg->data.mDurationUs =
(static_cast<double>(aFrames) / aSampleRate) * 1e6;
size_t len = std::min(strlen(aName), ArrayLength(msg->data.mName));
@@ -236,8 +236,8 @@ class AsyncLogger {
}
uint64_t NowInUs() {
static TimeStamp base = TimeStamp::NowUnfuzzed();
return (TimeStamp::NowUnfuzzed() - base).ToMicroseconds();
static TimeStamp base = TimeStamp::Now();
return (TimeStamp::Now() - base).ToMicroseconds();
}
void Sleep() { std::this_thread::sleep_for(std::chrono::milliseconds(10)); }

View File

@@ -39,7 +39,7 @@ DOMHighResTimeStamp RTCStatsTimestampMaker::GetNow() const {
// We are very careful to do exactly what Performance does, to avoid timestamp
// discrepancies.
DOMHighResTimeStamp msSinceStart =
(TimeStamp::NowUnfuzzed() - mStartMonotonic).ToMilliseconds();
(TimeStamp::Now() - mStartMonotonic).ToMilliseconds();
// mRandomTimelineSeed is not set in the unit-tests.
if (mRandomTimelineSeed) {
msSinceStart = nsRFPService::ReduceTimePrecisionAsMSecs(

View File

@@ -34,7 +34,7 @@ class RTCStatsTimestampMaker {
private:
uint64_t mRandomTimelineSeed = 0;
DOMHighResTimeStamp mStartWallClockRaw = (double)PR_Now() / PR_USEC_PER_MSEC;
TimeStamp mStartMonotonic = TimeStamp::NowUnfuzzed();
TimeStamp mStartMonotonic = TimeStamp::Now();
bool mCrossOriginIsolated = false;
};

View File

@@ -112,7 +112,7 @@ DOMHighResTimeStamp Performance::Now() {
}
DOMHighResTimeStamp Performance::NowUnclamped() const {
TimeDuration duration = TimeStamp::NowUnfuzzed() - CreationTimeStamp();
TimeDuration duration = TimeStamp::Now() - CreationTimeStamp();
return duration.ToMilliseconds();
}

View File

@@ -2510,8 +2510,7 @@ static void OffThreadScriptLoaderCallback(JS::OffThreadToken* aToken,
static_cast<NotifyOffThreadScriptLoadCompletedRunnable*>(aCallbackData));
MOZ_ASSERT(aRunnable.get() == aRunnable->GetScriptLoadRequest()->mRunnable);
aRunnable->GetScriptLoadRequest()->mOffThreadParseStopTime =
TimeStamp::NowUnfuzzed();
aRunnable->GetScriptLoadRequest()->mOffThreadParseStopTime = TimeStamp::Now();
LogRunnable::Run run(aRunnable);
@@ -2587,7 +2586,7 @@ nsresult ScriptLoader::AttemptAsyncScriptCompile(ScriptLoadRequest* aRequest,
// OffThreadScriptLoaderCallback were we will emulate run.
LogRunnable::LogDispatch(runnable);
aRequest->mOffThreadParseStartTime = TimeStamp::NowUnfuzzed();
aRequest->mOffThreadParseStartTime = TimeStamp::Now();
// Save the runnable so it can be properly cleared during cancellation.
aRequest->mRunnable = runnable.get();

View File

@@ -47,12 +47,12 @@ void CompositionRecorder::WriteCollectedFrames() {
// of milliseconds between midnight 1 January 1970 UTC and mRecordingStart,
// unfortunately, mozilla::TimeStamp does not have a built-in way of doing
// that. However, PR_Now() returns the number of microseconds since midnight 1
// January 1970 UTC. We call PR_Now() and TimeStamp::NowUnfuzzed() very
// January 1970 UTC. We call PR_Now() and TimeStamp::Now() very
// closely to each other so that they return their representation of "the same
// time", and then compute (Now - (Now - mRecordingStart)).
std::stringstream str;
nsCString recordingStartTime;
TimeDuration delta = TimeStamp::NowUnfuzzed() - mRecordingStart;
TimeDuration delta = TimeStamp::Now() - mRecordingStart;
recordingStartTime.AppendFloat(
static_cast<double>(PR_Now() / 1000.0 - delta.ToMilliseconds()));
str << gfxVars::LayersWindowRecordingPath() << "windowrecording-"
@@ -81,7 +81,7 @@ void CompositionRecorder::WriteCollectedFrames() {
CollectedFrames CompositionRecorder::GetCollectedFrames() {
nsTArray<CollectedFrame> frames;
TimeDuration delta = TimeStamp::NowUnfuzzed() - mRecordingStart;
TimeDuration delta = TimeStamp::Now() - mRecordingStart;
double recordingStart = PR_Now() / 1000.0 - delta.ToMilliseconds();
for (RefPtr<RecordedFrame>& frame : mCollectedFrames) {

View File

@@ -74,7 +74,7 @@ void SurfacePoolCA::LockedPool::MutateEntryStorage(const char* aMutationType,
[[maybe_unused]] size_t inUseCountBefore = mInUseEntries.size();
[[maybe_unused]] size_t pendingCountBefore = mPendingEntries.Length();
[[maybe_unused]] size_t availableCountBefore = mAvailableEntries.Length();
[[maybe_unused]] TimeStamp before = TimeStamp::NowUnfuzzed();
[[maybe_unused]] TimeStamp before = TimeStamp::Now();
aFn();

View File

@@ -81,7 +81,7 @@ void gecko_profiler_event_marker(const char* name) {
void gecko_profiler_add_text_marker(const char* name, const char* text_bytes,
size_t text_len, uint64_t microseconds) {
if (profiler_thread_is_being_profiled()) {
auto now = mozilla::TimeStamp::NowUnfuzzed();
auto now = mozilla::TimeStamp::Now();
[[maybe_unused]] auto start =
now - mozilla::TimeDuration::FromMicroseconds(microseconds);
PROFILER_MARKER_TEXT(
@@ -2157,7 +2157,7 @@ void WebRenderBridgeParent::MaybeGenerateFrame(VsyncId aId,
if (CompositorBridgeParent* cbp = GetRootCompositorBridgeParent()) {
// Skip WR render during paused state.
if (cbp->IsPaused()) {
TimeStamp now = TimeStamp::NowUnfuzzed();
TimeStamp now = TimeStamp::Now();
PROFILER_MARKER_TEXT("SkippedComposite", GRAPHICS,
MarkerTiming::InstantAt(now),
"CompositorBridgeParent is paused");

View File

@@ -216,7 +216,7 @@ void RenderCompositorNative::CompositorBeginFrame() {
mAddedLayers.Clear();
mAddedTilePixelCount = 0;
mAddedClippedPixelCount = 0;
mBeginFrameTimeStamp = TimeStamp::NowUnfuzzed();
mBeginFrameTimeStamp = TimeStamp::Now();
mSurfacePoolHandle->OnBeginFrame();
}

View File

@@ -450,7 +450,7 @@ class ImageResource : public Image {
class MOZ_RAII AutoProfilerImagePaintMarker {
public:
explicit AutoProfilerImagePaintMarker(ImageResource* self)
: mStartTime(TimeStamp::NowUnfuzzed()) {
: mStartTime(TimeStamp::Now()) {
nsAutoCString spec;
if (self->mURI && profiler_can_accept_markers()) {
static const size_t sMaxTruncatedLength = 1024;

View File

@@ -29,8 +29,7 @@ void AddIPCProfilerMarker(const Message& aMessage, int32_t aOtherPid,
}
// The current timestamp must be given to the `IPCMarker` payload.
[[maybe_unused]] const mozilla::TimeStamp now =
mozilla::TimeStamp::NowUnfuzzed();
[[maybe_unused]] const mozilla::TimeStamp now = mozilla::TimeStamp::Now();
PROFILER_MARKER("IPC", IPC, mozilla::MarkerTiming::InstantAt(now),
IPCMarker, now, now, aOtherPid, aMessage.seqno(),
aMessage.type(), mozilla::ipc::UnknownSide, aDirection,

View File

@@ -2714,7 +2714,7 @@ void MessageChannel::AddProfilerMarker(const IPC::Message& aMessage,
// profiler itself, and also to avoid possible re-entrancy issues.
if (pid != kInvalidProcessId && !profiler_is_locked_on_current_thread()) {
// The current timestamp must be given to the `IPCMarker` payload.
[[maybe_unused]] const TimeStamp now = TimeStamp::NowUnfuzzed();
[[maybe_unused]] const TimeStamp now = TimeStamp::Now();
PROFILER_MARKER("IPC", IPC, MarkerTiming::InstantAt(now), IPCMarker, now,
now, pid, aMessage.seqno(), aMessage.type(), mSide,
aDirection, MessagePhase::Endpoint, aMessage.is_sync());

View File

@@ -3236,7 +3236,7 @@ class ChildCounter {
// Perform the whole recursive reading procedure.
bool JSStructuredCloneReader::read(MutableHandleValue vp, size_t nbytes) {
auto startTime = mozilla::TimeStamp::NowUnfuzzed();
auto startTime = mozilla::TimeStamp::Now();
if (!readHeader()) {
return false;

View File

@@ -156,7 +156,7 @@ static __inline__ uint64_t ReadTimestampCounter(void) {
namespace js {
static inline mozilla::TimeStamp ReallyNow() {
return mozilla::TimeStamp::NowUnfuzzed();
return mozilla::TimeStamp::Now();
}
class MOZ_RAII AutoIncrementalTimer {

View File

@@ -122,7 +122,7 @@ void TraceLoggerThread::initGraph() {
MOZ_ASSERT(traceLoggerState);
bool graphFile = traceLoggerState->isGraphFileEnabled();
double delta =
traceLoggerState->getTimeStampOffset(mozilla::TimeStamp::NowUnfuzzed());
traceLoggerState->getTimeStampOffset(mozilla::TimeStamp::Now());
uint64_t start = static_cast<uint64_t>(delta);
if (!graph_->init(start, graphFile)) {
graph_ = nullptr;
@@ -974,7 +974,7 @@ void TraceLoggerThread::log(uint32_t id) {
// we record the time it took to make more space. To log this information
// we need 2 extra free entries.
if (!events_.hasSpaceForAdd(3)) {
mozilla::TimeStamp start = mozilla::TimeStamp::NowUnfuzzed();
mozilla::TimeStamp start = mozilla::TimeStamp::Now();
if (!events_.ensureSpaceBeforeAdd(3)) {
if (graph_.get()) {
@@ -1004,12 +1004,12 @@ void TraceLoggerThread::log(uint32_t id) {
entryStart.textId = TraceLogger_Internal;
EventEntry& entryStop = events_.pushUninitialized();
entryStop.time = mozilla::TimeStamp::NowUnfuzzed();
entryStop.time = mozilla::TimeStamp::Now();
entryStop.textId = TraceLogger_Stop;
}
}
mozilla::TimeStamp time = mozilla::TimeStamp::NowUnfuzzed();
mozilla::TimeStamp time = mozilla::TimeStamp::Now();
EventEntry& entry = events_.pushUninitialized();
entry.time = time;
@@ -1259,7 +1259,7 @@ bool TraceLoggerThreadState::init() {
spewErrors = false;
}
startTime = mozilla::TimeStamp::NowUnfuzzed();
startTime = mozilla::TimeStamp::Now();
#ifdef DEBUG
initialized = true;

View File

@@ -1226,10 +1226,10 @@ bool ProfileBuffer::DuplicateLastSample(int aThreadId,
return true;
case ProfileBufferEntry::Kind::Time:
// Copy with new time
AddEntry(tempBuffer,
ProfileBufferEntry::Time(
(TimeStamp::NowUnfuzzed() - aProcessStartTime)
.ToMilliseconds()));
AddEntry(
tempBuffer,
ProfileBufferEntry::Time(
(TimeStamp::Now() - aProcessStartTime).ToMilliseconds()));
break;
case ProfileBufferEntry::Kind::CounterKey:
case ProfileBufferEntry::Kind::Number:

View File

@@ -56,7 +56,7 @@ class ProfiledThreadData final {
MOZ_ASSERT(!mBufferPositionWhenReceivedJSContext,
"JSContext should have been cleared before the thread was "
"unregistered");
mUnregisterTime = TimeStamp::NowUnfuzzed();
mUnregisterTime = TimeStamp::Now();
mBufferPositionWhenUnregistered = Some(aBufferPosition);
}
Maybe<uint64_t> BufferPositionWhenUnregistered() {

View File

@@ -20,7 +20,7 @@ namespace baseprofiler {
class ThreadInfo final {
public:
ThreadInfo(const char* aName, int aThreadId, bool aIsMainThread,
const TimeStamp& aRegisterTime = TimeStamp::NowUnfuzzed())
const TimeStamp& aRegisterTime = TimeStamp::Now())
: mName(aName),
mRegisterTime(aRegisterTime),
mThreadId(aThreadId),

View File

@@ -258,7 +258,7 @@ void SamplerThread::SleepMicro(uint32_t aMicroseconds) {
if (mIntervalMicroseconds >= 1000) {
::Sleep(std::max(1u, aMicroseconds / 1000));
} else {
TimeStamp start = TimeStamp::NowUnfuzzed();
TimeStamp start = TimeStamp::Now();
TimeStamp end = start + TimeDuration::FromMicroseconds(aMicroseconds);
// First, sleep for as many whole milliseconds as possible.
@@ -267,7 +267,7 @@ void SamplerThread::SleepMicro(uint32_t aMicroseconds) {
}
// Then, spin until enough time has passed.
while (TimeStamp::NowUnfuzzed() < end) {
while (TimeStamp::Now() < end) {
YieldProcessor();
}
}

View File

@@ -1822,7 +1822,7 @@ static void StreamMetaJSCustomObject(PSLockRef aLock,
// The "startTime" field holds the number of milliseconds since midnight
// January 1, 1970 GMT. This grotty code computes (Now - (Now -
// ProcessStartTime)) to convert CorePS::ProcessStartTime() into that form.
TimeDuration delta = TimeStamp::NowUnfuzzed() - CorePS::ProcessStartTime();
TimeDuration delta = TimeStamp::Now() - CorePS::ProcessStartTime();
aWriter.DoubleProperty(
"startTime", MicrosecondsSince1970() / 1000.0 - delta.ToMilliseconds());
@@ -2264,13 +2264,13 @@ void SamplerThread::Run() {
// This will be positive if we are running behind schedule (sampling less
// frequently than desired) and negative if we are ahead of schedule.
TimeDuration lastSleepOvershoot = 0;
TimeStamp sampleStart = TimeStamp::NowUnfuzzed();
TimeStamp sampleStart = TimeStamp::Now();
while (true) {
// This scope is for |lock|. It ends before we sleep below.
{
PSAutoLock lock;
TimeStamp lockAcquired = TimeStamp::NowUnfuzzed();
TimeStamp lockAcquired = TimeStamp::Now();
if (!ActivePS::Exists(lock)) {
return;
@@ -2285,7 +2285,7 @@ void SamplerThread::Run() {
ActivePS::ClearExpiredExitProfiles(lock);
TimeStamp expiredMarkersCleaned = TimeStamp::NowUnfuzzed();
TimeStamp expiredMarkersCleaned = TimeStamp::Now();
if (!ActivePS::IsSamplingPaused(lock)) {
TimeDuration delta = sampleStart - CorePS::ProcessStartTime();
@@ -2310,7 +2310,7 @@ void SamplerThread::Run() {
buffer.AddEntry(ProfileBufferEntry::Number(number));
}
}
TimeStamp countersSampled = TimeStamp::NowUnfuzzed();
TimeStamp countersSampled = TimeStamp::Now();
if (stackSampling) {
const Vector<LiveProfiledThreadData>& liveThreads =
@@ -2337,7 +2337,7 @@ void SamplerThread::Run() {
AUTO_PROFILER_STATS(base_SamplerThread_Run_DoPeriodicSample);
TimeStamp now = TimeStamp::NowUnfuzzed();
TimeStamp now = TimeStamp::Now();
// Record the global profiler buffer's range start now, before
// adding the first entry for this thread's sample.
@@ -2393,7 +2393,7 @@ void SamplerThread::Run() {
lul->MaybeShowStats();
}
#endif
TimeStamp threadsSampled = TimeStamp::NowUnfuzzed();
TimeStamp threadsSampled = TimeStamp::Now();
{
AUTO_PROFILER_STATS(Sampler_FulfillChunkRequests);
@@ -2415,12 +2415,12 @@ void SamplerThread::Run() {
// actual sleep intervals.
TimeStamp targetSleepEndTime =
sampleStart + TimeDuration::FromMicroseconds(mIntervalMicroseconds);
TimeStamp beforeSleep = TimeStamp::NowUnfuzzed();
TimeStamp beforeSleep = TimeStamp::Now();
TimeDuration targetSleepDuration = targetSleepEndTime - beforeSleep;
double sleepTime = std::max(
0.0, (targetSleepDuration - lastSleepOvershoot).ToMicroseconds());
SleepMicro(static_cast<uint32_t>(sleepTime));
sampleStart = TimeStamp::NowUnfuzzed();
sampleStart = TimeStamp::Now();
lastSleepOvershoot =
sampleStart - (beforeSleep + TimeDuration::FromMicroseconds(sleepTime));
}
@@ -3545,7 +3545,7 @@ bool profiler_thread_is_sleeping() {
double profiler_time() {
MOZ_RELEASE_ASSERT(CorePS::Exists());
TimeDuration delta = TimeStamp::NowUnfuzzed() - CorePS::ProcessStartTime();
TimeDuration delta = TimeStamp::Now() - CorePS::ProcessStartTime();
return delta.ToMilliseconds();
}
@@ -3576,8 +3576,8 @@ bool profiler_capture_backtrace_into(ProfileChunkedBuffer& aChunkedBuffer,
regs.Clear();
#endif
DoSyncSample(lock, *registeredThread, TimeStamp::NowUnfuzzed(), regs,
profileBuffer, aCaptureOptions);
DoSyncSample(lock, *registeredThread, TimeStamp::Now(), regs, profileBuffer,
aCaptureOptions);
return true;
}
@@ -3713,7 +3713,7 @@ void profiler_suspend_and_sample_thread(int aThreadId, uint32_t aFeatures,
} else {
// Suspend, sample, and then resume the target thread.
Sampler sampler(lock);
TimeStamp now = TimeStamp::NowUnfuzzed();
TimeStamp now = TimeStamp::Now();
sampler.SuspendAndSampleAndResumeThread(lock, registeredThread, now,
collectStack);

View File

@@ -313,9 +313,7 @@ class MarkerTiming {
return MarkerTiming{aTime, TimeStamp{}, MarkerTiming::Phase::Instant};
}
static MarkerTiming InstantNow() {
return InstantAt(TimeStamp::NowUnfuzzed());
}
static MarkerTiming InstantNow() { return InstantAt(TimeStamp::Now()); }
static MarkerTiming Interval(const TimeStamp& aStartTime,
const TimeStamp& aEndTime) {
@@ -326,24 +324,22 @@ class MarkerTiming {
}
static MarkerTiming IntervalUntilNowFrom(const TimeStamp& aStartTime) {
return Interval(aStartTime, TimeStamp::NowUnfuzzed());
return Interval(aStartTime, TimeStamp::Now());
}
static MarkerTiming IntervalStart(
const TimeStamp& aTime = TimeStamp::NowUnfuzzed()) {
static MarkerTiming IntervalStart(const TimeStamp& aTime = TimeStamp::Now()) {
MOZ_ASSERT(!aTime.IsNull(), "Time is null for an interval start marker.");
return MarkerTiming{aTime, TimeStamp{}, MarkerTiming::Phase::IntervalStart};
}
static MarkerTiming IntervalEnd(
const TimeStamp& aTime = TimeStamp::NowUnfuzzed()) {
static MarkerTiming IntervalEnd(const TimeStamp& aTime = TimeStamp::Now()) {
MOZ_ASSERT(!aTime.IsNull(), "Time is null for an interval end marker.");
return MarkerTiming{TimeStamp{}, aTime, MarkerTiming::Phase::IntervalEnd};
}
// Set the interval end in this timing.
// If there was already a start time, this makes it a full interval.
void SetIntervalEnd(const TimeStamp& aTime = TimeStamp::NowUnfuzzed()) {
void SetIntervalEnd(const TimeStamp& aTime = TimeStamp::Now()) {
MOZ_ASSERT(!aTime.IsNull(), "Time is null for an interval end marker.");
mEndTime = aTime;
mPhase = mStartTime.IsNull() ? Phase::IntervalEnd : Phase::Interval;

View File

@@ -77,7 +77,7 @@ class StaticBaseProfilerStats {
void AddDurationFrom(TimeStamp aStart) {
DurationNs duration = static_cast<DurationNs>(
(TimeStamp::NowUnfuzzed() - aStart).ToMicroseconds() * 1000 + 0.5);
(TimeStamp::Now() - aStart).ToMicroseconds() * 1000 + 0.5);
mSumDurationsNs += duration;
++mNumberDurations;
// Update mLongestDurationNs if this one is longer.
@@ -111,7 +111,7 @@ class StaticBaseProfilerStats {
class MOZ_RAII AutoProfilerStats {
public:
explicit AutoProfilerStats(StaticBaseProfilerStats& aStats)
: mStats(aStats), mStart(TimeStamp::NowUnfuzzed()) {}
: mStats(aStats), mStart(TimeStamp::Now()) {}
~AutoProfilerStats() { mStats.AddDurationFrom(mStart); }

View File

@@ -207,7 +207,7 @@ class ProfileBufferChunk {
mInternalHeader.mState == InternalHeader::State::Full);
mInternalHeader.mState = InternalHeader::State::Done;
#endif
mInternalHeader.mHeader.mDoneTimeStamp = TimeStamp::NowUnfuzzed();
mInternalHeader.mHeader.mDoneTimeStamp = TimeStamp::Now();
}
// A "Done" chunk may be recycled, to avoid allocating a new one.

View File

@@ -1830,7 +1830,7 @@ static Result<Ok, PreXULSkeletonUIError> CreateAndStorePreXULSkeletonUIImpl(
sProcessRuntime = new mscom::ProcessRuntime(
mscom::ProcessRuntime::ProcessCategory::GeckoBrowserParent);
const TimeStamp skeletonStart = TimeStamp::NowUnfuzzed();
const TimeStamp skeletonStart = TimeStamp::Now();
if (!IsWin10OrLater()) {
return Err(PreXULSkeletonUIError::Ineligible);

View File

@@ -64,9 +64,8 @@ MOZ_MAYBE_UNUSED static void SleepMilli(unsigned aMilliseconds) {
}
MOZ_MAYBE_UNUSED static void WaitUntilTimeStampChanges(
const mozilla::TimeStamp& aTimeStampToCompare =
mozilla::TimeStamp::NowUnfuzzed()) {
while (aTimeStampToCompare == mozilla::TimeStamp::NowUnfuzzed()) {
const mozilla::TimeStamp& aTimeStampToCompare = mozilla::TimeStamp::Now()) {
while (aTimeStampToCompare == mozilla::TimeStamp::Now()) {
SleepMilli(1);
}
}
@@ -1010,8 +1009,7 @@ static void TestControlledChunkManagerUpdate() {
MOZ_RELEASE_ASSERT(!update1.IsFinal());
auto CreateBiggerChunkAfter = [](const ProfileBufferChunk& aChunkToBeat) {
while (TimeStamp::NowUnfuzzed() <=
aChunkToBeat.ChunkHeader().mDoneTimeStamp) {
while (TimeStamp::Now() <= aChunkToBeat.ChunkHeader().mDoneTimeStamp) {
::SleepMilli(1);
}
auto chunk = ProfileBufferChunk::Create(aChunkToBeat.BufferBytes() * 2);
@@ -1312,8 +1310,8 @@ static void TestControlledChunkManagerWithLocalLimit() {
// Make sure the "Done" timestamp below cannot be the same as from the
// previous loop.
const TimeStamp now = TimeStamp::NowUnfuzzed();
while (TimeStamp::NowUnfuzzed() == now) {
const TimeStamp now = TimeStamp::Now();
while (TimeStamp::Now() == now) {
::SleepMilli(1);
}
@@ -3580,7 +3578,7 @@ MOZ_NEVER_INLINE unsigned long long Fibonacci(unsigned long long n) {
if (DEPTH < 5 && sStopFibonacci) {
return 1'000'000'000;
}
TimeStamp start = TimeStamp::NowUnfuzzed();
TimeStamp start = TimeStamp::Now();
static constexpr size_t MAX_MARKER_DEPTH = 10;
unsigned long long f2 = Fibonacci<NextDepth(DEPTH)>(n - 2);
if (DEPTH == 0) {
@@ -4271,14 +4269,14 @@ void TestUserMarker() {
mozilla::MarkerThreadId(123), MarkerTypeTestMinimal{},
std::string("ThreadId(123)")));
auto start = mozilla::TimeStamp::NowUnfuzzed();
auto start = mozilla::TimeStamp::Now();
MOZ_RELEASE_ASSERT(mozilla::baseprofiler::AddMarkerToBuffer(
buffer, "test2", mozilla::baseprofiler::category::OTHER_Profiling,
mozilla::MarkerTiming::InstantAt(start), MarkerTypeTestMinimal{},
std::string("InstantAt(start)")));
auto then = mozilla::TimeStamp::NowUnfuzzed();
auto then = mozilla::TimeStamp::Now();
MOZ_RELEASE_ASSERT(mozilla::baseprofiler::AddMarkerToBuffer(
buffer, "test2", mozilla::baseprofiler::category::OTHER_Profiling,

View File

@@ -544,7 +544,7 @@ void BackgroundHangThread::ReportHang(TimeDuration aHangTime,
}
};
const TimeStamp endTime = TimeStamp::NowUnfuzzed();
const TimeStamp endTime = TimeStamp::Now();
const TimeStamp startTime = endTime - aHangTime;
profiler_add_marker("BHR-detected hang", geckoprofiler::category::OTHER,
{MarkerThreadId(mStackHelper.GetThreadId()),

View File

@@ -250,7 +250,7 @@ void ChannelWrapper::Suspend(ErrorResult& aRv) {
if (!mSuspended) {
nsresult rv = NS_ERROR_UNEXPECTED;
if (nsCOMPtr<nsIChannel> chan = MaybeChannel()) {
mSuspendTime = mozilla::TimeStamp::NowUnfuzzed();
mSuspendTime = mozilla::TimeStamp::Now();
rv = chan->Suspend();
}
if (NS_FAILED(rv)) {

View File

@@ -59,7 +59,7 @@ class ProfiledThreadData final {
MOZ_ASSERT(!mBufferPositionWhenReceivedJSContext,
"JSContext should have been cleared before the thread was "
"unregistered");
mUnregisterTime = mozilla::TimeStamp::NowUnfuzzed();
mUnregisterTime = mozilla::TimeStamp::Now();
mBufferPositionWhenUnregistered = mozilla::Some(aBufferPosition);
}
mozilla::Maybe<uint64_t> BufferPositionWhenUnregistered() {

View File

@@ -19,9 +19,9 @@ class ThreadInfo final {
public:
NS_INLINE_DECL_THREADSAFE_REFCOUNTING(ThreadInfo)
ThreadInfo(const char* aName, int aThreadId, bool aIsMainThread,
const mozilla::TimeStamp& aRegisterTime =
mozilla::TimeStamp::NowUnfuzzed())
ThreadInfo(
const char* aName, int aThreadId, bool aIsMainThread,
const mozilla::TimeStamp& aRegisterTime = mozilla::TimeStamp::Now())
: mName(aName),
mRegisterTime(aRegisterTime),
mThreadId(aThreadId),

View File

@@ -338,7 +338,7 @@ static RunningTimes GetThreadRunningTimesDiff(
if (MOZ_UNLIKELY(!maybeCid)) {
// No clock id -> Nothing to measure apart from the timestamp.
RunningTimes emptyRunningTimes;
emptyRunningTimes.SetPostMeasurementTimeStamp(TimeStamp::NowUnfuzzed());
emptyRunningTimes.SetPostMeasurementTimeStamp(TimeStamp::Now());
return emptyRunningTimes;
}

View File

@@ -289,7 +289,7 @@ void SamplerThread::SleepMicro(uint32_t aMicroseconds) {
if (mIntervalMicroseconds >= 1000) {
::Sleep(std::max(1u, aMicroseconds / 1000));
} else {
TimeStamp start = TimeStamp::NowUnfuzzed();
TimeStamp start = TimeStamp::Now();
TimeStamp end = start + TimeDuration::FromMicroseconds(aMicroseconds);
// First, sleep for as many whole milliseconds as possible.
@@ -298,7 +298,7 @@ void SamplerThread::SleepMicro(uint32_t aMicroseconds) {
}
// Then, spin until enough time has passed.
while (TimeStamp::NowUnfuzzed() < end) {
while (TimeStamp::Now() < end) {
YieldProcessor();
}
}

View File

@@ -2726,7 +2726,7 @@ static void StreamMetaJSCustomObject(
// The "startTime" field holds the number of milliseconds since midnight
// January 1, 1970 GMT. This grotty code computes (Now - (Now -
// ProcessStartTime)) to convert CorePS::ProcessStartTime() into that form.
TimeDuration delta = TimeStamp::NowUnfuzzed() - CorePS::ProcessStartTime();
TimeDuration delta = TimeStamp::Now() - CorePS::ProcessStartTime();
aWriter.DoubleProperty(
"startTime",
static_cast<double>(PR_Now() / 1000.0 - delta.ToMilliseconds()));
@@ -3388,11 +3388,11 @@ RunningTimes GetRunningTimesWithTightTimestamp(
constexpr int loops = 128;
TimeDuration durations[loops];
RunningTimes runningTimes;
TimeStamp before = TimeStamp::NowUnfuzzed();
TimeStamp before = TimeStamp::Now();
for (int i = 0; i < loops; ++i) {
AUTO_PROFILER_STATS(GetRunningTimes_MaxRunningTimesReadDuration);
aGetCPURunningTimesFunction(runningTimes);
const TimeStamp after = TimeStamp::NowUnfuzzed();
const TimeStamp after = TimeStamp::Now();
durations[i] = after - before;
before = after;
}
@@ -3408,15 +3408,15 @@ RunningTimes GetRunningTimesWithTightTimestamp(
// Record CPU measurements between two timestamps.
RunningTimes runningTimes;
TimeStamp before = TimeStamp::NowUnfuzzed();
TimeStamp before = TimeStamp::Now();
aGetCPURunningTimesFunction(runningTimes);
TimeStamp after = TimeStamp::NowUnfuzzed();
TimeStamp after = TimeStamp::Now();
// In most cases, the above should be quick enough. But if not, repeat:
while (MOZ_UNLIKELY(after - before > scMaxRunningTimesReadDuration)) {
AUTO_PROFILER_STATS(GetRunningTimes_REDO);
before = after;
aGetCPURunningTimesFunction(runningTimes);
after = TimeStamp::NowUnfuzzed();
after = TimeStamp::Now();
}
// Finally, record the closest timestamp just after the final measurement was
// done. This must stay *after* the CPU measurements.
@@ -3599,10 +3599,10 @@ void SamplerThread::Run() {
// This is the scheduled time at which each sampling loop should start.
// It will determine the ideal next sampling start by adding the expected
// interval, unless when sampling runs late -- See end of while() loop.
TimeStamp scheduledSampleStart = TimeStamp::NowUnfuzzed();
TimeStamp scheduledSampleStart = TimeStamp::Now();
while (true) {
const TimeStamp sampleStart = TimeStamp::NowUnfuzzed();
const TimeStamp sampleStart = TimeStamp::Now();
// This scope is for |lock|. It ends before we sleep below.
{
@@ -3610,7 +3610,7 @@ void SamplerThread::Run() {
MOZ_ASSERT(!postSamplingCallbacks);
PSAutoLock lock;
TimeStamp lockAcquired = TimeStamp::NowUnfuzzed();
TimeStamp lockAcquired = TimeStamp::Now();
// Move all the post-sampling callbacks locally, so that new ones cannot
// sneak in between the end of the lock scope and the invocation after it.
@@ -3635,7 +3635,7 @@ void SamplerThread::Run() {
ActivePS::ClearExpiredExitProfiles(lock);
TimeStamp expiredMarkersCleaned = TimeStamp::NowUnfuzzed();
TimeStamp expiredMarkersCleaned = TimeStamp::Now();
if (!ActivePS::IsSamplingPaused(lock)) {
double sampleStartDeltaMs =
@@ -3671,7 +3671,7 @@ void SamplerThread::Run() {
buffer.AddEntry(ProfileBufferEntry::Number(number));
}
}
TimeStamp countersSampled = TimeStamp::NowUnfuzzed();
TimeStamp countersSampled = TimeStamp::Now();
if (stackSampling || cpuUtilization) {
samplingState = SamplingState::SamplingCompleted;
@@ -3688,7 +3688,7 @@ void SamplerThread::Run() {
const RunningTimes runningTimesDiff = [&]() {
if (!cpuUtilization) {
// If we don't need CPU measurements, we only need a timestamp.
return RunningTimes(TimeStamp::NowUnfuzzed());
return RunningTimes(TimeStamp::Now());
}
return GetThreadRunningTimesDiff(lock, *registeredThread);
}();
@@ -4007,7 +4007,7 @@ void SamplerThread::Run() {
lul->MaybeShowStats();
}
#endif
TimeStamp threadsSampled = TimeStamp::NowUnfuzzed();
TimeStamp threadsSampled = TimeStamp::Now();
{
AUTO_PROFILER_STATS(Sampler_FulfillChunkRequests);
@@ -4036,7 +4036,7 @@ void SamplerThread::Run() {
scheduledSampleStart += sampleInterval;
// Try to sleep until we reach that next scheduled time.
const TimeStamp beforeSleep = TimeStamp::NowUnfuzzed();
const TimeStamp beforeSleep = TimeStamp::Now();
if (scheduledSampleStart >= beforeSleep) {
// There is still time before the next scheduled sample time.
const uint32_t sleepTimeUs = static_cast<uint32_t>(
@@ -5717,7 +5717,7 @@ void profiler_js_interrupt_callback() {
double profiler_time() {
MOZ_RELEASE_ASSERT(CorePS::Exists());
TimeDuration delta = TimeStamp::NowUnfuzzed() - CorePS::ProcessStartTime();
TimeDuration delta = TimeStamp::Now() - CorePS::ProcessStartTime();
return delta.ToMilliseconds();
}
@@ -5751,8 +5751,8 @@ bool profiler_capture_backtrace_into(ProfileChunkedBuffer& aChunkedBuffer,
regs.Clear();
#endif
DoSyncSample(lock, *registeredThread, TimeStamp::NowUnfuzzed(), regs,
profileBuffer, aCaptureOptions);
DoSyncSample(lock, *registeredThread, TimeStamp::Now(), regs, profileBuffer,
aCaptureOptions);
return true;
}

View File

@@ -870,7 +870,7 @@ RefPtr<nsProfiler::GatheringPromise> nsProfiler::StartGathering(
mWriter.emplace();
TimeStamp streamingStart = TimeStamp::NowUnfuzzed();
TimeStamp streamingStart = TimeStamp::Now();
UniquePtr<ProfilerCodeAddressService> service =
profiler_code_address_service_for_presymbolication();
@@ -912,7 +912,7 @@ RefPtr<nsProfiler::GatheringPromise> nsProfiler::StartGathering(
// We want a reasonable timeout value while waiting for child profiles.
// We know how long the parent process took to serialize its profile:
const uint32_t parentTimeMs = static_cast<uint32_t>(
(TimeStamp::NowUnfuzzed() - streamingStart).ToMilliseconds());
(TimeStamp::Now() - streamingStart).ToMilliseconds());
// We will multiply this by the number of children, to cover the worst case
// where all processes take the same time, but because they are working in
// parallel on a potential single CPU, they all finish around the same later

View File

@@ -802,14 +802,14 @@ TEST(GeckoProfiler, Markers)
::geckoprofiler::markers::NoPayload{}));
// Used in markers below.
TimeStamp ts1 = TimeStamp::NowUnfuzzed();
TimeStamp ts1 = TimeStamp::Now();
// Sleep briefly to ensure a sample is taken and the pending markers are
// processed.
PR_Sleep(PR_MillisecondsToInterval(500));
// Used in markers below.
TimeStamp ts2 = TimeStamp::NowUnfuzzed();
TimeStamp ts2 = TimeStamp::Now();
// ts1 and ts2 should be different thanks to the sleep.
EXPECT_NE(ts1, ts2);

View File

@@ -678,7 +678,7 @@ class LogModuleManager {
// XXX is there a reasonable way to convert one to the other? this is
// bad
PRTime prnow = PR_Now();
TimeStamp tmnow = TimeStamp::NowUnfuzzed();
TimeStamp tmnow = TimeStamp::Now();
TimeDuration duration = tmnow - *aStart;
PRTime prstart = prnow - duration.ToMicroseconds();