Closed Bug 1056962 Opened 5 years ago Closed 5 years ago

Add process name to gralloc memory report entries

Categories

(Core :: Graphics: Layers, defect)

All
Gonk (Firefox OS)
defect
Not set

Tracking

()

RESOLVED FIXED
mozilla34

People

(Reporter: erahm, Assigned: erahm)

References

Details

Attachments

(2 files)

In order to make debugging easier and support better memory report diffing we should add the process name to gralloc memory report entries [1].

The same technique can be used that is employed in the SystemMemoryReporter [2] to read the "threadname" from /proc/<pid>/comm.

Current format:
├──-5.91 MB (-10800.00%) ── pid(5518)/buffer(width=256, height=256, bpp=4, stride=288) [21]

Proposed format:
├──-5.91 MB (-10800.00%) ── Proc Name (pid=5518)/buffer(width=256, height=256, bpp=4, stride=288) [21]

[1] http://hg.mozilla.org/mozilla-central/annotate/c14e5feadc61/gfx/layers/ipc/SharedBufferManagerParent.cpp#l68
[2] http://hg.mozilla.org/mozilla-central/annotate/dac8b4a0bd7c/xpcom/base/SystemMemoryReporter.cpp#l359
This separates out GetThreadName into an external file so that it can used elsewhere.
Attachment #8477081 - Flags: review?(jld)
Assignee: nobody → erahm
Status: NEW → ASSIGNED
This adds the process name to the gralloc memory report entries. Output is as follows:

22.12 MB (100.0%) -- gralloc
├──15.86 MB (71.72%) -- Camera (pid=3378)
│  ├───9.67 MB (43.72%) ── buffer(width=1280, height=720, bpp=1, stride=1280) [11]
│  ├───3.13 MB (14.14%) ── buffer(width=480, height=854, bpp=4, stride=480) [2]
│  └───3.07 MB (13.86%) ── buffer(width=480, height=837, bpp=4, stride=480) [2]
└───6.25 MB (28.28%) ── b2g (pid=2457)/buffer(width=480, height=854, bpp=4, stride=480) [4]
Attachment #8477082 - Flags: review?(bgirard)
Comment on attachment 8477082 [details] [diff] [review]
Part 2: Add proc name to gralloc memory report entries

Review of attachment 8477082 [details] [diff] [review]:
-----------------------------------------------------------------

::: gfx/layers/ipc/SharedBufferManagerParent.cpp
@@ +69,5 @@
>            // Special case for BSP specific formats (mainly YUV formats, count it as normal YUV buffer).
>            : (stride * height * 3 / 2);
>  
> +        nsPrintfCString gpath("gralloc/%s (pid=%d)/buffer(width=%d, height=%d, bpp=%d, stride=%d)",
> +            pidName.get(), pid, gb->getWidth(), height, bpp, stride);

Empty string for the default value if the pid isn't found? It's possible for the process to no longer be alive when we call GetThreadName so it can happen. Let's ignore the chance of the process dieing and the number being recycled.
Attachment #8477082 - Flags: review?(bgirard) → review+
Attachment #8477081 - Flags: review?(jld) → review+
https://hg.mozilla.org/mozilla-central/rev/53f7b6fdd6db
https://hg.mozilla.org/mozilla-central/rev/e676a1bc50b5
Status: ASSIGNED → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla34
You need to log in before you can comment on or make changes to this bug.