mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-20 16:55:40 +00:00
Bug 1624993 - Add StoreMarker function to unify the marker insertion points. r=gerald
Differential Revision: https://phabricator.services.mozilla.com/D79423
This commit is contained in:
parent
a74d238798
commit
738659e709
@ -1538,6 +1538,19 @@ void ProfilingStackOwner::DumpStackAndCrash() const {
|
||||
// The name of the main thread.
|
||||
static const char* const kMainThreadName = "GeckoMain";
|
||||
|
||||
// Add the marker to the given buffer with the given information.
|
||||
// This is a unified insertion point for all the markers.
|
||||
template <typename Buffer>
|
||||
static void StoreMarker(Buffer& aBuffer, int aThreadId, const char* aMarkerName,
|
||||
JS::ProfilingCategoryPair aCategoryPair,
|
||||
const ProfilerMarkerPayload* aPayload,
|
||||
const mozilla::TimeStamp& aTime) {
|
||||
aBuffer.PutObjects(ProfileBufferEntry::Kind::MarkerData, aThreadId,
|
||||
WrapProfileBufferUnownedCString(aMarkerName),
|
||||
static_cast<uint32_t>(aCategoryPair), aPayload,
|
||||
(aTime - CorePS::ProcessStartTime()).ToMilliseconds());
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
// BEGIN sampling/unwinding code
|
||||
|
||||
@ -4989,11 +5002,8 @@ static void racy_profiler_add_marker(const char* aMarkerName,
|
||||
TimeStamp origin = (aPayload && !aPayload->GetStartTime().IsNull())
|
||||
? aPayload->GetStartTime()
|
||||
: TimeStamp::NowUnfuzzed();
|
||||
TimeDuration delta = origin - CorePS::ProcessStartTime();
|
||||
CorePS::CoreBuffer().PutObjects(
|
||||
ProfileBufferEntry::Kind::MarkerData, racyRegisteredThread->ThreadId(),
|
||||
WrapProfileBufferUnownedCString(aMarkerName),
|
||||
static_cast<uint32_t>(aCategoryPair), aPayload, delta.ToMilliseconds());
|
||||
StoreMarker(CorePS::CoreBuffer(), racyRegisteredThread->ThreadId(),
|
||||
aMarkerName, aCategoryPair, aPayload, origin);
|
||||
}
|
||||
|
||||
void profiler_add_marker(const char* aMarkerName,
|
||||
@ -5111,11 +5121,8 @@ static void maybelocked_profiler_add_marker_for_thread(
|
||||
TimeStamp origin = (!aPayload.GetStartTime().IsNull())
|
||||
? aPayload.GetStartTime()
|
||||
: TimeStamp::NowUnfuzzed();
|
||||
TimeDuration delta = origin - CorePS::ProcessStartTime();
|
||||
CorePS::CoreBuffer().PutObjects(
|
||||
ProfileBufferEntry::Kind::MarkerData, aThreadId,
|
||||
WrapProfileBufferUnownedCString(aMarkerName),
|
||||
static_cast<uint32_t>(aCategoryPair), &aPayload, delta.ToMilliseconds());
|
||||
StoreMarker(CorePS::CoreBuffer(), aThreadId, aMarkerName, aCategoryPair,
|
||||
&aPayload, origin);
|
||||
}
|
||||
|
||||
void profiler_add_marker_for_thread(int aThreadId,
|
||||
|
Loading…
Reference in New Issue
Block a user