Commit 068a6afb authored by ulan's avatar ulan Committed by Commit bot

Clean up output of heap object tracing

BUG=

Review URL: https://codereview.chromium.org/1097683002

Cr-Commit-Position: refs/heads/master@{#27929}
parent e0670ac5
...@@ -6307,10 +6307,9 @@ void Heap::ClearObjectStats(bool clear_last_time_stats) { ...@@ -6307,10 +6307,9 @@ void Heap::ClearObjectStats(bool clear_last_time_stats) {
static base::LazyMutex object_stats_mutex = LAZY_MUTEX_INITIALIZER; static base::LazyMutex object_stats_mutex = LAZY_MUTEX_INITIALIZER;
static void TraceObjectStat(const char* name, int count, int size) { void Heap::TraceObjectStat(const char* name, int count, int size, double time) {
if (size > 0) { PrintPID("heap:%p, time:%f, gc:%d, type:%s, count:%d, size:%d\n",
PrintF("%40s\tcount= %6d\t size= %6d kb\n", name, count, size); static_cast<void*>(this), time, ms_count_, name, count, size);
}
} }
...@@ -6320,25 +6319,26 @@ void Heap::TraceObjectStats() { ...@@ -6320,25 +6319,26 @@ void Heap::TraceObjectStats() {
int count; int count;
int size; int size;
int total_size = 0; int total_size = 0;
double time = isolate_->time_millis_since_init();
#define TRACE_OBJECT_COUNT(name) \ #define TRACE_OBJECT_COUNT(name) \
count = static_cast<int>(object_counts_[name]); \ count = static_cast<int>(object_counts_[name]); \
size = static_cast<int>(object_sizes_[name]) / KB; \ size = static_cast<int>(object_sizes_[name]) / KB; \
total_size += size; \ total_size += size; \
TraceObjectStat(#name, count, size); TraceObjectStat(#name, count, size, time);
INSTANCE_TYPE_LIST(TRACE_OBJECT_COUNT) INSTANCE_TYPE_LIST(TRACE_OBJECT_COUNT)
#undef TRACE_OBJECT_COUNT #undef TRACE_OBJECT_COUNT
#define TRACE_OBJECT_COUNT(name) \ #define TRACE_OBJECT_COUNT(name) \
index = FIRST_CODE_KIND_SUB_TYPE + Code::name; \ index = FIRST_CODE_KIND_SUB_TYPE + Code::name; \
count = static_cast<int>(object_counts_[index]); \ count = static_cast<int>(object_counts_[index]); \
size = static_cast<int>(object_sizes_[index]) / KB; \ size = static_cast<int>(object_sizes_[index]) / KB; \
TraceObjectStat("CODE_" #name, count, size); TraceObjectStat("*CODE_" #name, count, size, time);
CODE_KIND_LIST(TRACE_OBJECT_COUNT) CODE_KIND_LIST(TRACE_OBJECT_COUNT)
#undef TRACE_OBJECT_COUNT #undef TRACE_OBJECT_COUNT
#define TRACE_OBJECT_COUNT(name) \ #define TRACE_OBJECT_COUNT(name) \
index = FIRST_FIXED_ARRAY_SUB_TYPE + name; \ index = FIRST_FIXED_ARRAY_SUB_TYPE + name; \
count = static_cast<int>(object_counts_[index]); \ count = static_cast<int>(object_counts_[index]); \
size = static_cast<int>(object_sizes_[index]) / KB; \ size = static_cast<int>(object_sizes_[index]) / KB; \
TraceObjectStat("FIXED_ARRAY_" #name, count, size); TraceObjectStat("*FIXED_ARRAY_" #name, count, size, time);
FIXED_ARRAY_SUB_INSTANCE_TYPE_LIST(TRACE_OBJECT_COUNT) FIXED_ARRAY_SUB_INSTANCE_TYPE_LIST(TRACE_OBJECT_COUNT)
#undef TRACE_OBJECT_COUNT #undef TRACE_OBJECT_COUNT
#define TRACE_OBJECT_COUNT(name) \ #define TRACE_OBJECT_COUNT(name) \
...@@ -6346,10 +6346,9 @@ void Heap::TraceObjectStats() { ...@@ -6346,10 +6346,9 @@ void Heap::TraceObjectStats() {
FIRST_CODE_AGE_SUB_TYPE + Code::k##name##CodeAge - Code::kFirstCodeAge; \ FIRST_CODE_AGE_SUB_TYPE + Code::k##name##CodeAge - Code::kFirstCodeAge; \
count = static_cast<int>(object_counts_[index]); \ count = static_cast<int>(object_counts_[index]); \
size = static_cast<int>(object_sizes_[index]) / KB; \ size = static_cast<int>(object_sizes_[index]) / KB; \
TraceObjectStat("CODE_AGE_" #name, count, size); TraceObjectStat("*CODE_AGE_" #name, count, size, time);
CODE_AGE_LIST_COMPLETE(TRACE_OBJECT_COUNT) CODE_AGE_LIST_COMPLETE(TRACE_OBJECT_COUNT)
#undef TRACE_OBJECT_COUNT #undef TRACE_OBJECT_COUNT
PrintF("Total size= %d kb\n", total_size);
} }
......
...@@ -1454,6 +1454,7 @@ class Heap { ...@@ -1454,6 +1454,7 @@ class Heap {
} }
void TraceObjectStats(); void TraceObjectStats();
void TraceObjectStat(const char* name, int count, int size, double time);
void CheckpointObjectStats(); void CheckpointObjectStats();
// We don't use a LockGuard here since we want to lock the heap // We don't use a LockGuard here since we want to lock the heap
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment