summaryrefslogtreecommitdiffstats
path: root/runtime
diff options
context:
space:
mode:
Diffstat (limited to 'runtime')
-rw-r--r--runtime/native/dalvik_system_VMDebug.cc6
-rw-r--r--runtime/trace.cc12
-rw-r--r--runtime/trace.h8
3 files changed, 19 insertions, 7 deletions
diff --git a/runtime/native/dalvik_system_VMDebug.cc b/runtime/native/dalvik_system_VMDebug.cc
index ae45701a53..96c3e78a43 100644
--- a/runtime/native/dalvik_system_VMDebug.cc
+++ b/runtime/native/dalvik_system_VMDebug.cc
@@ -96,8 +96,8 @@ static void VMDebug_startMethodTracingFilename(JNIEnv* env, jclass, jstring java
Trace::Start(traceFilename.c_str(), -1, bufferSize, flags, false, false, 0);
}
-static jboolean VMDebug_isMethodTracingActive(JNIEnv*, jclass) {
- return Trace::IsMethodTracingActive();
+static jint VMDebug_getMethodTracingMode(JNIEnv*, jclass) {
+ return Trace::GetMethodTracingMode();
}
static void VMDebug_stopMethodTracing(JNIEnv*, jclass) {
@@ -317,7 +317,7 @@ static JNINativeMethod gMethods[] = {
NATIVE_METHOD(VMDebug, infopoint, "(I)V"),
NATIVE_METHOD(VMDebug, isDebuggerConnected, "()Z"),
NATIVE_METHOD(VMDebug, isDebuggingEnabled, "()Z"),
- NATIVE_METHOD(VMDebug, isMethodTracingActive, "()Z"),
+ NATIVE_METHOD(VMDebug, getMethodTracingMode, "()I"),
NATIVE_METHOD(VMDebug, lastDebuggerActivity, "()J"),
NATIVE_METHOD(VMDebug, printLoadedClasses, "(I)V"),
NATIVE_METHOD(VMDebug, resetAllocCount, "(I)V"),
diff --git a/runtime/trace.cc b/runtime/trace.cc
index 6d040e15dc..7b25306177 100644
--- a/runtime/trace.cc
+++ b/runtime/trace.cc
@@ -427,14 +427,20 @@ void Trace::Stop() {
}
void Trace::Shutdown() {
- if (IsMethodTracingActive()) {
+ if (GetMethodTracingMode() != kTracingInactive) {
Stop();
}
}
-bool Trace::IsMethodTracingActive() {
+TracingMode Trace::GetMethodTracingMode() {
MutexLock mu(Thread::Current(), *Locks::trace_lock_);
- return the_trace_ != NULL;
+ if (the_trace_ == NULL) {
+ return kTracingInactive;
+ } else if (the_trace_->sampling_enabled_) {
+ return kSampleProfilingActive;
+ } else {
+ return kMethodTracingActive;
+ }
}
Trace::Trace(File* trace_file, int buffer_size, int flags, bool sampling_enabled)
diff --git a/runtime/trace.h b/runtime/trace.h
index 06cb6a6d5b..ffcb36d294 100644
--- a/runtime/trace.h
+++ b/runtime/trace.h
@@ -42,6 +42,12 @@ enum ProfilerClockSource {
kProfilerClockSourceDual, // Both wall and thread CPU clocks.
};
+enum TracingMode {
+ kTracingInactive,
+ kMethodTracingActive,
+ kSampleProfilingActive,
+};
+
class Trace : public instrumentation::InstrumentationListener {
public:
enum TraceFlag {
@@ -58,7 +64,7 @@ class Trace : public instrumentation::InstrumentationListener {
Locks::trace_lock_);
static void Stop() LOCKS_EXCLUDED(Locks::trace_lock_);
static void Shutdown() LOCKS_EXCLUDED(Locks::trace_lock_);
- static bool IsMethodTracingActive() LOCKS_EXCLUDED(Locks::trace_lock_);
+ static TracingMode GetMethodTracingMode() LOCKS_EXCLUDED(Locks::trace_lock_);
bool UseWallClock();
bool UseThreadCpuClock();