-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Feature: Task Killer
Provide a way to kill tasks in Cockpit, to test garbage collection and allow a person using Cockpit to manually free up resources on the client machine (the computer running the browser) as well as the server (in tasks that require heavy IO, etc.).
This feature is meant primarily as a debugging tool.
TBD
It's a common pattern to provide extended information on applications in the about box. Sometimes, this may include resources used. Andreas and I (Garrett) are looking to implement a task list where tasks can be killed inside the Cockpit about dialog.
An alternate approach would be to have a hidden keystroke to enable the ability to close running tasks from the navigation. This approach is not mutually exclusive with the about box method. However, Andreas and I (Garrett) think it's best to make an advanced feature like this a bit more hidden.
After (or while) this feature is implemented, it may be a good idea for tasks running inside of Cockpit to provide hints on whether they should persist or could be transient (recreated at each request). Lighter weight frames may then be cleaned up a bit more aggressively in the background according to some heuristic (with something like time since last used, # of tasks since last use, # of active tasks, the persistence hint, and so on).
TBD
It would be nice to have some sort of stats for resource usage for each iframe. A lot of metrics we'd want to use are probably only available at a browser-level, instead of within the page. However, there should be some JS APIs we can use to display performance.
- Navigation Timing / Performance API
- Very broad browser support: http://caniuse.com/#feat=nav-timing
- Docs: https://developer.mozilla.org/en-US/docs/Web/API/Navigation_timing_API
- Quick overview: https://www.html5rocks.com/en/tutorials/webperformance/basics/
- Using Navigation Timing on
iframe
s: http://stackoverflow.com/questions/9944170/using-the-new-javascript-performance-timing-api-on-iframes -
performance.getEntries()
to get a list of various loaded resources and the stats (modify foriframe
usage, of course) - Chrome has
performance.memory
(Firefox does not) — the about might need to be different between browsers, as it would be great to have actual memory values instead of approximates or (essentially) made-up resource measurements - All browsers have page load / render times, which can be applied to iframes and is a pretty decent (but not perfect) resource measurement
-
Snippet I figured out that should show the DOM render time for each
iframe
(run in dev console):$('iframe').each(function(i, iframe){ console.log(iframe.name, iframe.contentWindow.performance.timing.domComplete - iframe.contentWindow.performance.timing.domLoading); })
-
- querySelector
-
document.querySelectorAll('*').length
can be a very crude indicator on elements in the DOM; this could be used per iframe - it's generally not a great metric, as it doesn't count interactivity, memory usage, or other things (as it does take some elements longer to render than others)
-