Merge "Delete AllocationTimer"
diff --git a/runtime/gc/heap-inl.h b/runtime/gc/heap-inl.h
index b814432..efa065b 100644
--- a/runtime/gc/heap-inl.h
+++ b/runtime/gc/heap-inl.h
@@ -67,7 +67,6 @@
     // non moving space). This can happen if there is significant virtual address space
     // fragmentation.
   }
-  AllocationTimer alloc_timer(this, &obj);
   // bytes allocated for the (individual) object.
   size_t bytes_allocated;
   size_t usable_size;
@@ -386,22 +385,6 @@
   return ret;
 }
 
-inline Heap::AllocationTimer::AllocationTimer(Heap* heap, mirror::Object** allocated_obj_ptr)
-    : heap_(heap), allocated_obj_ptr_(allocated_obj_ptr),
-      allocation_start_time_(kMeasureAllocationTime ? NanoTime() / kTimeAdjust : 0u) { }
-
-inline Heap::AllocationTimer::~AllocationTimer() {
-  if (kMeasureAllocationTime) {
-    mirror::Object* allocated_obj = *allocated_obj_ptr_;
-    // Only if the allocation succeeded, record the time.
-    if (allocated_obj != nullptr) {
-      uint64_t allocation_end_time = NanoTime() / kTimeAdjust;
-      heap_->total_allocation_time_.FetchAndAddSequentiallyConsistent(
-          allocation_end_time - allocation_start_time_);
-    }
-  }
-}
-
 inline bool Heap::ShouldAllocLargeObject(mirror::Class* c, size_t byte_count) const {
   // We need to have a zygote space or else our newly allocated large object can end up in the
   // Zygote resulting in it being prematurely freed.
diff --git a/runtime/gc/heap.cc b/runtime/gc/heap.cc
index 141fed2..6baa9b2 100644
--- a/runtime/gc/heap.cc
+++ b/runtime/gc/heap.cc
@@ -205,7 +205,6 @@
       target_utilization_(target_utilization),
       foreground_heap_growth_multiplier_(foreground_heap_growth_multiplier),
       total_wait_time_(0),
-      total_allocation_time_(0),
       verify_object_mode_(kVerifyObjectModeDisabled),
       disable_moving_gc_count_(0),
       is_running_on_memory_tool_(Runtime::Current()->IsRunningOnMemoryTool()),
@@ -981,8 +980,6 @@
     total_paused_time += collector->GetTotalPausedTimeNs();
     collector->DumpPerformanceInfo(os);
   }
-  uint64_t allocation_time =
-      static_cast<uint64_t>(total_allocation_time_.LoadRelaxed()) * kTimeAdjust;
   if (total_duration != 0) {
     const double total_seconds = static_cast<double>(total_duration / 1000) / 1000000.0;
     os << "Total time spent in GC: " << PrettyDuration(total_duration) << "\n";
@@ -1000,11 +997,6 @@
   os << "Free memory until OOME " << PrettySize(GetFreeMemoryUntilOOME()) << "\n";
   os << "Total memory " << PrettySize(GetTotalMemory()) << "\n";
   os << "Max memory " << PrettySize(GetMaxMemory()) << "\n";
-  if (kMeasureAllocationTime) {
-    os << "Total time spent allocating: " << PrettyDuration(allocation_time) << "\n";
-    os << "Mean allocation time: " << PrettyDuration(allocation_time / total_objects_allocated)
-       << "\n";
-  }
   if (HasZygoteSpace()) {
     os << "Zygote space size " << PrettySize(zygote_space_->Size()) << "\n";
   }
@@ -1037,7 +1029,6 @@
   for (auto& collector : garbage_collectors_) {
     collector->ResetMeasurements();
   }
-  total_allocation_time_.StoreRelaxed(0);
   total_bytes_freed_ever_ = 0;
   total_objects_freed_ever_ = 0;
   total_wait_time_ = 0;
diff --git a/runtime/gc/heap.h b/runtime/gc/heap.h
index 6676049..4703685 100644
--- a/runtime/gc/heap.h
+++ b/runtime/gc/heap.h
@@ -126,7 +126,6 @@
 class Heap {
  public:
   // If true, measure the total allocation time.
-  static constexpr bool kMeasureAllocationTime = false;
   static constexpr size_t kDefaultStartingSize = kPageSize;
   static constexpr size_t kDefaultInitialSize = 2 * MB;
   static constexpr size_t kDefaultMaximumSize = 256 * MB;
@@ -1213,9 +1212,6 @@
   // Total time which mutators are paused or waiting for GC to complete.
   uint64_t total_wait_time_;
 
-  // Total number of objects allocated in microseconds.
-  AtomicInteger total_allocation_time_;
-
   // The current state of heap verification, may be enabled or disabled.
   VerifyObjectMode verify_object_mode_;
 
@@ -1309,18 +1305,6 @@
   friend class VerifyObjectVisitor;
   friend class space::SpaceTest;
 
-  class AllocationTimer {
-   public:
-    ALWAYS_INLINE AllocationTimer(Heap* heap, mirror::Object** allocated_obj_ptr);
-    ALWAYS_INLINE ~AllocationTimer();
-   private:
-    Heap* const heap_;
-    mirror::Object** allocated_obj_ptr_;
-    const uint64_t allocation_start_time_;
-
-    DISALLOW_IMPLICIT_CONSTRUCTORS(AllocationTimer);
-  };
-
   DISALLOW_IMPLICIT_CONSTRUCTORS(Heap);
 };