Elliott Hughes | 9d5ccec | 2011-09-19 13:19:50 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2008 The Android Open Source Project |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
Andreas Gampe | 277ccbd | 2014-11-03 21:36:10 -0800 | [diff] [blame] | 17 | #include "dalvik_system_VMDebug.h" |
| 18 | |
Elliott Hughes | 9d5ccec | 2011-09-19 13:19:50 -0700 | [diff] [blame] | 19 | #include <string.h> |
| 20 | #include <unistd.h> |
| 21 | |
Hiroshi Yamauchi | a1c9f01 | 2015-04-02 10:18:12 -0700 | [diff] [blame] | 22 | #include <sstream> |
| 23 | |
| 24 | #include "base/histogram-inl.h" |
Vladimir Marko | 80afd02 | 2015-05-19 18:08:00 +0100 | [diff] [blame] | 25 | #include "base/time_utils.h" |
Elliott Hughes | eac7667 | 2012-05-24 21:56:51 -0700 | [diff] [blame] | 26 | #include "class_linker.h" |
Ian Rogers | 62d6c77 | 2013-02-27 08:32:07 -0800 | [diff] [blame] | 27 | #include "common_throws.h" |
Elliott Hughes | eac7667 | 2012-05-24 21:56:51 -0700 | [diff] [blame] | 28 | #include "debugger.h" |
Mathieu Chartier | 7410f29 | 2013-11-24 13:17:35 -0800 | [diff] [blame] | 29 | #include "gc/space/bump_pointer_space.h" |
Hiroshi Yamauchi | 09b07a9 | 2013-07-15 13:17:06 -0700 | [diff] [blame] | 30 | #include "gc/space/dlmalloc_space.h" |
| 31 | #include "gc/space/large_object_space.h" |
| 32 | #include "gc/space/space-inl.h" |
Mathieu Chartier | 1f3b535 | 2014-02-03 14:00:42 -0800 | [diff] [blame] | 33 | #include "gc/space/zygote_space.h" |
Elliott Hughes | eac7667 | 2012-05-24 21:56:51 -0700 | [diff] [blame] | 34 | #include "hprof/hprof.h" |
| 35 | #include "jni_internal.h" |
Ian Rogers | 2dd0e2c | 2013-01-24 12:42:14 -0800 | [diff] [blame] | 36 | #include "mirror/class.h" |
Ian Rogers | dd157d7 | 2014-05-15 14:47:50 -0700 | [diff] [blame] | 37 | #include "ScopedLocalRef.h" |
Elliott Hughes | eac7667 | 2012-05-24 21:56:51 -0700 | [diff] [blame] | 38 | #include "ScopedUtfChars.h" |
Mathieu Chartier | 0795f23 | 2016-09-27 18:43:30 -0700 | [diff] [blame] | 39 | #include "scoped_fast_native_object_access-inl.h" |
Elliott Hughes | eac7667 | 2012-05-24 21:56:51 -0700 | [diff] [blame] | 40 | #include "trace.h" |
Ian Rogers | dd157d7 | 2014-05-15 14:47:50 -0700 | [diff] [blame] | 41 | #include "well_known_classes.h" |
Elliott Hughes | eac7667 | 2012-05-24 21:56:51 -0700 | [diff] [blame] | 42 | |
Elliott Hughes | 9d5ccec | 2011-09-19 13:19:50 -0700 | [diff] [blame] | 43 | namespace art { |
| 44 | |
Elliott Hughes | 0512f02 | 2012-03-15 22:10:52 -0700 | [diff] [blame] | 45 | static jobjectArray VMDebug_getVmFeatureList(JNIEnv* env, jclass) { |
Ian Rogers | dd157d7 | 2014-05-15 14:47:50 -0700 | [diff] [blame] | 46 | static const char* features[] = { |
| 47 | "method-trace-profiling", |
| 48 | "method-trace-profiling-streaming", |
| 49 | "method-sample-profiling", |
| 50 | "hprof-heap-dump", |
| 51 | "hprof-heap-dump-streaming", |
| 52 | }; |
| 53 | jobjectArray result = env->NewObjectArray(arraysize(features), |
| 54 | WellKnownClasses::java_lang_String, |
| 55 | nullptr); |
| 56 | if (result != nullptr) { |
| 57 | for (size_t i = 0; i < arraysize(features); ++i) { |
| 58 | ScopedLocalRef<jstring> jfeature(env, env->NewStringUTF(features[i])); |
| 59 | if (jfeature.get() == nullptr) { |
| 60 | return nullptr; |
| 61 | } |
| 62 | env->SetObjectArrayElement(result, i, jfeature.get()); |
| 63 | } |
| 64 | } |
| 65 | return result; |
Elliott Hughes | 9d5ccec | 2011-09-19 13:19:50 -0700 | [diff] [blame] | 66 | } |
| 67 | |
Elliott Hughes | 0512f02 | 2012-03-15 22:10:52 -0700 | [diff] [blame] | 68 | static void VMDebug_startAllocCounting(JNIEnv*, jclass) { |
Mathieu Chartier | 9ef78b5 | 2014-09-25 17:03:12 -0700 | [diff] [blame] | 69 | Runtime::Current()->SetStatsEnabled(true); |
Elliott Hughes | 9d5ccec | 2011-09-19 13:19:50 -0700 | [diff] [blame] | 70 | } |
| 71 | |
Elliott Hughes | 0512f02 | 2012-03-15 22:10:52 -0700 | [diff] [blame] | 72 | static void VMDebug_stopAllocCounting(JNIEnv*, jclass) { |
Mathieu Chartier | 9ef78b5 | 2014-09-25 17:03:12 -0700 | [diff] [blame] | 73 | Runtime::Current()->SetStatsEnabled(false); |
Elliott Hughes | 9d5ccec | 2011-09-19 13:19:50 -0700 | [diff] [blame] | 74 | } |
| 75 | |
Elliott Hughes | 1bac54f | 2012-03-16 12:48:31 -0700 | [diff] [blame] | 76 | static jint VMDebug_getAllocCount(JNIEnv*, jclass, jint kind) { |
Elliott Hughes | 9d5ccec | 2011-09-19 13:19:50 -0700 | [diff] [blame] | 77 | return Runtime::Current()->GetStat(kind); |
| 78 | } |
| 79 | |
Elliott Hughes | 0512f02 | 2012-03-15 22:10:52 -0700 | [diff] [blame] | 80 | static void VMDebug_resetAllocCount(JNIEnv*, jclass, jint kinds) { |
Elliott Hughes | 9d5ccec | 2011-09-19 13:19:50 -0700 | [diff] [blame] | 81 | Runtime::Current()->ResetStats(kinds); |
| 82 | } |
| 83 | |
Jeff Hao | 23009dc | 2013-08-22 15:36:42 -0700 | [diff] [blame] | 84 | static void VMDebug_startMethodTracingDdmsImpl(JNIEnv*, jclass, jint bufferSize, jint flags, |
| 85 | jboolean samplingEnabled, jint intervalUs) { |
Andreas Gampe | 7e7e0f4 | 2015-03-29 15:26:23 -0700 | [diff] [blame] | 86 | Trace::Start("[DDMS]", -1, bufferSize, flags, Trace::TraceOutputMode::kDDMS, |
| 87 | samplingEnabled ? Trace::TraceMode::kSampling : Trace::TraceMode::kMethodTracing, |
| 88 | intervalUs); |
Elliott Hughes | 9d5ccec | 2011-09-19 13:19:50 -0700 | [diff] [blame] | 89 | } |
| 90 | |
Ian Rogers | 00f7d0e | 2012-07-19 15:28:27 -0700 | [diff] [blame] | 91 | static void VMDebug_startMethodTracingFd(JNIEnv* env, jclass, jstring javaTraceFilename, |
Jeff Hao | 4044bda | 2014-01-06 15:50:45 -0800 | [diff] [blame] | 92 | jobject javaFd, jint bufferSize, jint flags, |
Shukang Zhou | ca6e14e | 2017-01-25 00:35:21 -0800 | [diff] [blame] | 93 | jboolean samplingEnabled, jint intervalUs, |
| 94 | jboolean streamingOutput) { |
Elliott Hughes | 9d5ccec | 2011-09-19 13:19:50 -0700 | [diff] [blame] | 95 | int originalFd = jniGetFDFromFileDescriptor(env, javaFd); |
| 96 | if (originalFd < 0) { |
| 97 | return; |
| 98 | } |
| 99 | |
| 100 | int fd = dup(originalFd); |
| 101 | if (fd < 0) { |
Ian Rogers | 00f7d0e | 2012-07-19 15:28:27 -0700 | [diff] [blame] | 102 | ScopedObjectAccess soa(env); |
Nicolas Geoffray | 0aa50ce | 2015-03-10 11:03:29 +0000 | [diff] [blame] | 103 | soa.Self()->ThrowNewExceptionF("Ljava/lang/RuntimeException;", |
Ian Rogers | 62d6c77 | 2013-02-27 08:32:07 -0800 | [diff] [blame] | 104 | "dup(%d) failed: %s", originalFd, strerror(errno)); |
Elliott Hughes | 9d5ccec | 2011-09-19 13:19:50 -0700 | [diff] [blame] | 105 | return; |
| 106 | } |
| 107 | |
| 108 | ScopedUtfChars traceFilename(env, javaTraceFilename); |
Mathieu Chartier | 2cebb24 | 2015-04-21 16:50:40 -0700 | [diff] [blame] | 109 | if (traceFilename.c_str() == nullptr) { |
Elliott Hughes | 9d5ccec | 2011-09-19 13:19:50 -0700 | [diff] [blame] | 110 | return; |
| 111 | } |
Shukang Zhou | ca6e14e | 2017-01-25 00:35:21 -0800 | [diff] [blame] | 112 | Trace::TraceOutputMode outputMode = streamingOutput |
| 113 | ? Trace::TraceOutputMode::kStreaming |
| 114 | : Trace::TraceOutputMode::kFile; |
| 115 | Trace::Start(traceFilename.c_str(), fd, bufferSize, flags, outputMode, |
Andreas Gampe | 7e7e0f4 | 2015-03-29 15:26:23 -0700 | [diff] [blame] | 116 | samplingEnabled ? Trace::TraceMode::kSampling : Trace::TraceMode::kMethodTracing, |
| 117 | intervalUs); |
Elliott Hughes | 9d5ccec | 2011-09-19 13:19:50 -0700 | [diff] [blame] | 118 | } |
| 119 | |
Ian Rogers | 00f7d0e | 2012-07-19 15:28:27 -0700 | [diff] [blame] | 120 | static void VMDebug_startMethodTracingFilename(JNIEnv* env, jclass, jstring javaTraceFilename, |
Jeff Hao | 4044bda | 2014-01-06 15:50:45 -0800 | [diff] [blame] | 121 | jint bufferSize, jint flags, |
| 122 | jboolean samplingEnabled, jint intervalUs) { |
Elliott Hughes | 9d5ccec | 2011-09-19 13:19:50 -0700 | [diff] [blame] | 123 | ScopedUtfChars traceFilename(env, javaTraceFilename); |
Mathieu Chartier | 2cebb24 | 2015-04-21 16:50:40 -0700 | [diff] [blame] | 124 | if (traceFilename.c_str() == nullptr) { |
Elliott Hughes | 9d5ccec | 2011-09-19 13:19:50 -0700 | [diff] [blame] | 125 | return; |
| 126 | } |
Andreas Gampe | 7e7e0f4 | 2015-03-29 15:26:23 -0700 | [diff] [blame] | 127 | Trace::Start(traceFilename.c_str(), -1, bufferSize, flags, Trace::TraceOutputMode::kFile, |
| 128 | samplingEnabled ? Trace::TraceMode::kSampling : Trace::TraceMode::kMethodTracing, |
| 129 | intervalUs); |
Elliott Hughes | 9d5ccec | 2011-09-19 13:19:50 -0700 | [diff] [blame] | 130 | } |
| 131 | |
Jeff Hao | 64caa7d | 2013-08-29 11:18:01 -0700 | [diff] [blame] | 132 | static jint VMDebug_getMethodTracingMode(JNIEnv*, jclass) { |
| 133 | return Trace::GetMethodTracingMode(); |
Elliott Hughes | 9d5ccec | 2011-09-19 13:19:50 -0700 | [diff] [blame] | 134 | } |
| 135 | |
Elliott Hughes | 0512f02 | 2012-03-15 22:10:52 -0700 | [diff] [blame] | 136 | static void VMDebug_stopMethodTracing(JNIEnv*, jclass) { |
jeffhao | e343b76 | 2011-12-05 16:36:44 -0800 | [diff] [blame] | 137 | Trace::Stop(); |
Elliott Hughes | 9d5ccec | 2011-09-19 13:19:50 -0700 | [diff] [blame] | 138 | } |
| 139 | |
Elliott Hughes | 0512f02 | 2012-03-15 22:10:52 -0700 | [diff] [blame] | 140 | static void VMDebug_startEmulatorTracing(JNIEnv*, jclass) { |
Elliott Hughes | 9d5ccec | 2011-09-19 13:19:50 -0700 | [diff] [blame] | 141 | UNIMPLEMENTED(WARNING); |
Brian Carlstrom | 7934ac2 | 2013-07-26 10:54:15 -0700 | [diff] [blame] | 142 | // dvmEmulatorTraceStart(); |
Elliott Hughes | 9d5ccec | 2011-09-19 13:19:50 -0700 | [diff] [blame] | 143 | } |
| 144 | |
Elliott Hughes | 0512f02 | 2012-03-15 22:10:52 -0700 | [diff] [blame] | 145 | static void VMDebug_stopEmulatorTracing(JNIEnv*, jclass) { |
Elliott Hughes | 9d5ccec | 2011-09-19 13:19:50 -0700 | [diff] [blame] | 146 | UNIMPLEMENTED(WARNING); |
Brian Carlstrom | 7934ac2 | 2013-07-26 10:54:15 -0700 | [diff] [blame] | 147 | // dvmEmulatorTraceStop(); |
Elliott Hughes | 9d5ccec | 2011-09-19 13:19:50 -0700 | [diff] [blame] | 148 | } |
| 149 | |
Elliott Hughes | 0512f02 | 2012-03-15 22:10:52 -0700 | [diff] [blame] | 150 | static jboolean VMDebug_isDebuggerConnected(JNIEnv*, jclass) { |
Elliott Hughes | c0f0933 | 2012-03-26 13:27:06 -0700 | [diff] [blame] | 151 | return Dbg::IsDebuggerActive(); |
Elliott Hughes | 9d5ccec | 2011-09-19 13:19:50 -0700 | [diff] [blame] | 152 | } |
| 153 | |
Elliott Hughes | 0512f02 | 2012-03-15 22:10:52 -0700 | [diff] [blame] | 154 | static jboolean VMDebug_isDebuggingEnabled(JNIEnv*, jclass) { |
Elliott Hughes | c0f0933 | 2012-03-26 13:27:06 -0700 | [diff] [blame] | 155 | return Dbg::IsJdwpConfigured(); |
Elliott Hughes | 9d5ccec | 2011-09-19 13:19:50 -0700 | [diff] [blame] | 156 | } |
| 157 | |
Elliott Hughes | 0512f02 | 2012-03-15 22:10:52 -0700 | [diff] [blame] | 158 | static jlong VMDebug_lastDebuggerActivity(JNIEnv*, jclass) { |
Elliott Hughes | 872d4ec | 2011-10-21 17:07:15 -0700 | [diff] [blame] | 159 | return Dbg::LastDebuggerActivity(); |
Elliott Hughes | 9d5ccec | 2011-09-19 13:19:50 -0700 | [diff] [blame] | 160 | } |
| 161 | |
Ian Rogers | 62d6c77 | 2013-02-27 08:32:07 -0800 | [diff] [blame] | 162 | static void ThrowUnsupportedOperationException(JNIEnv* env) { |
Ian Rogers | 00f7d0e | 2012-07-19 15:28:27 -0700 | [diff] [blame] | 163 | ScopedObjectAccess soa(env); |
Mathieu Chartier | 2cebb24 | 2015-04-21 16:50:40 -0700 | [diff] [blame] | 164 | soa.Self()->ThrowNewException("Ljava/lang/UnsupportedOperationException;", nullptr); |
Ian Rogers | 62d6c77 | 2013-02-27 08:32:07 -0800 | [diff] [blame] | 165 | } |
| 166 | |
| 167 | static void VMDebug_startInstructionCounting(JNIEnv* env, jclass) { |
| 168 | ThrowUnsupportedOperationException(env); |
Elliott Hughes | 9d5ccec | 2011-09-19 13:19:50 -0700 | [diff] [blame] | 169 | } |
| 170 | |
Ian Rogers | 00f7d0e | 2012-07-19 15:28:27 -0700 | [diff] [blame] | 171 | static void VMDebug_stopInstructionCounting(JNIEnv* env, jclass) { |
Ian Rogers | 62d6c77 | 2013-02-27 08:32:07 -0800 | [diff] [blame] | 172 | ThrowUnsupportedOperationException(env); |
Elliott Hughes | 9d5ccec | 2011-09-19 13:19:50 -0700 | [diff] [blame] | 173 | } |
| 174 | |
Ian Rogers | 00f7d0e | 2012-07-19 15:28:27 -0700 | [diff] [blame] | 175 | static void VMDebug_getInstructionCount(JNIEnv* env, jclass, jintArray /*javaCounts*/) { |
Ian Rogers | 62d6c77 | 2013-02-27 08:32:07 -0800 | [diff] [blame] | 176 | ThrowUnsupportedOperationException(env); |
Elliott Hughes | 9d5ccec | 2011-09-19 13:19:50 -0700 | [diff] [blame] | 177 | } |
| 178 | |
Ian Rogers | 00f7d0e | 2012-07-19 15:28:27 -0700 | [diff] [blame] | 179 | static void VMDebug_resetInstructionCount(JNIEnv* env, jclass) { |
Ian Rogers | 62d6c77 | 2013-02-27 08:32:07 -0800 | [diff] [blame] | 180 | ThrowUnsupportedOperationException(env); |
Elliott Hughes | 9d5ccec | 2011-09-19 13:19:50 -0700 | [diff] [blame] | 181 | } |
| 182 | |
Ian Rogers | 00f7d0e | 2012-07-19 15:28:27 -0700 | [diff] [blame] | 183 | static void VMDebug_printLoadedClasses(JNIEnv* env, jclass, jint flags) { |
Andreas Gampe | cc1b535 | 2016-12-01 16:58:38 -0800 | [diff] [blame] | 184 | class DumpClassVisitor : public ClassVisitor { |
| 185 | public: |
| 186 | explicit DumpClassVisitor(int dump_flags) : flags_(dump_flags) {} |
| 187 | |
| 188 | bool operator()(ObjPtr<mirror::Class> klass) OVERRIDE REQUIRES_SHARED(Locks::mutator_lock_) { |
| 189 | klass->DumpClass(LOG_STREAM(ERROR), flags_); |
| 190 | return true; |
| 191 | } |
| 192 | |
| 193 | private: |
| 194 | const int flags_; |
| 195 | }; |
| 196 | DumpClassVisitor visitor(flags); |
| 197 | |
Ian Rogers | 53b8b09 | 2014-03-13 23:45:53 -0700 | [diff] [blame] | 198 | ScopedFastNativeObjectAccess soa(env); |
Andreas Gampe | cc1b535 | 2016-12-01 16:58:38 -0800 | [diff] [blame] | 199 | return Runtime::Current()->GetClassLinker()->VisitClasses(&visitor); |
Elliott Hughes | 9d5ccec | 2011-09-19 13:19:50 -0700 | [diff] [blame] | 200 | } |
| 201 | |
Ian Rogers | 7dfb28c | 2013-08-22 08:18:36 -0700 | [diff] [blame] | 202 | static jint VMDebug_getLoadedClassCount(JNIEnv* env, jclass) { |
Ian Rogers | 53b8b09 | 2014-03-13 23:45:53 -0700 | [diff] [blame] | 203 | ScopedFastNativeObjectAccess soa(env); |
Elliott Hughes | 9d5ccec | 2011-09-19 13:19:50 -0700 | [diff] [blame] | 204 | return Runtime::Current()->GetClassLinker()->NumLoadedClasses(); |
| 205 | } |
| 206 | |
| 207 | /* |
| 208 | * Returns the thread-specific CPU-time clock value for the current thread, |
| 209 | * or -1 if the feature isn't supported. |
| 210 | */ |
Elliott Hughes | 0512f02 | 2012-03-15 22:10:52 -0700 | [diff] [blame] | 211 | static jlong VMDebug_threadCpuTimeNanos(JNIEnv*, jclass) { |
| 212 | return ThreadCpuNanoTime(); |
Elliott Hughes | 9d5ccec | 2011-09-19 13:19:50 -0700 | [diff] [blame] | 213 | } |
| 214 | |
| 215 | /* |
| 216 | * static void dumpHprofData(String fileName, FileDescriptor fd) |
| 217 | * |
| 218 | * Cause "hprof" data to be dumped. We can throw an IOException if an |
| 219 | * error occurs during file handling. |
| 220 | */ |
Elliott Hughes | 0512f02 | 2012-03-15 22:10:52 -0700 | [diff] [blame] | 221 | static void VMDebug_dumpHprofData(JNIEnv* env, jclass, jstring javaFilename, jobject javaFd) { |
Mathieu Chartier | 2cebb24 | 2015-04-21 16:50:40 -0700 | [diff] [blame] | 222 | // Only one of these may be null. |
| 223 | if (javaFilename == nullptr && javaFd == nullptr) { |
Ian Rogers | 00f7d0e | 2012-07-19 15:28:27 -0700 | [diff] [blame] | 224 | ScopedObjectAccess soa(env); |
Nicolas Geoffray | 0aa50ce | 2015-03-10 11:03:29 +0000 | [diff] [blame] | 225 | ThrowNullPointerException("fileName == null && fd == null"); |
Elliott Hughes | 9d5ccec | 2011-09-19 13:19:50 -0700 | [diff] [blame] | 226 | return; |
| 227 | } |
| 228 | |
| 229 | std::string filename; |
Mathieu Chartier | 2cebb24 | 2015-04-21 16:50:40 -0700 | [diff] [blame] | 230 | if (javaFilename != nullptr) { |
Elliott Hughes | 9d5ccec | 2011-09-19 13:19:50 -0700 | [diff] [blame] | 231 | ScopedUtfChars chars(env, javaFilename); |
| 232 | if (env->ExceptionCheck()) { |
| 233 | return; |
| 234 | } |
| 235 | filename = chars.c_str(); |
| 236 | } else { |
| 237 | filename = "[fd]"; |
| 238 | } |
| 239 | |
| 240 | int fd = -1; |
Mathieu Chartier | 2cebb24 | 2015-04-21 16:50:40 -0700 | [diff] [blame] | 241 | if (javaFd != nullptr) { |
Elliott Hughes | 9d5ccec | 2011-09-19 13:19:50 -0700 | [diff] [blame] | 242 | fd = jniGetFDFromFileDescriptor(env, javaFd); |
| 243 | if (fd < 0) { |
Ian Rogers | 00f7d0e | 2012-07-19 15:28:27 -0700 | [diff] [blame] | 244 | ScopedObjectAccess soa(env); |
Ian Rogers | 62d6c77 | 2013-02-27 08:32:07 -0800 | [diff] [blame] | 245 | ThrowRuntimeException("Invalid file descriptor"); |
Elliott Hughes | 9d5ccec | 2011-09-19 13:19:50 -0700 | [diff] [blame] | 246 | return; |
| 247 | } |
| 248 | } |
| 249 | |
Elliott Hughes | 622a698 | 2012-06-08 17:58:54 -0700 | [diff] [blame] | 250 | hprof::DumpHeap(filename.c_str(), fd, false); |
Elliott Hughes | 9d5ccec | 2011-09-19 13:19:50 -0700 | [diff] [blame] | 251 | } |
| 252 | |
Elliott Hughes | eac7667 | 2012-05-24 21:56:51 -0700 | [diff] [blame] | 253 | static void VMDebug_dumpHprofDataDdms(JNIEnv*, jclass) { |
Elliott Hughes | 622a698 | 2012-06-08 17:58:54 -0700 | [diff] [blame] | 254 | hprof::DumpHeap("[DDMS]", -1, true); |
Elliott Hughes | 9d5ccec | 2011-09-19 13:19:50 -0700 | [diff] [blame] | 255 | } |
| 256 | |
Elliott Hughes | 0512f02 | 2012-03-15 22:10:52 -0700 | [diff] [blame] | 257 | static void VMDebug_dumpReferenceTables(JNIEnv* env, jclass) { |
Ian Rogers | 00f7d0e | 2012-07-19 15:28:27 -0700 | [diff] [blame] | 258 | ScopedObjectAccess soa(env); |
Elliott Hughes | 9d5ccec | 2011-09-19 13:19:50 -0700 | [diff] [blame] | 259 | LOG(INFO) << "--- reference table dump ---"; |
| 260 | |
Andreas Gampe | 3fec9ac | 2016-09-13 10:47:28 -0700 | [diff] [blame] | 261 | soa.Env()->DumpReferenceTables(LOG_STREAM(INFO)); |
| 262 | soa.Vm()->DumpReferenceTables(LOG_STREAM(INFO)); |
Elliott Hughes | 9d5ccec | 2011-09-19 13:19:50 -0700 | [diff] [blame] | 263 | |
| 264 | LOG(INFO) << "---"; |
| 265 | } |
| 266 | |
Elliott Hughes | 0512f02 | 2012-03-15 22:10:52 -0700 | [diff] [blame] | 267 | static void VMDebug_crash(JNIEnv*, jclass) { |
Elliott Hughes | 81ff318 | 2012-03-23 20:35:56 -0700 | [diff] [blame] | 268 | LOG(FATAL) << "Crashing runtime on request"; |
Elliott Hughes | 9d5ccec | 2011-09-19 13:19:50 -0700 | [diff] [blame] | 269 | } |
| 270 | |
Elliott Hughes | 0512f02 | 2012-03-15 22:10:52 -0700 | [diff] [blame] | 271 | static void VMDebug_infopoint(JNIEnv*, jclass, jint id) { |
Elliott Hughes | 9d5ccec | 2011-09-19 13:19:50 -0700 | [diff] [blame] | 272 | LOG(INFO) << "VMDebug infopoint " << id << " hit"; |
| 273 | } |
| 274 | |
Mathieu Chartier | 9d156d5 | 2016-10-06 17:44:26 -0700 | [diff] [blame] | 275 | static jlong VMDebug_countInstancesOfClass(JNIEnv* env, |
| 276 | jclass, |
| 277 | jclass javaClass, |
Ian Rogers | 00f7d0e | 2012-07-19 15:28:27 -0700 | [diff] [blame] | 278 | jboolean countAssignable) { |
| 279 | ScopedObjectAccess soa(env); |
Mathieu Chartier | f182085 | 2015-07-10 13:19:51 -0700 | [diff] [blame] | 280 | gc::Heap* const heap = Runtime::Current()->GetHeap(); |
| 281 | // Caller's responsibility to do GC if desired. |
Mathieu Chartier | 0795f23 | 2016-09-27 18:43:30 -0700 | [diff] [blame] | 282 | ObjPtr<mirror::Class> c = soa.Decode<mirror::Class>(javaClass); |
Mathieu Chartier | 412c7fc | 2014-02-07 12:18:39 -0800 | [diff] [blame] | 283 | if (c == nullptr) { |
Elliott Hughes | 9d5ccec | 2011-09-19 13:19:50 -0700 | [diff] [blame] | 284 | return 0; |
| 285 | } |
Mathieu Chartier | e8a3c57 | 2016-10-11 16:52:17 -0700 | [diff] [blame] | 286 | VariableSizedHandleScope hs(soa.Self()); |
Mathieu Chartier | 9d156d5 | 2016-10-06 17:44:26 -0700 | [diff] [blame] | 287 | std::vector<Handle<mirror::Class>> classes {hs.NewHandle(c)}; |
Elliott Hughes | ec0f83d | 2013-01-15 16:54:08 -0800 | [diff] [blame] | 288 | uint64_t count = 0; |
Mathieu Chartier | 412c7fc | 2014-02-07 12:18:39 -0800 | [diff] [blame] | 289 | heap->CountInstances(classes, countAssignable, &count); |
Elliott Hughes | ec0f83d | 2013-01-15 16:54:08 -0800 | [diff] [blame] | 290 | return count; |
Elliott Hughes | 9d5ccec | 2011-09-19 13:19:50 -0700 | [diff] [blame] | 291 | } |
| 292 | |
Mathieu Chartier | 9d156d5 | 2016-10-06 17:44:26 -0700 | [diff] [blame] | 293 | static jlongArray VMDebug_countInstancesOfClasses(JNIEnv* env, |
| 294 | jclass, |
| 295 | jobjectArray javaClasses, |
Mathieu Chartier | f182085 | 2015-07-10 13:19:51 -0700 | [diff] [blame] | 296 | jboolean countAssignable) { |
| 297 | ScopedObjectAccess soa(env); |
| 298 | gc::Heap* const heap = Runtime::Current()->GetHeap(); |
| 299 | // Caller's responsibility to do GC if desired. |
Mathieu Chartier | 0795f23 | 2016-09-27 18:43:30 -0700 | [diff] [blame] | 300 | ObjPtr<mirror::ObjectArray<mirror::Class>> decoded_classes = |
| 301 | soa.Decode<mirror::ObjectArray<mirror::Class>>(javaClasses); |
Mathieu Chartier | f182085 | 2015-07-10 13:19:51 -0700 | [diff] [blame] | 302 | if (decoded_classes == nullptr) { |
| 303 | return nullptr; |
| 304 | } |
Mathieu Chartier | e8a3c57 | 2016-10-11 16:52:17 -0700 | [diff] [blame] | 305 | VariableSizedHandleScope hs(soa.Self()); |
Mathieu Chartier | 9d156d5 | 2016-10-06 17:44:26 -0700 | [diff] [blame] | 306 | std::vector<Handle<mirror::Class>> classes; |
Mathieu Chartier | f182085 | 2015-07-10 13:19:51 -0700 | [diff] [blame] | 307 | for (size_t i = 0, count = decoded_classes->GetLength(); i < count; ++i) { |
Mathieu Chartier | 9d156d5 | 2016-10-06 17:44:26 -0700 | [diff] [blame] | 308 | classes.push_back(hs.NewHandle(decoded_classes->Get(i))); |
Mathieu Chartier | f182085 | 2015-07-10 13:19:51 -0700 | [diff] [blame] | 309 | } |
| 310 | std::vector<uint64_t> counts(classes.size(), 0u); |
| 311 | // Heap::CountInstances can handle null and will put 0 for these classes. |
| 312 | heap->CountInstances(classes, countAssignable, &counts[0]); |
Mathieu Chartier | 9d156d5 | 2016-10-06 17:44:26 -0700 | [diff] [blame] | 313 | ObjPtr<mirror::LongArray> long_counts = mirror::LongArray::Alloc(soa.Self(), counts.size()); |
Mathieu Chartier | f182085 | 2015-07-10 13:19:51 -0700 | [diff] [blame] | 314 | if (long_counts == nullptr) { |
| 315 | soa.Self()->AssertPendingOOMException(); |
| 316 | return nullptr; |
| 317 | } |
| 318 | for (size_t i = 0; i < counts.size(); ++i) { |
| 319 | long_counts->Set(i, counts[i]); |
| 320 | } |
| 321 | return soa.AddLocalReference<jlongArray>(long_counts); |
| 322 | } |
| 323 | |
Hiroshi Yamauchi | 09b07a9 | 2013-07-15 13:17:06 -0700 | [diff] [blame] | 324 | // We export the VM internal per-heap-space size/alloc/free metrics |
| 325 | // for the zygote space, alloc space (application heap), and the large |
| 326 | // object space for dumpsys meminfo. The other memory region data such |
| 327 | // as PSS, private/shared dirty/shared data are available via |
| 328 | // /proc/<pid>/smaps. |
| 329 | static void VMDebug_getHeapSpaceStats(JNIEnv* env, jclass, jlongArray data) { |
Ian Rogers | 6b99dd1 | 2013-07-25 12:11:32 -0700 | [diff] [blame] | 330 | jlong* arr = reinterpret_cast<jlong*>(env->GetPrimitiveArrayCritical(data, 0)); |
Mathieu Chartier | 7410f29 | 2013-11-24 13:17:35 -0800 | [diff] [blame] | 331 | if (arr == nullptr || env->GetArrayLength(data) < 9) { |
Hiroshi Yamauchi | 09b07a9 | 2013-07-15 13:17:06 -0700 | [diff] [blame] | 332 | return; |
| 333 | } |
| 334 | |
| 335 | size_t allocSize = 0; |
| 336 | size_t allocUsed = 0; |
| 337 | size_t zygoteSize = 0; |
| 338 | size_t zygoteUsed = 0; |
| 339 | size_t largeObjectsSize = 0; |
| 340 | size_t largeObjectsUsed = 0; |
Hiroshi Yamauchi | 09b07a9 | 2013-07-15 13:17:06 -0700 | [diff] [blame] | 341 | gc::Heap* heap = Runtime::Current()->GetHeap(); |
Mathieu Chartier | a9d82fe | 2016-01-25 20:06:11 -0800 | [diff] [blame] | 342 | { |
| 343 | ScopedObjectAccess soa(env); |
| 344 | for (gc::space::ContinuousSpace* space : heap->GetContinuousSpaces()) { |
| 345 | if (space->IsImageSpace()) { |
| 346 | // Currently don't include the image space. |
| 347 | } else if (space->IsZygoteSpace()) { |
| 348 | gc::space::ZygoteSpace* zygote_space = space->AsZygoteSpace(); |
| 349 | zygoteSize += zygote_space->Size(); |
| 350 | zygoteUsed += zygote_space->GetBytesAllocated(); |
| 351 | } else if (space->IsMallocSpace()) { |
| 352 | // This is a malloc space. |
| 353 | gc::space::MallocSpace* malloc_space = space->AsMallocSpace(); |
| 354 | allocSize += malloc_space->GetFootprint(); |
| 355 | allocUsed += malloc_space->GetBytesAllocated(); |
| 356 | } else if (space->IsBumpPointerSpace()) { |
| 357 | gc::space::BumpPointerSpace* bump_pointer_space = space->AsBumpPointerSpace(); |
| 358 | allocSize += bump_pointer_space->Size(); |
| 359 | allocUsed += bump_pointer_space->GetBytesAllocated(); |
| 360 | } |
| 361 | } |
| 362 | for (gc::space::DiscontinuousSpace* space : heap->GetDiscontinuousSpaces()) { |
| 363 | if (space->IsLargeObjectSpace()) { |
| 364 | largeObjectsSize += space->AsLargeObjectSpace()->GetBytesAllocated(); |
| 365 | largeObjectsUsed += largeObjectsSize; |
| 366 | } |
Hiroshi Yamauchi | 09b07a9 | 2013-07-15 13:17:06 -0700 | [diff] [blame] | 367 | } |
| 368 | } |
Hiroshi Yamauchi | 09b07a9 | 2013-07-15 13:17:06 -0700 | [diff] [blame] | 369 | size_t allocFree = allocSize - allocUsed; |
| 370 | size_t zygoteFree = zygoteSize - zygoteUsed; |
| 371 | size_t largeObjectsFree = largeObjectsSize - largeObjectsUsed; |
| 372 | |
| 373 | int j = 0; |
| 374 | arr[j++] = allocSize; |
| 375 | arr[j++] = allocUsed; |
| 376 | arr[j++] = allocFree; |
| 377 | arr[j++] = zygoteSize; |
| 378 | arr[j++] = zygoteUsed; |
| 379 | arr[j++] = zygoteFree; |
| 380 | arr[j++] = largeObjectsSize; |
| 381 | arr[j++] = largeObjectsUsed; |
| 382 | arr[j++] = largeObjectsFree; |
| 383 | env->ReleasePrimitiveArrayCritical(data, arr, 0); |
| 384 | } |
| 385 | |
Hiroshi Yamauchi | a1c9f01 | 2015-04-02 10:18:12 -0700 | [diff] [blame] | 386 | // The runtime stat names for VMDebug.getRuntimeStat(). |
| 387 | enum class VMDebugRuntimeStatId { |
| 388 | kArtGcGcCount = 0, |
| 389 | kArtGcGcTime, |
| 390 | kArtGcBytesAllocated, |
| 391 | kArtGcBytesFreed, |
| 392 | kArtGcBlockingGcCount, |
| 393 | kArtGcBlockingGcTime, |
| 394 | kArtGcGcCountRateHistogram, |
| 395 | kArtGcBlockingGcCountRateHistogram, |
| 396 | kNumRuntimeStats, |
| 397 | }; |
| 398 | |
| 399 | static jobject VMDebug_getRuntimeStatInternal(JNIEnv* env, jclass, jint statId) { |
| 400 | gc::Heap* heap = Runtime::Current()->GetHeap(); |
| 401 | switch (static_cast<VMDebugRuntimeStatId>(statId)) { |
| 402 | case VMDebugRuntimeStatId::kArtGcGcCount: { |
| 403 | std::string output = std::to_string(heap->GetGcCount()); |
| 404 | return env->NewStringUTF(output.c_str()); |
| 405 | } |
| 406 | case VMDebugRuntimeStatId::kArtGcGcTime: { |
| 407 | std::string output = std::to_string(NsToMs(heap->GetGcTime())); |
| 408 | return env->NewStringUTF(output.c_str()); |
| 409 | } |
| 410 | case VMDebugRuntimeStatId::kArtGcBytesAllocated: { |
| 411 | std::string output = std::to_string(heap->GetBytesAllocatedEver()); |
| 412 | return env->NewStringUTF(output.c_str()); |
| 413 | } |
| 414 | case VMDebugRuntimeStatId::kArtGcBytesFreed: { |
| 415 | std::string output = std::to_string(heap->GetBytesFreedEver()); |
| 416 | return env->NewStringUTF(output.c_str()); |
| 417 | } |
| 418 | case VMDebugRuntimeStatId::kArtGcBlockingGcCount: { |
| 419 | std::string output = std::to_string(heap->GetBlockingGcCount()); |
| 420 | return env->NewStringUTF(output.c_str()); |
| 421 | } |
| 422 | case VMDebugRuntimeStatId::kArtGcBlockingGcTime: { |
| 423 | std::string output = std::to_string(NsToMs(heap->GetBlockingGcTime())); |
| 424 | return env->NewStringUTF(output.c_str()); |
| 425 | } |
| 426 | case VMDebugRuntimeStatId::kArtGcGcCountRateHistogram: { |
| 427 | std::ostringstream output; |
| 428 | heap->DumpGcCountRateHistogram(output); |
| 429 | return env->NewStringUTF(output.str().c_str()); |
| 430 | } |
| 431 | case VMDebugRuntimeStatId::kArtGcBlockingGcCountRateHistogram: { |
| 432 | std::ostringstream output; |
| 433 | heap->DumpBlockingGcCountRateHistogram(output); |
| 434 | return env->NewStringUTF(output.str().c_str()); |
| 435 | } |
| 436 | default: |
| 437 | return nullptr; |
| 438 | } |
| 439 | } |
| 440 | |
Andreas Gampe | ca620d7 | 2016-11-08 08:09:33 -0800 | [diff] [blame] | 441 | static bool SetRuntimeStatValue(JNIEnv* env, |
| 442 | jobjectArray result, |
| 443 | VMDebugRuntimeStatId id, |
| 444 | const std::string& value) { |
Hiroshi Yamauchi | a1c9f01 | 2015-04-02 10:18:12 -0700 | [diff] [blame] | 445 | ScopedLocalRef<jstring> jvalue(env, env->NewStringUTF(value.c_str())); |
| 446 | if (jvalue.get() == nullptr) { |
| 447 | return false; |
| 448 | } |
| 449 | env->SetObjectArrayElement(result, static_cast<jint>(id), jvalue.get()); |
| 450 | return true; |
| 451 | } |
| 452 | |
| 453 | static jobjectArray VMDebug_getRuntimeStatsInternal(JNIEnv* env, jclass) { |
| 454 | jobjectArray result = env->NewObjectArray( |
| 455 | static_cast<jint>(VMDebugRuntimeStatId::kNumRuntimeStats), |
| 456 | WellKnownClasses::java_lang_String, |
| 457 | nullptr); |
| 458 | if (result == nullptr) { |
| 459 | return nullptr; |
| 460 | } |
| 461 | gc::Heap* heap = Runtime::Current()->GetHeap(); |
| 462 | if (!SetRuntimeStatValue(env, result, VMDebugRuntimeStatId::kArtGcGcCount, |
| 463 | std::to_string(heap->GetGcCount()))) { |
| 464 | return nullptr; |
| 465 | } |
| 466 | if (!SetRuntimeStatValue(env, result, VMDebugRuntimeStatId::kArtGcGcTime, |
| 467 | std::to_string(NsToMs(heap->GetGcTime())))) { |
| 468 | return nullptr; |
| 469 | } |
| 470 | if (!SetRuntimeStatValue(env, result, VMDebugRuntimeStatId::kArtGcBytesAllocated, |
| 471 | std::to_string(heap->GetBytesAllocatedEver()))) { |
| 472 | return nullptr; |
| 473 | } |
| 474 | if (!SetRuntimeStatValue(env, result, VMDebugRuntimeStatId::kArtGcBytesFreed, |
| 475 | std::to_string(heap->GetBytesFreedEver()))) { |
| 476 | return nullptr; |
| 477 | } |
| 478 | if (!SetRuntimeStatValue(env, result, VMDebugRuntimeStatId::kArtGcBlockingGcCount, |
| 479 | std::to_string(heap->GetBlockingGcCount()))) { |
| 480 | return nullptr; |
| 481 | } |
| 482 | if (!SetRuntimeStatValue(env, result, VMDebugRuntimeStatId::kArtGcBlockingGcTime, |
| 483 | std::to_string(NsToMs(heap->GetBlockingGcTime())))) { |
| 484 | return nullptr; |
| 485 | } |
| 486 | { |
| 487 | std::ostringstream output; |
| 488 | heap->DumpGcCountRateHistogram(output); |
| 489 | if (!SetRuntimeStatValue(env, result, VMDebugRuntimeStatId::kArtGcGcCountRateHistogram, |
| 490 | output.str())) { |
| 491 | return nullptr; |
| 492 | } |
| 493 | } |
| 494 | { |
| 495 | std::ostringstream output; |
| 496 | heap->DumpBlockingGcCountRateHistogram(output); |
| 497 | if (!SetRuntimeStatValue(env, result, VMDebugRuntimeStatId::kArtGcBlockingGcCountRateHistogram, |
| 498 | output.str())) { |
| 499 | return nullptr; |
| 500 | } |
| 501 | } |
| 502 | return result; |
| 503 | } |
| 504 | |
Leonard Mosescu | eb84221 | 2016-10-06 17:26:36 -0700 | [diff] [blame] | 505 | static void VMDebug_attachAgent(JNIEnv* env, jclass, jstring agent) { |
| 506 | if (agent == nullptr) { |
| 507 | ScopedObjectAccess soa(env); |
| 508 | ThrowNullPointerException("agent is null"); |
| 509 | return; |
| 510 | } |
| 511 | |
| 512 | if (!Dbg::IsJdwpAllowed()) { |
| 513 | ScopedObjectAccess soa(env); |
| 514 | ThrowSecurityException("Can't attach agent, process is not debuggable."); |
| 515 | return; |
| 516 | } |
| 517 | |
| 518 | std::string filename; |
| 519 | { |
| 520 | ScopedUtfChars chars(env, agent); |
| 521 | if (env->ExceptionCheck()) { |
| 522 | return; |
| 523 | } |
| 524 | filename = chars.c_str(); |
| 525 | } |
| 526 | |
| 527 | Runtime::Current()->AttachAgent(filename); |
| 528 | } |
| 529 | |
Elliott Hughes | 0512f02 | 2012-03-15 22:10:52 -0700 | [diff] [blame] | 530 | static JNINativeMethod gMethods[] = { |
Elliott Hughes | 9d5ccec | 2011-09-19 13:19:50 -0700 | [diff] [blame] | 531 | NATIVE_METHOD(VMDebug, countInstancesOfClass, "(Ljava/lang/Class;Z)J"), |
Mathieu Chartier | f182085 | 2015-07-10 13:19:51 -0700 | [diff] [blame] | 532 | NATIVE_METHOD(VMDebug, countInstancesOfClasses, "([Ljava/lang/Class;Z)[J"), |
Elliott Hughes | 9d5ccec | 2011-09-19 13:19:50 -0700 | [diff] [blame] | 533 | NATIVE_METHOD(VMDebug, crash, "()V"), |
| 534 | NATIVE_METHOD(VMDebug, dumpHprofData, "(Ljava/lang/String;Ljava/io/FileDescriptor;)V"), |
| 535 | NATIVE_METHOD(VMDebug, dumpHprofDataDdms, "()V"), |
| 536 | NATIVE_METHOD(VMDebug, dumpReferenceTables, "()V"), |
| 537 | NATIVE_METHOD(VMDebug, getAllocCount, "(I)I"), |
Hiroshi Yamauchi | 09b07a9 | 2013-07-15 13:17:06 -0700 | [diff] [blame] | 538 | NATIVE_METHOD(VMDebug, getHeapSpaceStats, "([J)V"), |
Elliott Hughes | 9d5ccec | 2011-09-19 13:19:50 -0700 | [diff] [blame] | 539 | NATIVE_METHOD(VMDebug, getInstructionCount, "([I)V"), |
Igor Murashkin | 3b6f440 | 2017-02-16 16:13:17 -0800 | [diff] [blame] | 540 | FAST_NATIVE_METHOD(VMDebug, getLoadedClassCount, "()I"), |
Elliott Hughes | 9d5ccec | 2011-09-19 13:19:50 -0700 | [diff] [blame] | 541 | NATIVE_METHOD(VMDebug, getVmFeatureList, "()[Ljava/lang/String;"), |
| 542 | NATIVE_METHOD(VMDebug, infopoint, "(I)V"), |
Igor Murashkin | 3b6f440 | 2017-02-16 16:13:17 -0800 | [diff] [blame] | 543 | FAST_NATIVE_METHOD(VMDebug, isDebuggerConnected, "()Z"), |
| 544 | FAST_NATIVE_METHOD(VMDebug, isDebuggingEnabled, "()Z"), |
Jeff Hao | 64caa7d | 2013-08-29 11:18:01 -0700 | [diff] [blame] | 545 | NATIVE_METHOD(VMDebug, getMethodTracingMode, "()I"), |
Igor Murashkin | 3b6f440 | 2017-02-16 16:13:17 -0800 | [diff] [blame] | 546 | FAST_NATIVE_METHOD(VMDebug, lastDebuggerActivity, "()J"), |
| 547 | FAST_NATIVE_METHOD(VMDebug, printLoadedClasses, "(I)V"), |
Elliott Hughes | 9d5ccec | 2011-09-19 13:19:50 -0700 | [diff] [blame] | 548 | NATIVE_METHOD(VMDebug, resetAllocCount, "(I)V"), |
| 549 | NATIVE_METHOD(VMDebug, resetInstructionCount, "()V"), |
| 550 | NATIVE_METHOD(VMDebug, startAllocCounting, "()V"), |
| 551 | NATIVE_METHOD(VMDebug, startEmulatorTracing, "()V"), |
| 552 | NATIVE_METHOD(VMDebug, startInstructionCounting, "()V"), |
Jeff Hao | 23009dc | 2013-08-22 15:36:42 -0700 | [diff] [blame] | 553 | NATIVE_METHOD(VMDebug, startMethodTracingDdmsImpl, "(IIZI)V"), |
Shukang Zhou | ca6e14e | 2017-01-25 00:35:21 -0800 | [diff] [blame] | 554 | NATIVE_METHOD(VMDebug, startMethodTracingFd, "(Ljava/lang/String;Ljava/io/FileDescriptor;IIZIZ)V"), |
Jeff Hao | 4044bda | 2014-01-06 15:50:45 -0800 | [diff] [blame] | 555 | NATIVE_METHOD(VMDebug, startMethodTracingFilename, "(Ljava/lang/String;IIZI)V"), |
Elliott Hughes | 9d5ccec | 2011-09-19 13:19:50 -0700 | [diff] [blame] | 556 | NATIVE_METHOD(VMDebug, stopAllocCounting, "()V"), |
| 557 | NATIVE_METHOD(VMDebug, stopEmulatorTracing, "()V"), |
| 558 | NATIVE_METHOD(VMDebug, stopInstructionCounting, "()V"), |
| 559 | NATIVE_METHOD(VMDebug, stopMethodTracing, "()V"), |
Igor Murashkin | 3b6f440 | 2017-02-16 16:13:17 -0800 | [diff] [blame] | 560 | FAST_NATIVE_METHOD(VMDebug, threadCpuTimeNanos, "()J"), |
Hiroshi Yamauchi | a1c9f01 | 2015-04-02 10:18:12 -0700 | [diff] [blame] | 561 | NATIVE_METHOD(VMDebug, getRuntimeStatInternal, "(I)Ljava/lang/String;"), |
Leonard Mosescu | eb84221 | 2016-10-06 17:26:36 -0700 | [diff] [blame] | 562 | NATIVE_METHOD(VMDebug, getRuntimeStatsInternal, "()[Ljava/lang/String;"), |
| 563 | NATIVE_METHOD(VMDebug, attachAgent, "(Ljava/lang/String;)V"), |
Elliott Hughes | 9d5ccec | 2011-09-19 13:19:50 -0700 | [diff] [blame] | 564 | }; |
| 565 | |
Elliott Hughes | 9d5ccec | 2011-09-19 13:19:50 -0700 | [diff] [blame] | 566 | void register_dalvik_system_VMDebug(JNIEnv* env) { |
Elliott Hughes | eac7667 | 2012-05-24 21:56:51 -0700 | [diff] [blame] | 567 | REGISTER_NATIVE_METHODS("dalvik/system/VMDebug"); |
Elliott Hughes | 9d5ccec | 2011-09-19 13:19:50 -0700 | [diff] [blame] | 568 | } |
| 569 | |
| 570 | } // namespace art |