nsITimelineService is used to constuct a timeline of program execution. The timeline is output to a file, either stderr or the value of the environment variable NS_TIMELINE_LOG_FILE. On the Mac, the timeline is output to the file named "timeline.txt". The reason it's different on the Mac is that the Mac environment initialization code happens after timeline initialization code. If NS_TIMELINE_INIT_TIME is set in the environment, that will be used as the time of startup; otherwise the current time when mark() is first called will be used. mark() is used to put marks on the timeline. indent() and outdent() are used to format the timeline a bit to show nesting. This doesn't produce perfect results in the face of asychrony and multiple threads. enter() and leave() are convenience functions that add marks to the timeline and do indentation. startTimer() and stopTimer() control named stop watches. If startTimer() is called more than once, an equal number of stopTimer() calls are needed to actually stop the timer. This makes these timers slightly useful in a threaded environment. markTimer() puts a mark on the timeline containing the total for the named timer. Don't use nsITimelineService in C++ code; use the NS_TIMELINE macros instead. nsITimelineService exists so that JavaScript code can mark the timeline.
[scriptable, uuid(93276790-3daf-11d5-b67d-000064657374)]
interface nsITimelineService : nsISupports
Methods
enter/leave bracket code with "<text>..." and "...<text>" as well as indentation.
void
enter(in string text)
causes subsequent marks to be indented for a more readable report.
void
indent()
void
leave(in string text)
mark() Print "<elapsed time>: <text> " in the timeline log file.
void
mark(in string text)
void
markTimer(in string timerName)
void
markTimerWithComment(in string timerName, in string comment)
Causes subsequent marks to be outdented.
void
outdent()
void
resetTimer(in string timerName)
void
startTimer(in string timerName)
void
stopTimer(in string timerName)
Compare to: