diff options
author | Dave Allison <dallison@google.com> | 2014-01-30 17:44:12 -0800 |
---|---|---|
committer | Dave Allison <dallison@google.com> | 2014-01-30 17:54:22 -0800 |
commit | 4a7867b672631cd9f1725b275c4c87358fc31c39 (patch) | |
tree | e136589713b44940f3f4d327cf2e2becda7fa6f3 /runtime/profiler.cc | |
parent | f52bb809f0a6d4fb1c70b7f3b2f6e45c1d80ab9d (diff) | |
download | art-4a7867b672631cd9f1725b275c4c87358fc31c39.zip art-4a7867b672631cd9f1725b275c4c87358fc31c39.tar.gz art-4a7867b672631cd9f1725b275c4c87358fc31c39.tar.bz2 |
Add property to disable sampling profiler.
This is to enable power measurements to be performed without
the profiler running. The default is off (no profiler).
To enable the profiler:
adb shell setprop dalvik.vm.profiler 1
Change-Id: I983f2ffcf6c2c7bb8e29f0610fe259f3d56a4b1d
Diffstat (limited to 'runtime/profiler.cc')
-rw-r--r-- | runtime/profiler.cc | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/runtime/profiler.cc b/runtime/profiler.cc index 0e73812..365c9c3 100644 --- a/runtime/profiler.cc +++ b/runtime/profiler.cc @@ -36,6 +36,11 @@ #include "ScopedLocalRef.h" #include "thread.h" #include "thread_list.h" + +#ifdef HAVE_ANDROID_OS +#include "cutils/properties.h" +#endif + #if !defined(ART_USE_PORTABLE_COMPILER) #include "entrypoints/quick/quick_entrypoints.h" #endif @@ -259,6 +264,17 @@ void BackgroundMethodSamplingProfiler::Start(int period, int duration, } } + // Only on target... +#ifdef HAVE_ANDROID_OS + // Switch off profiler if the dalvik.vm.profiler property has value 0. + char buf[PROP_VALUE_MAX]; + property_get("dalvik.vm.profiler", buf, "0"); + if (strcmp(buf, "0") == 0) { + LOG(INFO) << "Profiler disabled. To enable setprop dalvik.vm.profiler 1"; + return; + } +#endif + LOG(INFO) << "Starting profile with period " << period << "s, duration " << duration << "s, interval " << interval_us << "us. Profile file " << profile_file_name; |