RESOLVED FIXED 205366
[JSC] Memory usage statistics should be attainable without WebCore
https://bugs.webkit.org/show_bug.cgi?id=205366
Summary [JSC] Memory usage statistics should be attainable without WebCore
Ross Kirsling
Reported 2019-12-17 16:43:04 PST
PerformanceLogging::memoryUsageStatistics puts together some very useful information, most of which comes from vm.heap and not from WebCore itself: https://github.com/WebKit/webkit/blob/master/Source/WebCore/page/PerformanceLogging.cpp#L54-L76 As such it would be nice to have this information available in a JSC-only context. There are two possible approaches I can see: 1. Add methods to $vm. $vm.globalObjectCount() already exists so we could just add a few more. 2. Add a private C API (say, JSMemoryUsageStatistics under JSBasePrivate.h) which builds a JS object of this information much like the WebCore version.
Attachments
Patch (3.50 KB, patch)
2019-12-18 13:24 PST, Ross Kirsling
no flags
Patch for landing (4.04 KB, patch)
2019-12-20 15:47 PST, Ross Kirsling
no flags
Ross Kirsling
Comment 1 2019-12-18 13:24:48 PST
Ross Kirsling
Comment 2 2019-12-18 13:26:47 PST
Here's a patch for the private API approach. If we feel this is useful enough to warrant a public API (and we're clear on how we'd want the ObjC version to be), I'd be happy to change it accordingly.
Keith Miller
Comment 3 2019-12-20 11:22:53 PST
Comment on attachment 386000 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=386000&action=review > Source/JavaScriptCore/API/JSBasePrivate.h:54 > +@result An object containing data such as heap size, heap capacity, and object counts. Can you put an @discussion that describes each of the properties on the returned object.
Ross Kirsling
Comment 4 2019-12-20 15:47:59 PST
Created attachment 386271 [details] Patch for landing
WebKit Commit Bot
Comment 5 2019-12-20 16:05:53 PST
Comment on attachment 386271 [details] Patch for landing Clearing flags on attachment: 386271 Committed r253854: <https://trac.webkit.org/changeset/253854>
WebKit Commit Bot
Comment 6 2019-12-20 16:05:55 PST
All reviewed patches have been landed. Closing bug.
Radar WebKit Bug Importer
Comment 7 2019-12-20 16:06:25 PST
Note You need to log in before you can comment on or make changes to this bug.