Change the hydrogen timing data to include zone allocation.

Review URL: http://codereview.chromium.org/6190002

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@6249 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
kmillikin@chromium.org 2011-01-10 14:16:47 +00:00
parent b4ea8c7f5e
commit 32254e5324
5 changed files with 36 additions and 12 deletions

View File

@ -1,4 +1,4 @@
// Copyright 2010 the V8 project authors. All rights reserved.
// Copyright 2011 the V8 project authors. All rights reserved.
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
@ -5713,31 +5713,40 @@ void HStatistics::Print() {
PrintF("%30s", names_[i]);
double ms = static_cast<double>(timing_[i]) / 1000;
double percent = static_cast<double>(timing_[i]) * 100 / sum;
PrintF(" - %0.3f ms / %0.3f %% \n", ms, percent);
PrintF(" - %7.3f ms / %4.1f %% ", ms, percent);
unsigned size = sizes_[i];
double size_percent = static_cast<double>(size) * 100 / total_size_;
PrintF(" %8u bytes / %4.1f %%\n", size, size_percent);
}
PrintF("%30s - %0.3f ms \n", "Sum", static_cast<double>(sum) / 1000);
PrintF("%30s - %7.3f ms %8u bytes\n", "Sum",
static_cast<double>(sum) / 1000,
total_size_);
PrintF("---------------------------------------------------------------\n");
PrintF("%30s - %0.3f ms (%0.1f times slower than full code gen)\n",
PrintF("%30s - %7.3f ms (%.1f times slower than full code gen)\n",
"Total",
static_cast<double>(total_) / 1000,
static_cast<double>(total_) / full_code_gen_);
}
void HStatistics::SaveTiming(const char* name, int64_t ticks) {
void HStatistics::SaveTiming(const char* name, int64_t ticks, unsigned size) {
if (name == HPhase::kFullCodeGen) {
full_code_gen_ += ticks;
} else if (name == HPhase::kTotal) {
total_ += ticks;
} else {
total_size_ += size;
for (int i = 0; i < names_.length(); ++i) {
if (names_[i] == name) {
timing_[i] += ticks;
sizes_[i] += size;
return;
}
}
names_.Add(name);
timing_.Add(ticks);
sizes_.Add(size);
}
}
@ -5758,13 +5767,15 @@ void HPhase::Begin(const char* name,
chunk_ = allocator->chunk();
}
if (FLAG_time_hydrogen) start_ = OS::Ticks();
start_allocation_size_ = Zone::allocation_size_;
}
void HPhase::End() const {
if (FLAG_time_hydrogen) {
int64_t end = OS::Ticks();
HStatistics::Instance()->SaveTiming(name_, end - start_);
unsigned size = Zone::allocation_size_ - start_allocation_size_;
HStatistics::Instance()->SaveTiming(name_, end - start_, size);
}
if (FLAG_trace_hydrogen) {

View File

@ -1,4 +1,4 @@
// Copyright 2010 the V8 project authors. All rights reserved.
// Copyright 2011 the V8 project authors. All rights reserved.
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
@ -906,7 +906,7 @@ class HValueMap: public ZoneObject {
class HStatistics: public Malloced {
public:
void Print();
void SaveTiming(const char* name, int64_t ticks);
void SaveTiming(const char* name, int64_t ticks, unsigned size);
static HStatistics* Instance() {
static SetOncePointer<HStatistics> instance;
if (!instance.is_set()) {
@ -917,11 +917,19 @@ class HStatistics: public Malloced {
private:
HStatistics() : timing_(5), names_(5), total_(0), full_code_gen_(0) { }
HStatistics()
: timing_(5),
names_(5),
sizes_(5),
total_(0),
total_size_(0),
full_code_gen_(0) { }
List<int64_t> timing_;
List<const char*> names_;
List<unsigned> sizes_;
int64_t total_;
unsigned total_size_;
int64_t full_code_gen_;
};
@ -958,6 +966,7 @@ class HPhase BASE_EMBEDDED {
HGraph* graph_;
LChunk* chunk_;
LAllocator* allocator_;
unsigned start_allocation_size_;
};

View File

@ -1,4 +1,4 @@
// Copyright 2006-2008 the V8 project authors. All rights reserved.
// Copyright 2011 the V8 project authors. All rights reserved.
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
@ -47,6 +47,7 @@ inline void* Zone::New(int size) {
// Check that the result has the proper alignment and return it.
ASSERT(IsAddressAligned(result, kAlignment, 0));
allocation_size_ += size;
return reinterpret_cast<void*>(result);
}

View File

@ -1,4 +1,4 @@
// Copyright 2006-2008 the V8 project authors. All rights reserved.
// Copyright 2011 the V8 project authors. All rights reserved.
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
@ -38,6 +38,7 @@ Address Zone::position_ = 0;
Address Zone::limit_ = 0;
int Zone::zone_excess_limit_ = 256 * MB;
int Zone::segment_bytes_allocated_ = 0;
unsigned Zone::allocation_size_ = 0;
bool AssertNoZoneAllocation::allow_allocation_ = true;

View File

@ -1,4 +1,4 @@
// Copyright 2006-2008 the V8 project authors. All rights reserved.
// Copyright 2011 the V8 project authors. All rights reserved.
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
@ -71,6 +71,8 @@ class Zone {
static inline void adjust_segment_bytes_allocated(int delta);
static unsigned allocation_size_;
private:
// All pointers returned from New() have this alignment.