libmemtrack: Update parsing of kgsl mem file
The mem file now has additional field, the mapsize. This represents the size in bytes mapped to userspace. Use this value and total size of an object to derive the unaccounted size. Bug: 30635019 CRs-Fixed: 982589 Change-Id: I9400e7ddacf185ebf93d0dd09e33a61685bea4dd
This commit is contained in:
parent
8c8c8d0c52
commit
76b25b6985
|
@ -85,7 +85,7 @@ int kgsl_memtrack_get_memory(pid_t pid, enum memtrack_type type,
|
|||
* count the entry as accounted else count the entry as unaccounted.
|
||||
*/
|
||||
while (1) {
|
||||
unsigned long size;
|
||||
unsigned long size, mapsize;
|
||||
char line_type[7];
|
||||
char flags[7];
|
||||
char line_usage[19];
|
||||
|
@ -96,19 +96,21 @@ int kgsl_memtrack_get_memory(pid_t pid, enum memtrack_type type,
|
|||
}
|
||||
|
||||
/* Format:
|
||||
* gpuaddr useraddr size id flags type usage sglen
|
||||
* 545ba000 545ba000 4096 1 ----pY gpumem arraybuffer 1
|
||||
* gpuaddr useraddr size id flags type usage sglen mapsize
|
||||
* 545ba000 545ba000 4096 1 ----pY gpumem arraybuffer 1 4096
|
||||
*/
|
||||
ret = sscanf(line, "%*x %*lx %lu %*d %6s %6s %18s %*d\n",
|
||||
&size, flags, line_type, line_usage);
|
||||
if (ret != 4) {
|
||||
ret = sscanf(line, "%*x %*lx %lu %*d %6s %6s %18s %*d %lu\n",
|
||||
&size, flags, line_type, line_usage, &mapsize);
|
||||
if (ret != 5) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (type == MEMTRACK_TYPE_GL && strcmp(line_type, "gpumem") == 0) {
|
||||
|
||||
if (flags[5] == 'Y')
|
||||
accounted_size += size;
|
||||
if (flags[5] == 'Y') {
|
||||
accounted_size += mapsize;
|
||||
unaccounted_size += size - mapsize;
|
||||
}
|
||||
else
|
||||
unaccounted_size += size;
|
||||
|
||||
|
|
Loading…
Reference in New Issue