mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-02 18:08:58 +00:00
Bug 1425605 - Add the start/end mark names to performance.measure profiler markers; r=baku,mstange
MozReview-Commit-ID: I8DzSlSi124 --HG-- extra : rebase_source : 5062bf33824284df7346dae15595f8e1e479bc40
This commit is contained in:
parent
dc90c4a5d0
commit
4f7596f26a
@ -328,9 +328,22 @@ Performance::Measure(const nsAString& aName,
|
||||
TimeDuration::FromMilliseconds(startTime);
|
||||
TimeStamp endTimeStamp = CreationTimeStamp() +
|
||||
TimeDuration::FromMilliseconds(endTime);
|
||||
|
||||
// Convert to Maybe values so that Optional types do not need to be used in
|
||||
// the profiler.
|
||||
Maybe<nsString> startMark;
|
||||
if (aStartMark.WasPassed()) {
|
||||
startMark.emplace(aStartMark.Value());
|
||||
}
|
||||
Maybe<nsString> endMark;
|
||||
if (aEndMark.WasPassed()) {
|
||||
endMark.emplace(aEndMark.Value());
|
||||
}
|
||||
|
||||
profiler_add_marker(
|
||||
"UserTiming",
|
||||
MakeUnique<UserTimingMarkerPayload>(aName, startTimeStamp, endTimeStamp));
|
||||
MakeUnique<UserTimingMarkerPayload>(aName, startMark, endMark,
|
||||
startTimeStamp, endTimeStamp));
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
@ -9,6 +9,7 @@
|
||||
#include "gfxASurface.h"
|
||||
#include "Layers.h"
|
||||
#include "mozilla/Sprintf.h"
|
||||
#include "mozilla/Maybe.h"
|
||||
|
||||
using namespace mozilla;
|
||||
|
||||
@ -75,6 +76,17 @@ UserTimingMarkerPayload::StreamPayload(SpliceableJSONWriter& aWriter,
|
||||
StreamCommonProps("UserTiming", aWriter, aProcessStartTime, aUniqueStacks);
|
||||
aWriter.StringProperty("name", NS_ConvertUTF16toUTF8(mName).get());
|
||||
aWriter.StringProperty("entryType", mEntryType);
|
||||
|
||||
if (mStartMark.isSome()) {
|
||||
aWriter.StringProperty("startMark", NS_ConvertUTF16toUTF8(mStartMark.value()).get());
|
||||
} else {
|
||||
aWriter.NullProperty("startMark");
|
||||
}
|
||||
if (mEndMark.isSome()) {
|
||||
aWriter.StringProperty("endMark", NS_ConvertUTF16toUTF8(mEndMark.value()).get());
|
||||
} else {
|
||||
aWriter.NullProperty("endMark");
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -8,6 +8,7 @@
|
||||
#define ProfilerMarkerPayload_h
|
||||
|
||||
#include "mozilla/Attributes.h"
|
||||
#include "mozilla/Maybe.h"
|
||||
#include "mozilla/RefPtr.h"
|
||||
#include "mozilla/TimeStamp.h"
|
||||
#include "mozilla/UniquePtrExtensions.h"
|
||||
@ -150,11 +151,15 @@ public:
|
||||
{}
|
||||
|
||||
UserTimingMarkerPayload(const nsAString& aName,
|
||||
const mozilla::Maybe<nsString>& aStartMark,
|
||||
const mozilla::Maybe<nsString>& aEndMark,
|
||||
const mozilla::TimeStamp& aStartTime,
|
||||
const mozilla::TimeStamp& aEndTime)
|
||||
: ProfilerMarkerPayload(aStartTime, aEndTime)
|
||||
, mEntryType("measure")
|
||||
, mName(aName)
|
||||
, mStartMark(aStartMark)
|
||||
, mEndMark(aEndMark)
|
||||
{}
|
||||
|
||||
DECL_STREAM_PAYLOAD
|
||||
@ -163,6 +168,8 @@ private:
|
||||
// Either "mark" or "measure".
|
||||
const char* mEntryType;
|
||||
nsString mName;
|
||||
mozilla::Maybe<nsString> mStartMark;
|
||||
mozilla::Maybe<nsString> mEndMark;
|
||||
};
|
||||
|
||||
// Contains the translation applied to a 2d layer so we can track the layer
|
||||
|
Loading…
Reference in New Issue
Block a user