Revision: 6249
Author: [email protected]
Date: Mon Jan 10 06:16:47 2011
Log: Change the hydrogen timing data to include zone allocation.

Review URL: http://codereview.chromium.org/6190002
http://code.google.com/p/v8/source/detail?r=6249

Modified:
 /branches/bleeding_edge/src/hydrogen.cc
 /branches/bleeding_edge/src/hydrogen.h
 /branches/bleeding_edge/src/zone-inl.h
 /branches/bleeding_edge/src/zone.cc
 /branches/bleeding_edge/src/zone.h

=======================================
--- /branches/bleeding_edge/src/hydrogen.cc     Fri Jan  7 02:36:27 2011
+++ /branches/bleeding_edge/src/hydrogen.cc     Mon Jan 10 06:16:47 2011
@@ -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 @@
     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("%30s - %0.3f ms \n", "Sum", static_cast<double>(sum) / 1000);
+    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 - %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 @@
     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) {
=======================================
--- /branches/bleeding_edge/src/hydrogen.h      Mon Jan  3 08:57:46 2011
+++ /branches/bleeding_edge/src/hydrogen.h      Mon Jan 10 06:16:47 2011
@@ -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 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 @@

  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 @@
   HGraph* graph_;
   LChunk* chunk_;
   LAllocator* allocator_;
+  unsigned start_allocation_size_;
 };


=======================================
--- /branches/bleeding_edge/src/zone-inl.h      Tue Dec  7 03:01:02 2010
+++ /branches/bleeding_edge/src/zone-inl.h      Mon Jan 10 06:16:47 2011
@@ -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 @@

   // Check that the result has the proper alignment and return it.
   ASSERT(IsAddressAligned(result, kAlignment, 0));
+  allocation_size_ += size;
   return reinterpret_cast<void*>(result);
 }

=======================================
--- /branches/bleeding_edge/src/zone.cc Tue Dec  7 03:01:02 2010
+++ /branches/bleeding_edge/src/zone.cc Mon Jan 10 06:16:47 2011
@@ -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::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;

=======================================
--- /branches/bleeding_edge/src/zone.h  Tue Dec  7 03:31:57 2010
+++ /branches/bleeding_edge/src/zone.h  Mon Jan 10 06:16:47 2011
@@ -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 @@

   static inline void adjust_segment_bytes_allocated(int delta);

+  static unsigned allocation_size_;
+
  private:

   // All pointers returned from New() have this alignment.

--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev

Reply via email to