paulirish / devtools-timeline-model

Unsupported
Other
172 stars 35 forks source link

Peak JS Heap #17

Open dchristian-ias opened 7 years ago

dchristian-ias commented 7 years ago

Hi there,

I am currently utilizing the automated-chrome-profiling (or at least a very similar script) to generate a timeline-trace and devtools-timeline-model to model the returned events.

I am looking to find the Peak JS Heap size for the rendered page on page load, however I am running into some issues. When I load this trace file (changed extension to txt since my Mac seemed to have issues opening a downloaded trace file, you might need to change that back) into Chrome Devtools as "Load Timeline Data", I can see that the memory profiler shows the max JS Heap at 17564648, which I can locate in the trace file coming from an event with name UpdateCounters. However, if I do my own version of filtering for this event (name) type and return the largest jsHeapSizeUsed I get 83642800.

My main question is, how can I filter the UpdateCounters events to return the same data that builds the memory profiler in the devtools timeline, does devtools-timeline-model provide an easy way to do this?

Thanks!

paulirish commented 7 years ago

Looking here: https://github.com/ChromeDevTools/devtools-frontend/blob/1e4ce3ab99f2e8379791993f1faebb0884d37b91/front_end/timeline/MemoryCountersGraph.js#L60-L82 ...

it looks like you want to use the mainThreadEvents() and work from there. Otherwise you'll be getting data from other tabs (and extensions) in your trace. Aside from that, things looks pretty straightforward.

Thanks for filing the issue. let me know what you find out!