Closed Bug 976007 Opened 10 years ago Closed 6 years ago

Add images size to "App memory" in the Developer HUD

Categories

(Firefox OS Graveyard :: Gaia::System, defect, P2)

All
Gonk (Firefox OS)
defect

Tracking

(Not tracked)

RESOLVED WONTFIX

People

(Reporter: janx, Assigned: janx)

References

Details

(Keywords: perf, Whiteboard: [c=devtools p= s= u=])

Attachments

(1 file)

Images are an important part of an app's memory footprint. Developers should be able to watch it using the Developer HUD's "App memory" monitor.

(From Nicholas Nethercote [:njn] in comment 963498#22)
> All the image data for a single process is currently reported in the
> "images" sub-tree in about:memory. For desktop Firefox, this means that we
> unfortunately don't have per-tab image measurements (bug 921300 is open for
> that).
> 
> For FxOS apps this perhaps isn't a problem, since apps are their own
> processes. nsIMemoryReporterManager already has a
> |imagesContentUsedUncompressed| member which you could use; it's implemented
> here:
> http://dxr.mozilla.org/mozilla-central/source/image/src/imgLoader.cpp#131.
> Or if you want to report all aspects of the image data (both raw and
> uncompressed, content and chrome) you could add another, similar member.
OS: Linux → Gonk (Firefox OS)
Hardware: x86_64 → All
Depends on: 984833
The attached patch uses `nsIMemoryReporterManager.imagesContentUsedUncompressed` http://dxr.mozilla.org/mozilla-central/source/xpcom/base/nsIMemoryReporter.idl#358 to report the current memory footprint of images in an app.

Trying it out on a device with Vivien, we noticed that it doesn't show exactly what we expected (e.g. apps like the marketplace that have a lot of images have surprisingly low footprints like 4KB).

Looking at about:memory, it seems to only count uncompressed-heap and uncompressed-nonheap from:

> ├───0.79 MB (01.40%) -- images
> │   ├──0.79 MB (01.40%) -- content
> │   │  ├──0.79 MB (01.40%) -- used
> │   │  │  ├──0.68 MB (01.22%) ── raw
> │   │  │  └──0.10 MB (00.19%) -- (2 tiny)
> │   │  │     ├──0.10 MB (00.19%) ── uncompressed-heap
> │   │  │     └──0.00 MB (00.00%) ── uncompressed-nonheap

I think `imagesContentUsedUncompressed` doesn't cover everything web developers want to know about image memory, and we might - as Nicholas suggested - want to add a more generic member, like `imagesContentUsed` or simply just `images`. Vivien, any thoughts?
Flags: needinfo?(21)
(In reply to Jan Keromnes [:janx] from comment #2)
> The attached patch uses
> `nsIMemoryReporterManager.imagesContentUsedUncompressed`
> http://dxr.mozilla.org/mozilla-central/source/xpcom/base/nsIMemoryReporter.
> idl#358 to report the current memory footprint of images in an app.
> 
> Trying it out on a device with Vivien, we noticed that it doesn't show
> exactly what we expected (e.g. apps like the marketplace that have a lot of
> images have surprisingly low footprints like 4KB).
> 
> Looking at about:memory, it seems to only count uncompressed-heap and
> uncompressed-nonheap from:
> 
> > ├───0.79 MB (01.40%) -- images
> > │   ├──0.79 MB (01.40%) -- content
> > │   │  ├──0.79 MB (01.40%) -- used
> > │   │  │  ├──0.68 MB (01.22%) ── raw
> > │   │  │  └──0.10 MB (00.19%) -- (2 tiny)
> > │   │  │     ├──0.10 MB (00.19%) ── uncompressed-heap
> > │   │  │     └──0.00 MB (00.00%) ── uncompressed-nonheap
> 
> I think `imagesContentUsedUncompressed` doesn't cover everything web
> developers want to know about image memory, and we might - as Nicholas
> suggested - want to add a more generic member, like `imagesContentUsed` or
> simply just `images`. Vivien, any thoughts?

I agree. As you know I have a dirty local patch that is supposed to do that but does not work yet for some reasons.

The patch was about to expose imagesContent for both used and unused. I will defer to Nicholas to know if unused is useful or not for web developers.
For example if on the content side there is no way for them to do anything to the amount of data that are in unused, it seems to me that it this information won't help them.
Flags: needinfo?(21)
tagging this so perf team can track it under devtools category
Keywords: perf
Whiteboard: [c=devtools p= s= u=]
Priority: -- → P2
Firefox OS is not being worked on
Status: ASSIGNED → RESOLVED
Closed: 6 years ago
Resolution: --- → WONTFIX
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: