Closed Bug 932609 Opened 11 years ago Closed 9 years ago

GCLI: add a command to measure the memory consumption of the current tab

Categories

(DevTools Graveyard :: Graphic Commandline and Toolbar, defect)

x86_64
Linux
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED WONTFIX

People

(Reporter: n.nethercote, Unassigned)

Details

Bug 918207 has a draft patch that invokes sizeOfTab and prints the half dozen or so numbers in a short-lived box that sits above the GCLI (I don't know what the correct term for that box is). The patch needs some cleaning up. And is there a better way to show its output?
(In reply to Nicholas Nethercote [:njn] from comment #0) > Bug 918207 has a draft patch that invokes sizeOfTab and prints the half > dozen or so numbers in a short-lived box that sits above the GCLI (I don't > know what the correct term for that box is). > > The patch needs some cleaning up. And is there a better way to show its > output? Nice. There is a better way to format output that confers 2 benefits: * HTML formatted output * The potential ability to pipe the output of this command to something that consumes the values without needing to scrape data The method you have right now works just fine - I wouldn't reject it because the output was a string, and I have a plan to go through BuiltinCommands doing a tidy-up so that might be a good time to do it.
Component: Developer Tools: Console → Developer Tools: Graphic Commandline and Toolbar
> There is a better way to format output And what is that way? Is there an existing command I can look at for ideas?
The 'cookie list' command is probably the best example [1]: gcli.addCommand({ name: "cookie list", ... returnType: "cookies", exec: function(args, context) { // ... let enm = cookieMgr.getCookiesFromHost(host); let cookies = []; while (enm.hasMoreElements()) { let cookie = enm.getNext().QueryInterface(Ci.nsICookie); cookies.push({ host: cookie.host, name: cookie.name, value: cookie.value, path: cookie.path }); } return cookies; } }); i.e. the return type is 'cookies' and it returns a JSONable blob of data Then there is a converter from 'cookies' to HTML [2], where the important bits are: gcli.addConverter({ from: "cookies", to: "view", exec: function(cookies, context) { //... return context.createView({ html: cookieListHtml, data: { cookies: cookies } }); } }); And cookieListHtml is defined a bit earlier [3]. The official docs [4] might also be useful, but they're light on converters, and there's good documentation on the template system at [5]. [1]: http://mxr.mozilla.org/mozilla-central/source/browser/devtools/commandline/BuiltinCommands.jsm#980 [2]: http://mxr.mozilla.org/mozilla-central/source/browser/devtools/commandline/BuiltinCommands.jsm#914 [3]: http://mxr.mozilla.org/mozilla-central/source/browser/devtools/commandline/BuiltinCommands.jsm#879 [4]: https://github.com/joewalker/gcli/blob/master/docs/index.md [5]: https://github.com/joewalker/domtemplate
Assignee: n.nethercote → nobody
Triage. Filter on Lobster Thermidor. Nice idea, but it's not been worked on in 4 years, and I don't see that the priority of GCLI has increased in that time, so I don't think we need to keep it on file.
Status: ASSIGNED → RESOLVED
Closed: 9 years ago
Resolution: --- → WONTFIX
Product: Firefox → DevTools
Product: DevTools → DevTools Graveyard
You need to log in before you can comment on or make changes to this bug.