Open Bug 1505589 Opened 6 years ago Updated 2 years ago

Make Profiler Counters usable within the JavaScript Engine

Categories

(Core :: JavaScript Engine, enhancement, P2)

enhancement

Tracking

()

Tracking Status
firefox65 --- affected

People

(Reporter: mgaudet, Unassigned)

References

(Blocks 2 open bugs)

Details

Attachments

(1 file, 1 obsolete file)

Bug 1464509 added some really interesting support for capturing counter values into profiles. There's a lot of really interesting use cases I can imagine for this. However, interaction with the profiler from within SpiderMonkey requires some facade to be built, in order to support embeddings that are not Gecko (see js/src/vm/GeckoProfiler.h) It appears in the discussion for Bug 1464509 this was discussed, but I don't think the work was completed.
Blocks: 1507566
WIP patch; compiles clean
Assignee: nobody → rjesup
Status: NEW → ASSIGNED
Comment on attachment 9034480 [details] [diff] [review] Make profiler counters usable from js/* source Review of attachment 9034480 [details] [diff] [review]: ----------------------------------------------------------------- I had a bit of a sticky-beak at these changes. Hope you don't mind the early feedback. Thanks for doing this! ::: js/src/vm/GeckoProfiler.h @@ +132,5 @@ > + /* functions to support Profiler counters */ > + void setCounters(profiler_sampled_counter_t add, > + profiler_sampled_counter_t remove); > + void addCounter(BaseProfilerCount* aCounter) { > + (*addCounterPtr)(aCounter); What if addCounterPtr is null. Maybe we should silently not add/remove counters if the profiler has provided nullptr for these functions or maybe there are other reasons it hasn't set them? ::: mfbt/ProfilerCounts.h @@ +161,5 @@ > + > + void Add(int64_t aNumber) { mCounter += aNumber; } > + > + ProfilerAtomicSigned mCounter; > +}; Can I have a function to reset the counter, not to zero but to a value I calculate? I hope to count allocations (in bytes) and then reset it to the currently used amount of memory after a GC finishes. I can add this later if you'd prefer. It's also not an immediate priority, we don't have a use case for such accurate information yet. I'd also like something I can increment from JIT-compiled code. But that's just a way to take the address of the atomic int64 - really simple. Just FYI in case the internals of this change in the future.
No longer blocks: 1517409
Blocks: 1518061
Priority: -- → P2
incorporated pbone's comments. Added counter->Reset(value)
Attachment #9034480 - Attachment is obsolete: true
Blocks: 1521924

Forwarding to Gerald

Assignee: rjesup → nobody
Status: ASSIGNED → NEW
Flags: needinfo?(gsquelart)

I won't have time for this, sorry.

Flags: needinfo?(mozbugz)
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: