Closed Bug 1293360 Opened 8 years ago Closed 8 years ago

Add a MOZ_CCTIMER environment variable (mirroring MOZ_GCTIMER) to dump CC stats to the console

Categories

(Core :: DOM: Core & HTML, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla51
Tracking Status
firefox51 --- fixed

People

(Reporter: terrence, Assigned: terrence)

References

(Blocks 1 open bug)

Details

Attachments

(1 file)

It surprised me that there's currently no easy way to get CC logs out of the CC and into a file for easy grepping, searching, and statisticsing. In the GC we have an extremely useful environment flag called MOZ_GCTIMER that lets us do just this. The attached patch adds a similar flag for the CC. I've tested this locally and it gets me enough data to move forward. Given how useful the GC flag has been, I hope we can take this (or something like it) for the CC.
Attachment #8779005 - Flags: review?(continuation)
Comment on attachment 8779005 [details] [diff] [review] implement_MOZ_CCTIMER-v0.diff Review of attachment 8779005 [details] [diff] [review]: ----------------------------------------------------------------- I guess this is fine. ::: dom/base/nsJSEnvironment.cpp @@ +1287,5 @@ > Clear(); > mMaxSliceTimeSinceClear = 0; > + > + char* env = getenv("MOZ_CCTIMER"); > + if (env) { Please invert the test and do an early return here. @@ +1295,5 @@ > + mFile = stdout; > + } else if (strcmp(env, "stderr") == 0) { > + mFile = stderr; > + } else { > + mFile = fopen(env, "a"); This eventually won't work with content process sandboxing, FWIW. I wonder if there's some existing way to just dump the console output to a file. @@ +1616,5 @@ > uint32_t cleanups = sForgetSkippableBeforeCC ? sForgetSkippableBeforeCC : 1; > uint32_t minForgetSkippableTime = (sMinForgetSkippableTime == UINT32_MAX) > ? 0 : sMinForgetSkippableTime; > > + if (sPostGCEventsToConsole || gCCStats.mFile) { This will make us post them to the console even if that pref isn't set, but I suppose that's okay.
Attachment #8779005 - Flags: review?(continuation) → review+
Oh, good catch! We should probably build the string in the || branch and have a separate case for each output mechanism.
Status: ASSIGNED → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla51
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: