Add JavaScript memory allocation tracking

RESOLVED FIXED in Firefox 69

Status

()

enhancement
P3
normal
RESOLVED FIXED
4 months ago
Last month

People

(Reporter: gregtatum, Assigned: gregtatum)

Tracking

(Regressed 3 bugs)

62 Branch
mozilla69
Points:
---

Firefox Tracking Flags

(firefox69 fixed)

Details

Attachments

(4 attachments)

This is currently implemented in the DevTool's performance actor. We should try to see if we can tap into this for the Gecko Profiler.

Assignee: nobody → gtatum
Priority: -- → P3

Marking as P3, since it's experimental at this point.

I submitted a WIP patch on doing this.

:jimb I had a couple questions on interacting with the JS object in this patch. I have 3 TODO comments on the js/src/vm/SavedStacks.cpp file I submitted to phabricator. I could use some insight here if you wouldn't mind looking at them.

Flags: needinfo?(jimb)

I did more investigations, and it turns out the UbiNode class has a lot of the utilities to extract the information I need. I'm going to try that approach instead.

Flags: needinfo?(jimb)
Attachment #9059375 - Attachment description: Bug 1545582 - Add JavaScript memory allocation tracking to the profiler → Bug 1545582 - Add JavaScript memory allocation tracking to the profiler. r?jimb,canaltinova

The current revision is accepted, but I found out that I didn't hook into the JS engine correctly. The issue is that I'm only instrumenting the current Realm that is active when the profiler is turned on, and I need to be able to instrument any new Realm that gets added. I'm going to rework the patch with another approach. Most of it is still valid, except how I hook into the JS engine.

See Also: → 1549579
Attachment #9059375 - Attachment description: Bug 1545582 - Add JavaScript memory allocation tracking to the profiler. r?jimb,canaltinova → Bug 1545582 - Add a JS runtime level of allocation logging; r?jimb
Pushed by gtatum@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/285673afaa99
Add a JS runtime level of allocation logging; r=jimb
https://hg.mozilla.org/integration/autoland/rev/699de45940b1
Integrate JavaScript memory allocation tracking to the profiler; r=canaltinova
https://hg.mozilla.org/integration/autoland/rev/c05a5d68d9a8
Add tests for new JS allocations feature; r=canaltinova
https://hg.mozilla.org/integration/autoland/rev/a47c4a44bae0
Hook JS allocations into the profiler popup; r=canaltinova

Backed out 4 changesets for causing build bustages in SavedStacks.cpp

Backout link: https://hg.mozilla.org/integration/autoland/rev/c945fb0af69583f4a15f8847f23e430b1b8a1d6d

Push with failures: https://treeherder.mozilla.org/#/jobs?repo=autoland&selectedJob=251966372&resultStatus=testfailed%2Cbusted%2Cexception&revision=a47c4a44bae011603bf1442c83a516f83f3de611&searchStr=build

Failure log: https://treeherder.mozilla.org/logviewer.html#/jobs?job_id=251966372&repo=autoland&lineNumber=8695

task 2019-06-14T23:08:56.485Z] 23:08:56 INFO - In file included from /builds/worker/workspace/build/src/obj-firefox/js/src/Unified_cpp_js_src19.cpp:38:
[task 2019-06-14T23:08:56.486Z] 23:08:56 ERROR - /builds/worker/workspace/build/src/js/src/vm/SavedStacks.cpp:1895:9: error: non-constant-expression cannot be narrowed from type 'JS::ubi::Node::Size' (aka 'unsigned long long') to 'size_t' (aka 'unsigned int') in initializer list [-Wc++11-narrowing]
[task 2019-06-14T23:08:56.487Z] 23:08:56 INFO - node.size(cx->runtime()->debuggerMallocSizeOf),
[task 2019-06-14T23:08:56.488Z] 23:08:56 INFO - ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[task 2019-06-14T23:08:56.489Z] 23:08:56 INFO - /builds/worker/workspace/build/src/js/src/vm/SavedStacks.cpp:1895:9: note: insert an explicit cast to silence this issue
[task 2019-06-14T23:08:56.489Z] 23:08:56 INFO - node.size(cx->runtime()->debuggerMallocSizeOf),
[task 2019-06-14T23:08:56.490Z] 23:08:56 INFO - ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[task 2019-06-14T23:08:56.491Z] 23:08:56 INFO - static_cast<size_t>( )
[task 2019-06-14T23:08:56.492Z] 23:08:56 INFO - 1 error generated.
[task 2019-06-14T23:08:56.493Z] 23:08:56 INFO - /builds/worker/workspace/build/src/config/rules.mk:810: recipe for target 'Unified_cpp_js_src19.o' failed
[task 2019-06-14T23:08:56.494Z] 23:08:56 ERROR - make[4]: *** [Unified_cpp_js_src19.o] Error 1
[task 2019-06-14T23:08:56.495Z] 23:08:56 INFO - make[4]: Leaving directory '/builds/worker/workspace/build/src/obj-firefox/js/src'
[task 2019-06-14T23:08:56.496Z] 23:08:56 INFO - make[4]: *** Waiting for unfinished jobs....

Flags: needinfo?(gtatum)
Pushed by gtatum@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/3224107774b1
Add a JS runtime level of allocation logging; r=jimb
https://hg.mozilla.org/integration/autoland/rev/c65de5ec10da
Integrate JavaScript memory allocation tracking to the profiler; r=canaltinova
https://hg.mozilla.org/integration/autoland/rev/6640b7f3d7e0
Add tests for new JS allocations feature; r=canaltinova
https://hg.mozilla.org/integration/autoland/rev/c53f9e22d5f7
Hook JS allocations into the profiler popup; r=canaltinova
Backout by aciure@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/779795f21006
Backed out 4 changesets for causing spidermonkey bustages CLOSED TREE
Flags: needinfo?(gtatum)
Pushed by gtatum@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/aaea4c45935f
Add a JS runtime level of allocation logging; r=jimb
https://hg.mozilla.org/integration/autoland/rev/c9cba85e0b62
Integrate JavaScript memory allocation tracking to the profiler; r=canaltinova
https://hg.mozilla.org/integration/autoland/rev/3c4bfd4d4015
Add tests for new JS allocations feature; r=canaltinova
https://hg.mozilla.org/integration/autoland/rev/44349fd95ae4
Hook JS allocations into the profiler popup; r=canaltinova
Regressions: 1562944
Regressions: 1562945
Regressions: 1562978
You need to log in before you can comment on or make changes to this bug.