Closed
Bug 553682
Opened 14 years ago
Closed 14 years ago
TM: GC Profiler
Categories
(Core :: JavaScript Engine, defect)
Tracking
()
RESOLVED
FIXED
mozilla1.9.3a4
People
(Reporter: gwagner, Assigned: gwagner)
Details
(Whiteboard: fixed-in-tracemonkey)
Attachments
(8 files, 9 obsolete files)
8.52 KB,
image/png
|
Details | |
10.46 KB,
image/png
|
Details | |
8.75 KB,
image/png
|
Details | |
7.00 KB,
image/png
|
Details | |
935 bytes,
patch
|
Details | Diff | Splinter Review | |
10.78 KB,
patch
|
Details | Diff | Splinter Review | |
2.28 KB,
patch
|
Details | Diff | Splinter Review | |
2.55 KB,
patch
|
gwagner
:
review+
|
Details | Diff | Splinter Review |
I used this patch to profile the js_GC function and count how many chunks are allocated and destroyed between GC calls. The results are written to a file and can be visualized with gnuplot.
Assignee | ||
Updated•14 years ago
|
Attachment #433619 -
Attachment is patch: true
Attachment #433619 -
Attachment mime type: application/octet-stream → text/plain
Assignee | ||
Comment 1•14 years ago
|
||
and the gnuplot file to generate the graph. You have to change the input filename in order to use it.
Assignee | ||
Comment 2•14 years ago
|
||
Sample output
Assignee | ||
Updated•14 years ago
|
Assignee: general → anygregor
Comment 3•14 years ago
|
||
Gregor, Can you update the patch to include #ifdef so we can conditionally enabled this on trunk builds? Mike M
Assignee | ||
Comment 4•14 years ago
|
||
I captured a random surf behavior: Opened a lot of tabs and visited random webpages. The graph shows again the two different webpage styles: 1) transition based with long living objects 2) recreation based with lots of short living objects. Marking time dominates in 1) and sweeping time in 2).
Assignee | ||
Comment 5•14 years ago
|
||
Example for transition based webpage: Facebook. Marking time kills here.
Assignee | ||
Comment 6•14 years ago
|
||
example for recreation based webpage: 280 slides. Sweeping time matters.
Comment 7•14 years ago
|
||
Gregor, this work is fantastic.
Comment 8•14 years ago
|
||
Huzzah^2, and props for using dear old gnuplot (don't make Andreas program it ;-). /be
Assignee | ||
Comment 9•14 years ago
|
||
It covers now everything with the GCTIMER option.
Attachment #433619 -
Attachment is obsolete: true
Comment 10•14 years ago
|
||
Gregor, Can you land the GCTIMER patch on the TIP?
Assignee | ||
Comment 11•14 years ago
|
||
(In reply to comment #10) > Gregor, Can you land the GCTIMER patch on the TIP? I still have problems with rdtsc on different platforms. It's defined in avmplus.h but it seems that not all platforms include this header.
Assignee | ||
Comment 12•14 years ago
|
||
added compiler flag
Attachment #433663 -
Attachment is obsolete: true
Attachment #434105 -
Flags: review?(igor)
Assignee | ||
Comment 13•14 years ago
|
||
refresh
Attachment #434105 -
Attachment is obsolete: true
Attachment #434105 -
Flags: review?(igor)
Assignee | ||
Comment 14•14 years ago
|
||
and now the right version.
Attachment #434636 -
Attachment is obsolete: true
Attachment #434637 -
Flags: review?(igor)
Updated•14 years ago
|
Attachment #434637 -
Flags: review?(igor)
Comment 15•14 years ago
|
||
Comment on attachment 434637 [details] [diff] [review] patch update >diff -r f909e6aacc87 js/src/jsgc.cpp >--- a/js/src/jsgc.cpp Tue Mar 23 21:23:40 2010 -0700 >+++ b/js/src/jsgc.cpp Wed Mar 24 13:07:46 2010 -0700 >@@ -562,21 +562,28 @@ MakeNewArenaFreeList(JSGCArena *a, size_ > #else > # define METER(x) ((void) 0) > # define METER_IF(condition, x) ((void) 0) > #endif > > #define METER_UPDATE_MAX(maxLval, rval) \ > METER_IF((maxLval) < (rval), (maxLval) = (rval)) > >+#ifdef MOZ_GCTIMER >+static int newChunkCount = 0; >+static int destroyChunkCount = 0; Use jsrefcount for the type here and JS_ATOMIC_INCREMENT to increase the counter. >+#ifdef MOZ_GCTIMER >+typedef struct GCTimer { Nit: no need for typedef. >+static uint64 firstEnter = 0; Nit: use more descriptive name here. Something like firstGCStart. Alternatively move the static into js_GC and pass it into dumpGCTimer. >+ >+void dumpGCTimer(GCTimer *gcT, bool lastGC) >+{ >+ static FILE *gcFile; >+ >+ if (!gcFile) { >+ gcFile = fopen("gcTimer.dat", "w"); >+ JS_ASSERT(gcFile); I suggest to always open file in the dump function and append the data using the "a" mode. This way the data file would not be overwritten if one starts browser again. >+#define TIMESTAMP(x) x = rdtsc(); >+#else >+#define TIMESTAMP(x) >+#endif Nit: move the define into js_GC to emphasis its locality. Also use ((void) 0) for the empty timestamp and wrap the definition of the first one into parenthesis. >@@ -3199,16 +3263,17 @@ js_GC(JSContext *cx, JSGCInvocationKind > FinalizeArenaList<JSString, FinalizeString> > (cx, FINALIZE_STRING, &emptyArenas); It would be nice to add a separated counter for the string finalization timing. Assume r+ with that fixed.
Assignee | ||
Comment 16•14 years ago
|
||
(In reply to comment #15) > >+ > >+void dumpGCTimer(GCTimer *gcT, bool lastGC) > >+{ > >+ static FILE *gcFile; > >+ > >+ if (!gcFile) { > >+ gcFile = fopen("gcTimer.dat", "w"); > >+ JS_ASSERT(gcFile); > > I suggest to always open file in the dump function and append the data using > the "a" mode. This way the data file would not be overwritten if one starts > browser again. > I don't like if the file just grows and I have to manually delete it or copy some parts for plotting. I want to leave it like that if there is no other reason. > > >@@ -3199,16 +3263,17 @@ js_GC(JSContext *cx, JSGCInvocationKind > > > FinalizeArenaList<JSString, FinalizeString> > > (cx, FINALIZE_STRING, &emptyArenas); > > It would be nice to add a separated counter for the string finalization timing. Added > > Assume r+ with that fixed. Thx!
Assignee | ||
Comment 17•14 years ago
|
||
Addressed Igors comments.
Attachment #434637 -
Attachment is obsolete: true
Assignee | ||
Comment 19•14 years ago
|
||
I added another folder for it. utils->gcTimer Other script files don't have the copyright header so I didn't add one.
Attachment #433620 -
Attachment is obsolete: true
Attachment #434999 -
Flags: review?(gal)
Comment 20•14 years ago
|
||
Comment on attachment 434999 [details] [diff] [review] patch: gnuplot script Looks good. Please get consensus from #jsapi on the directory name.
Attachment #434999 -
Flags: review?(gal) → review+
Assignee | ||
Comment 21•14 years ago
|
||
moved to js/src/gnuplot
Attachment #434999 -
Attachment is obsolete: true
Assignee | ||
Comment 22•14 years ago
|
||
Part 1: Gnuplot file: http://hg.mozilla.org/tracemonkey/rev/f896af789657
Assignee | ||
Comment 23•14 years ago
|
||
Attachment #434988 -
Attachment is obsolete: true
Assignee | ||
Comment 24•14 years ago
|
||
http://hg.mozilla.org/tracemonkey/rev/b2daab8b12af
Assignee | ||
Updated•14 years ago
|
Whiteboard: fixed-in-tracemonkey
Comment 25•14 years ago
|
||
To make sure that the timestamping code does not rot the patch enables it (but not the stats printout) in debug builds unconditionally.
Attachment #435289 -
Flags: review?(anygregor)
Assignee | ||
Comment 26•14 years ago
|
||
(In reply to comment #25) > Created an attachment (id=435289) [details] > enable timestamping in debug builds > > To make sure that the timestamping code does not rot the patch enables it (but > not the stats printout) in debug builds unconditionally. I wanted to do the same but I always got a compile error with rdtsc on Maemo on try-server. I asked dmandelin because he uses it for traceviz and he said that rdtsc might not be implemented on Maemo.
Comment 27•14 years ago
|
||
(In reply to comment #26) > try-server. I asked dmandelin because he uses it for traceviz and he said that > rdtsc might not be implemented on Maemo. Then we should only enable it if rdtsc is available.
Comment 28•14 years ago
|
||
I filed bug 555338 to get a preprocessor define that tells when rdtsc is available.
Comment 29•14 years ago
|
||
Here is an updated patch that checks for rdtsc availability using AVMPLUS_HAS_RDTSC from the bug 555338. On a releated note I have found that it would be very useful to expose the timing stats for shell scripts. This way a performance benchmark can run a test repetitively and process the statistics on its own.
Attachment #435666 -
Flags: review?(anygregor)
Comment 30•14 years ago
|
||
(In reply to comment #29) > On a releated note I have found that it would be very useful to expose the > timing stats for shell scripts. This way a performance benchmark can run a test > repetitively and process the statistics on its own. Gregor, what do you think about this?
Assignee | ||
Comment 31•14 years ago
|
||
Comment on attachment 435666 [details] [diff] [review] enable timestamping in debug builds v2 >+ >+#if !AVMPLUS_HAS_RDTSC >+#error "MOZ_GCTIMER can only be enabled if the rdtsc() is available." >+#endif >+ nit: "if rdtsc() is available" or "if the rdtsc() instruction is available" sounds better to me.
Attachment #435666 -
Flags: review?(anygregor) → review+
Assignee | ||
Comment 32•14 years ago
|
||
> On a releated note I have found that it would be very useful to expose the
> timing stats for shell scripts. This way a performance benchmark can run a test
> repetitively and process the statistics on its own.
You mean like the sunspider comparison?
Yeah the timing output was just the first step and we should really use these numbers.
I also want to use the relative application time that is already in the output file and do some GC frequency graphs.
Updated•14 years ago
|
Target Milestone: --- → mozilla1.9.3a4
Comment 33•14 years ago
|
||
http://hg.mozilla.org/mozilla-central/rev/f896af789657
Status: NEW → RESOLVED
Closed: 14 years ago
Resolution: --- → FIXED
Assignee | ||
Updated•12 years ago
|
Attachment #435289 -
Flags: review?(anygregor)
You need to log in
before you can comment on or make changes to this bug.
Description
•