Closed Bug 1608523 Opened 6 years ago Closed 6 years ago

Add optional start time for a MOZ_LOG message

Categories

(Core :: XPCOM, enhancement)

enhancement
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla74
Tracking Status
firefox74 --- fixed

People

(Reporter: jesup, Assigned: jesup)

Details

Attachments

(1 file)

With the ability to pump log messages into the profiler (MOZ_LOG=...,profilermarkers) being able to provide a time period associated with the message can be useful (and this is frequently used with Text and other markers in the profiler, like the DocumentLoad marker, or DomContentLoaded, etc).

I propose a parallel entry for logging (MOZ_LOG_TIME(), though it could be renamed) which takes an optional start time. We could also be fully explicit and allow/require start and end times when using this API.

For text output, we could include a time range (similar to how we add timestamps for "MOZ_LOG=...,timestamp")

To maximize speed and minimize codesize at callpoints, I've implemented it as largely parallel to the MOZ_LOG calls except at the lowest level (::Print() in logging.cpp). We could merge the two versions at a higher level instead.

an output line would look like this:
2020-01-10 19:20:50.997112 -> 19:20:50.999092 UTC (2ms)- [(null) 14778: Main Thread]: D/nsHttp nsHttpChannel::DoConnect [this=0x82f06000, aTransWithStickyConn=0x0]

Pushed by rjesup@wgate.com: https://hg.mozilla.org/integration/autoland/rev/ac2664e023ce Add MOZ_LOG_TIME() to allow time ranges for logs r=froydnj
Status: NEW → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla74
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: