Clean up output of heap object tracing

BUG=

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

Cr-Commit-Position: refs/heads/master@{#27929}
This commit is contained in:
ulan 2015-04-18 02:21:15 -07:00 committed by Commit bot
parent e0670ac5c9
commit 068a6afb44
2 changed files with 9 additions and 9 deletions

View File

@ -6307,10 +6307,9 @@ void Heap::ClearObjectStats(bool clear_last_time_stats) {
static base::LazyMutex object_stats_mutex = LAZY_MUTEX_INITIALIZER;
static void TraceObjectStat(const char* name, int count, int size) {
if (size > 0) {
PrintF("%40s\tcount= %6d\t size= %6d kb\n", name, count, size);
}
void Heap::TraceObjectStat(const char* name, int count, int size, double time) {
PrintPID("heap:%p, time:%f, gc:%d, type:%s, count:%d, size:%d\n",
static_cast<void*>(this), time, ms_count_, name, count, size);
}
@ -6320,25 +6319,26 @@ void Heap::TraceObjectStats() {
int count;
int size;
int total_size = 0;
double time = isolate_->time_millis_since_init();
#define TRACE_OBJECT_COUNT(name) \
count = static_cast<int>(object_counts_[name]); \
size = static_cast<int>(object_sizes_[name]) / KB; \
total_size += size; \
TraceObjectStat(#name, count, size);
TraceObjectStat(#name, count, size, time);
INSTANCE_TYPE_LIST(TRACE_OBJECT_COUNT)
#undef TRACE_OBJECT_COUNT
#define TRACE_OBJECT_COUNT(name) \
index = FIRST_CODE_KIND_SUB_TYPE + Code::name; \
count = static_cast<int>(object_counts_[index]); \
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)
#undef TRACE_OBJECT_COUNT
#define TRACE_OBJECT_COUNT(name) \
index = FIRST_FIXED_ARRAY_SUB_TYPE + name; \
count = static_cast<int>(object_counts_[index]); \
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)
#undef TRACE_OBJECT_COUNT
#define TRACE_OBJECT_COUNT(name) \
@ -6346,10 +6346,9 @@ void Heap::TraceObjectStats() {
FIRST_CODE_AGE_SUB_TYPE + Code::k##name##CodeAge - Code::kFirstCodeAge; \
count = static_cast<int>(object_counts_[index]); \
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)
#undef TRACE_OBJECT_COUNT
PrintF("Total size= %d kb\n", total_size);
}

View File

@ -1454,6 +1454,7 @@ class Heap {
}
void TraceObjectStats();
void TraceObjectStat(const char* name, int count, int size, double time);
void CheckpointObjectStats();
// We don't use a LockGuard here since we want to lock the heap