Skip to content

Commit e2c414e

Browse files
committed
fdtrack: report the total number of stacks...
...not the number of unique stacks. The current implementation led to "most common stack (416/36)" on http://b/348438825, for example. Change-Id: Id8d92c279d339124347163e181a2f43881f9f416
1 parent 70ffc32 commit e2c414e

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

libfdtrack/fdtrack.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -269,8 +269,10 @@ static void fdtrack_dump_impl(bool fatal) {
269269
if (fatal) {
270270
// Find the most common stack.
271271
size_t max = 0;
272+
size_t total = 0;
272273
StackInfo* stack = nullptr;
273274
for (size_t i = 0; i < stacks.count; ++i) {
275+
total += stacks.data[i].count;
274276
if (stacks.data[i].count > max) {
275277
stack = &stacks.data[i];
276278
max = stack->count;
@@ -287,7 +289,7 @@ static void fdtrack_dump_impl(bool fatal) {
287289
char* p = buf;
288290
p += async_safe_format_buffer(buf, sizeof(buf),
289291
"aborting due to fd leak: see \"open files\" in the tombstone; "
290-
"most common stack (%zu/%zu) is\n", max, stacks.count);
292+
"most common stack (%zu/%zu) is\n", max, total);
291293

292294
for (size_t i = 0; i < stack->stack_depth; ++i) {
293295
ssize_t bytes_left = buf + sizeof(buf) - p;

0 commit comments

Comments
 (0)