Refactor GC to have a class for each different type of GC.
Added a seperate files for mark sweep, partial mark sweep,
sticky mark sweep.
Added a common superclass for GC.
Added additional statistics for each GC.
Moved main garbage collection code away from Heap.cc.
Change-Id: Ida0021ab2f740fc8228bbbf4d43cd9bc56b4ba46
diff --git a/src/timing_logger.h b/src/timing_logger.h
index 7dc2671..7b20563 100644
--- a/src/timing_logger.h
+++ b/src/timing_logger.h
@@ -31,11 +31,17 @@
class TimingLogger {
public:
- explicit TimingLogger(const char* name, bool precise = false)
+ explicit TimingLogger(const std::string& name, bool precise = false)
: name_(name), precise_(precise) {
AddSplit("");
}
+ void Reset() {
+ times_.clear();
+ labels_.clear();
+ AddSplit("");
+ }
+
void AddSplit(const std::string& label) {
times_.push_back(NanoTime());
labels_.push_back(label);
@@ -82,12 +88,16 @@
class CumulativeLogger {
public:
- explicit CumulativeLogger(const char* name = "", bool precise = false)
+ explicit CumulativeLogger(const std::string& name = "", bool precise = false)
: name_(name),
precise_(precise) {
Reset();
}
+ void SetName(const std::string& name) {
+ name_ = name;
+ }
+
void Start() {
index_ = 0;
last_split_ = NanoTime();