Closed Bug 1038921 Opened 11 years ago Closed 11 years ago

Extend system memory reporter to report kgsl memory

Categories

(Core :: XPCOM, defect)

ARM
Gonk (Firefox OS)
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla34
blocking-b2g 2.0+
Tracking Status
firefox32 --- wontfix
firefox33 --- wontfix
firefox34 --- fixed
b2g-v2.0 --- fixed
b2g-v2.1 --- fixed

People

(Reporter: erahm, Assigned: erahm)

Details

(Whiteboard: [MemShrink:P2])

Attachments

(2 files)

It looks like we can break out kgsl memory usage per-process by looking at the |/d/kgsl/proc/<pid>/mem| file on b2g devices. The total should roughly equal the |gralloc| entry for the system process, but it would be nice to have a cleaner breakdown. Proposed format is something like this: 152.72 MB (100.0%) -- kgsl ├───88.94 MB (58.24%) -- pid=123 │ ├──86.49 MB (56.63%) ── texture │ └───2.45 MB (01.61%) ── arraybuffer
This patch adds kgsl memory reporting to the SystemMemoryReporter.
Attachment #8459860 - Flags: review?(n.nethercote)
Assignee: nobody → erahm
Status: NEW → ASSIGNED
Comment on attachment 8459860 [details] [diff] [review] Extend system memory reporter to report kgsl memory Review of attachment 8459860 [details] [diff] [review]: ----------------------------------------------------------------- Thanks! ::: xpcom/base/SystemMemoryReporter.cpp @@ +869,5 @@ > + struct DirGuard > + { > + DirGuard(DIR* aDir) : dir(aDir) {} > + ~DirGuard() { closedir(dir); }; > + DIR* dir; mDir @@ +870,5 @@ > + { > + DirGuard(DIR* aDir) : dir(aDir) {} > + ~DirGuard() { closedir(dir); }; > + DIR* dir; > + }; RAII is great! But we usually call classes like this Auto<whatever>. Though MFBT uses Scoped<whatever>, for some reason. Anyway, use one of those. @@ +876,5 @@ > + struct FileGuard > + { > + FileGuard(FILE* aFile) : file(aFile) {} > + ~FileGuard() { fclose(file); } > + FILE* file; mFile @@ +890,5 @@ > + // gpuaddr useraddr size id flags type usage sglen > + // hexaddr hexaddr int int str str str int > + // We care primarily about the usage and size. > + > + // For simplicity numbers will be uint64_t, strings 15 chars max. Do you know that 15 is enough? It's not clear from the comment. If not, maybe make it a bit higher, e.g. 63? @@ +951,5 @@ > + flags, type, usage, &sglen) == kNumFields) { > + nsPrintfCString entryPath("kgsl-memory/%s/%s", procName.get(), usage); > + REPORT(entryPath, > + size, > + NS_LITERAL_CSTRING("A kgsl graphics memory allocation")); Nit: Period at end of the sentence.
Attachment #8459860 - Flags: review?(n.nethercote) → review+
(In reply to Nicholas Nethercote [:njn] from comment #2) > Comment on attachment 8459860 [details] [diff] [review] > RAII is great! But we usually call classes like this Auto<whatever>. Though > MFBT uses Scoped<whatever>, for some reason. Anyway, use one of those. I'll do AutoDir/AutoFile (I'm assuming that's what you meant, not AutoDirGuard). MFBT literally has a Scoped<T> class which I _could_ use, but it seems like overkill. > Do you know that 15 is enough? It's not clear from the comment. If not, > maybe make it a bit higher, e.g. 63? The longest I've found is 15, but it's probably better to err on the side of caution.
> I'll do AutoDir/AutoFile (I'm assuming that's what you meant, not AutoDirGuard). Yes!
Whiteboard: [MemShrink] → [MemShrink:P2]
Status: ASSIGNED → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla34
[Blocking Requested - why for this release]: Nom'ing for 2.0+, this should be useful for identifying and working on graphics memory regressions.
blocking-b2g: --- → 2.0?
Patch for the b2g 2.0 branch, adds missing function not on 2.0.
Attachment #8462809 - Flags: review+
Flags: needinfo?(erahm)
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: