tv_profile
Record a JS CPU profile on a Smart TV and read memory/layout metrics. Start sampling, exercise the UI, then stop to get a .cpuprofile and before/after metric diffs to catch leaks and slowdowns.
Instructions
Record a JS CPU profile on the device, and/or read memory & layout metrics. action:"start" begins sampling, then do the thing you want to measure (tv_press / tv_goto / a scroll), then action:"stop" writes a .cpuprofile file (open it in Chrome DevTools -> Performance -> Load profile) and returns a top-N summary of self time by function and by file. start and stop each also take a Performance.getMetrics reading, so stop reports before/after/diff per metric (JSHeapUsedSize, Nodes, JSEventListeners, LayoutCount, RecalcStyleCount, cumulative Duration counters) — that is how you catch growth the CPU profile cannot see. action:"metrics" is just that reading, with no recording. On a minified production build pass sourceMap (the app.js.map of THAT build) to get readable names. The CPU profile works on the whole park (Profiler exists down to Chrome 38); metrics need Chromium 60+ (tizen55, pc) — on webOS 3 action:"metrics" fails with a clear message, while start/stop still return the profile with metrics:null and a warning.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| path | No | stop: where to write the .cpuprofile. Defaults to a scratch path. | |
| topN | No | stop: how many functions/files to report (default 20). | |
| action | Yes | start a recording, stop it and get the result, or just read the metrics right now. | |
| device | No | Device id from devices.json. Omit to use the default device. | |
| sourceMap | No | stop: path to the .map of the build running on the device. Only the top-N frames are de-minified; a map that fails to load degrades to a warning. | |
| collectGarbage | No | Force a GC right before this reading (default false). Turn it on for leak hunting — on stop it makes the heap diff show what is really retained instead of garbage not collected yet. It costs a GC pause, which is why it is off by default inside a recording. | |
| samplingIntervalUs | No | start: sampling interval in microseconds (default 1000). Raise it (e.g. 4000) for long recordings on a weak TV, where sampling itself costs. |