More Gc statistics and logging
Added a few metrics to Gc performance measurements:
Mean GC throughput, total time spent in Gc, total time spent in allocation code, mean time per allocation.
Slightly optimized object allocation.
Change-Id: Ie68153a7100affafc4a01dab34b341077e754867
diff --git a/src/gc/space.h b/src/gc/space.h
index a543500..ab29582 100644
--- a/src/gc/space.h
+++ b/src/gc/space.h
@@ -314,6 +314,14 @@
return num_objects_allocated_;
}
+ size_t GetTotalBytesAllocated() const {
+ return total_bytes_allocated_;
+ }
+
+ size_t GetTotalObjectsAllocated() const {
+ return total_objects_allocated_;
+ }
+
private:
Object* AllocWithoutGrowthLocked(size_t num_bytes) EXCLUSIVE_LOCKS_REQUIRED(lock_);
@@ -324,6 +332,8 @@
// Approximate number of bytes which have been allocated into the space.
size_t num_bytes_allocated_;
size_t num_objects_allocated_;
+ size_t total_bytes_allocated_;
+ size_t total_objects_allocated_;
static size_t bitmap_index_;
@@ -453,6 +463,14 @@
return num_objects_allocated_;
}
+ size_t GetTotalBytesAllocated() const {
+ return total_bytes_allocated_;
+ }
+
+ size_t GetTotalObjectsAllocated() const {
+ return total_objects_allocated_;
+ }
+
protected:
LargeObjectSpace(const std::string& name);
@@ -460,6 +478,8 @@
// Approximate number of bytes which have been allocated into the space.
size_t num_bytes_allocated_;
size_t num_objects_allocated_;
+ size_t total_bytes_allocated_;
+ size_t total_objects_allocated_;
UniquePtr<SpaceSetMap> live_objects_;
UniquePtr<SpaceSetMap> mark_objects_;