Changed tracer to use an instance to hold state instead of statics.
Change-Id: I2fdcf5de7fbc745273b1a33cb409d13e72d24ab4
diff --git a/src/runtime.cc b/src/runtime.cc
index a00ebcd..4d95b4b 100644
--- a/src/runtime.cc
+++ b/src/runtime.cc
@@ -47,7 +47,8 @@
vfprintf_(NULL),
exit_(NULL),
abort_(NULL),
- stats_enabled_(false) {
+ stats_enabled_(false),
+ tracer_(NULL) {
for (int i = 0; i < Runtime::kLastTrampolineMethodType; i++) {
resolution_stub_array_[i] = NULL;
}
@@ -870,4 +871,24 @@
callee_save_method_[type] = method;
}
+void Runtime::EnableMethodTracing(Trace* tracer) {
+ CHECK(!IsMethodTracingActive());
+ tracer_ = tracer;
+}
+
+void Runtime::DisableMethodTracing() {
+ CHECK(IsMethodTracingActive());
+ delete tracer_;
+ tracer_ = NULL;
+}
+
+bool Runtime::IsMethodTracingActive() const {
+ return (tracer_ != NULL);
+}
+
+Trace* Runtime::GetTracer() const {
+ CHECK(IsMethodTracingActive());
+ return tracer_;
+}
+
} // namespace art