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
parent b4ea8c7f
// 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 // Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are // modification, are permitted provided that the following conditions are
// met: // met:
...@@ -5713,31 +5713,40 @@ void HStatistics::Print() { ...@@ -5713,31 +5713,40 @@ void HStatistics::Print() {
PrintF("%30s", names_[i]); PrintF("%30s", names_[i]);
double ms = static_cast<double>(timing_[i]) / 1000; double ms = static_cast<double>(timing_[i]) / 1000;
double percent = static_cast<double>(timing_[i]) * 100 / sum; 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("---------------------------------------------------------------\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", "Total",
static_cast<double>(total_) / 1000, static_cast<double>(total_) / 1000,
static_cast<double>(total_) / full_code_gen_); 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) { if (name == HPhase::kFullCodeGen) {
full_code_gen_ += ticks; full_code_gen_ += ticks;
} else if (name == HPhase::kTotal) { } else if (name == HPhase::kTotal) {
total_ += ticks; total_ += ticks;
} else { } else {
total_size_ += size;
for (int i = 0; i < names_.length(); ++i) { for (int i = 0; i < names_.length(); ++i) {
if (names_[i] == name) { if (names_[i] == name) {
timing_[i] += ticks; timing_[i] += ticks;
sizes_[i] += size;
return; return;
} }
} }
names_.Add(name); names_.Add(name);
timing_.Add(ticks); timing_.Add(ticks);
sizes_.Add(size);
} }
} }
...@@ -5758,13 +5767,15 @@ void HPhase::Begin(const char* name, ...@@ -5758,13 +5767,15 @@ void HPhase::Begin(const char* name,
chunk_ = allocator->chunk(); chunk_ = allocator->chunk();
} }
if (FLAG_time_hydrogen) start_ = OS::Ticks(); if (FLAG_time_hydrogen) start_ = OS::Ticks();
start_allocation_size_ = Zone::allocation_size_;
} }
void HPhase::End() const { void HPhase::End() const {
if (FLAG_time_hydrogen) { if (FLAG_time_hydrogen) {
int64_t end = OS::Ticks(); 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) { if (FLAG_trace_hydrogen) {
......
// 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 // Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are // modification, are permitted provided that the following conditions are
// met: // met:
...@@ -906,7 +906,7 @@ class HValueMap: public ZoneObject { ...@@ -906,7 +906,7 @@ class HValueMap: public ZoneObject {
class HStatistics: public Malloced { class HStatistics: public Malloced {
public: public:
void Print(); void Print();
void SaveTiming(const char* name, int64_t ticks); void SaveTiming(const char* name, int64_t ticks, unsigned size);
static HStatistics* Instance() { static HStatistics* Instance() {
static SetOncePointer<HStatistics> instance; static SetOncePointer<HStatistics> instance;
if (!instance.is_set()) { if (!instance.is_set()) {
...@@ -917,11 +917,19 @@ class HStatistics: public Malloced { ...@@ -917,11 +917,19 @@ class HStatistics: public Malloced {
private: 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<int64_t> timing_;
List<const char*> names_; List<const char*> names_;
List<unsigned> sizes_;
int64_t total_; int64_t total_;
unsigned total_size_;
int64_t full_code_gen_; int64_t full_code_gen_;
}; };
...@@ -958,6 +966,7 @@ class HPhase BASE_EMBEDDED { ...@@ -958,6 +966,7 @@ class HPhase BASE_EMBEDDED {
HGraph* graph_; HGraph* graph_;
LChunk* chunk_; LChunk* chunk_;
LAllocator* allocator_; LAllocator* allocator_;
unsigned start_allocation_size_;
}; };
......
// 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 // Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are // modification, are permitted provided that the following conditions are
// met: // met:
...@@ -47,6 +47,7 @@ inline void* Zone::New(int size) { ...@@ -47,6 +47,7 @@ inline void* Zone::New(int size) {
// Check that the result has the proper alignment and return it. // Check that the result has the proper alignment and return it.
ASSERT(IsAddressAligned(result, kAlignment, 0)); ASSERT(IsAddressAligned(result, kAlignment, 0));
allocation_size_ += size;
return reinterpret_cast<void*>(result); return reinterpret_cast<void*>(result);
} }
......
// 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 // Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are // modification, are permitted provided that the following conditions are
// met: // met:
...@@ -38,6 +38,7 @@ Address Zone::position_ = 0; ...@@ -38,6 +38,7 @@ Address Zone::position_ = 0;
Address Zone::limit_ = 0; Address Zone::limit_ = 0;
int Zone::zone_excess_limit_ = 256 * MB; int Zone::zone_excess_limit_ = 256 * MB;
int Zone::segment_bytes_allocated_ = 0; int Zone::segment_bytes_allocated_ = 0;
unsigned Zone::allocation_size_ = 0;
bool AssertNoZoneAllocation::allow_allocation_ = true; bool AssertNoZoneAllocation::allow_allocation_ = true;
......
// 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 // Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are // modification, are permitted provided that the following conditions are
// met: // met:
...@@ -71,6 +71,8 @@ class Zone { ...@@ -71,6 +71,8 @@ class Zone {
static inline void adjust_segment_bytes_allocated(int delta); static inline void adjust_segment_bytes_allocated(int delta);
static unsigned allocation_size_;
private: private:
// All pointers returned from New() have this alignment. // All pointers returned from New() have this alignment.
......
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