Adding systrace logging to GC
Added systrace logging to GC, thread checkpoints, GC pause,
and time spent waiting for concurrent GC to complete.
Change-Id: I33f0cf260526ccfd07bfaf038dfbf0a712eab24d
diff --git a/src/thread.cc b/src/thread.cc
index 2deb7a5..d6bd8a4 100644
--- a/src/thread.cc
+++ b/src/thread.cc
@@ -14,8 +14,11 @@
* limitations under the License.
*/
+#define ATRACE_TAG ATRACE_TAG_DALVIK
+
#include "thread.h"
+#include <cutils/trace.h>
#include <pthread.h>
#include <signal.h>
#include <sys/resource.h>
@@ -574,6 +577,13 @@
}
}
+void Thread::RunCheckpointFunction() {
+ CHECK(checkpoint_function_ != NULL);
+ ATRACE_BEGIN("Checkpoint function");
+ checkpoint_function_->Run(this);
+ ATRACE_END();
+}
+
bool Thread::RequestCheckpoint(Closure* function) {
CHECK(!ReadFlag(kCheckpointRequest)) << "Already have a pending checkpoint request";
checkpoint_function_ = function;
@@ -589,10 +599,12 @@
void Thread::FullSuspendCheck() {
VLOG(threads) << this << " self-suspending";
+ ATRACE_BEGIN("Full suspend check");
// Make thread appear suspended to other threads, release mutator_lock_.
TransitionFromRunnableToSuspended(kSuspended);
// Transition back to runnable noting requests to suspend, re-acquire share on mutator_lock_.
TransitionFromSuspendedToRunnable();
+ ATRACE_END();
VLOG(threads) << this << " self-reviving";
}