Bug 1735124: Start the sequence number in QM_TRY logging at 1. r=jstutte

Differential Revision: https://phabricator.services.mozilla.com/D146250
This commit is contained in:
Harveer Singh 2022-05-13 07:08:21 +00:00
Родитель 51d775f030
Коммит 5f4a7a2a87
1 изменённых файлов: 6 добавлений и 3 удалений

Просмотреть файл

@ -533,16 +533,19 @@ void LogError(const nsACString& aExpr, const Maybe<nsresult> aMaybeRv,
// This would be initialized once, all subsequent calls would be a no-op. // This would be initialized once, all subsequent calls would be a no-op.
MOZ_ALWAYS_TRUE(sSequenceNumber.init()); MOZ_ALWAYS_TRUE(sSequenceNumber.init());
const auto currSeqNum = sSequenceNumber.get(); // sequence number should always starts at number 1.
// `sSequenceNumber` gets initialized to 0; so we have to increment here.
const auto newSeqNum = sSequenceNumber.get() + 1;
const auto threadId = const auto threadId =
mozilla::baseprofiler::profiler_current_thread_id().ToNumber(); mozilla::baseprofiler::profiler_current_thread_id().ToNumber();
const auto threadIdAndSequence = const auto threadIdAndSequence =
(static_cast<uint64_t>(threadId) << 32) | (currSeqNum & 0xFFFFFFFF); (static_cast<uint64_t>(threadId) << 32) | (newSeqNum & 0xFFFFFFFF);
res.AppendElement( res.AppendElement(
EventExtraEntry{"seq"_ns, IntToCString(threadIdAndSequence)}); EventExtraEntry{"seq"_ns, IntToCString(threadIdAndSequence)});
sSequenceNumber.set(currSeqNum + 1); sSequenceNumber.set(newSeqNum);
res.AppendElement(EventExtraEntry{"severity"_ns, severityString}); res.AppendElement(EventExtraEntry{"severity"_ns, severityString});