blob: 6c82eb22bd2e9b8d8009d553f876f3fd40fb34c9 [file] [log] [blame]
Elliott Hughes9d5ccec2011-09-19 13:19:50 -07001/*
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 Gampe277ccbd2014-11-03 21:36:10 -080017#include "dalvik_system_VMDebug.h"
18
Elliott Hughes9d5ccec2011-09-19 13:19:50 -070019#include <string.h>
20#include <unistd.h>
21
Elliott Hugheseac76672012-05-24 21:56:51 -070022#include "class_linker.h"
Ian Rogers62d6c772013-02-27 08:32:07 -080023#include "common_throws.h"
Elliott Hugheseac76672012-05-24 21:56:51 -070024#include "debugger.h"
Mathieu Chartier7410f292013-11-24 13:17:35 -080025#include "gc/space/bump_pointer_space.h"
Hiroshi Yamauchi09b07a92013-07-15 13:17:06 -070026#include "gc/space/dlmalloc_space.h"
27#include "gc/space/large_object_space.h"
28#include "gc/space/space-inl.h"
Mathieu Chartier1f3b5352014-02-03 14:00:42 -080029#include "gc/space/zygote_space.h"
Elliott Hugheseac76672012-05-24 21:56:51 -070030#include "hprof/hprof.h"
31#include "jni_internal.h"
Ian Rogers2dd0e2c2013-01-24 12:42:14 -080032#include "mirror/class.h"
Ian Rogersdd157d72014-05-15 14:47:50 -070033#include "ScopedLocalRef.h"
Elliott Hugheseac76672012-05-24 21:56:51 -070034#include "ScopedUtfChars.h"
Ian Rogers53b8b092014-03-13 23:45:53 -070035#include "scoped_fast_native_object_access.h"
Elliott Hugheseac76672012-05-24 21:56:51 -070036#include "trace.h"
Ian Rogersdd157d72014-05-15 14:47:50 -070037#include "well_known_classes.h"
Elliott Hugheseac76672012-05-24 21:56:51 -070038
Elliott Hughes9d5ccec2011-09-19 13:19:50 -070039namespace art {
40
Elliott Hughes0512f022012-03-15 22:10:52 -070041static jobjectArray VMDebug_getVmFeatureList(JNIEnv* env, jclass) {
Ian Rogersdd157d72014-05-15 14:47:50 -070042 static const char* features[] = {
43 "method-trace-profiling",
44 "method-trace-profiling-streaming",
45 "method-sample-profiling",
46 "hprof-heap-dump",
47 "hprof-heap-dump-streaming",
48 };
49 jobjectArray result = env->NewObjectArray(arraysize(features),
50 WellKnownClasses::java_lang_String,
51 nullptr);
52 if (result != nullptr) {
53 for (size_t i = 0; i < arraysize(features); ++i) {
54 ScopedLocalRef<jstring> jfeature(env, env->NewStringUTF(features[i]));
55 if (jfeature.get() == nullptr) {
56 return nullptr;
57 }
58 env->SetObjectArrayElement(result, i, jfeature.get());
59 }
60 }
61 return result;
Elliott Hughes9d5ccec2011-09-19 13:19:50 -070062}
63
Elliott Hughes0512f022012-03-15 22:10:52 -070064static void VMDebug_startAllocCounting(JNIEnv*, jclass) {
Mathieu Chartier9ef78b52014-09-25 17:03:12 -070065 Runtime::Current()->SetStatsEnabled(true);
Elliott Hughes9d5ccec2011-09-19 13:19:50 -070066}
67
Elliott Hughes0512f022012-03-15 22:10:52 -070068static void VMDebug_stopAllocCounting(JNIEnv*, jclass) {
Mathieu Chartier9ef78b52014-09-25 17:03:12 -070069 Runtime::Current()->SetStatsEnabled(false);
Elliott Hughes9d5ccec2011-09-19 13:19:50 -070070}
71
Elliott Hughes1bac54f2012-03-16 12:48:31 -070072static jint VMDebug_getAllocCount(JNIEnv*, jclass, jint kind) {
Elliott Hughes9d5ccec2011-09-19 13:19:50 -070073 return Runtime::Current()->GetStat(kind);
74}
75
Elliott Hughes0512f022012-03-15 22:10:52 -070076static void VMDebug_resetAllocCount(JNIEnv*, jclass, jint kinds) {
Elliott Hughes9d5ccec2011-09-19 13:19:50 -070077 Runtime::Current()->ResetStats(kinds);
78}
79
Jeff Hao23009dc2013-08-22 15:36:42 -070080static void VMDebug_startMethodTracingDdmsImpl(JNIEnv*, jclass, jint bufferSize, jint flags,
81 jboolean samplingEnabled, jint intervalUs) {
82 Trace::Start("[DDMS]", -1, bufferSize, flags, true, samplingEnabled, intervalUs);
Elliott Hughes9d5ccec2011-09-19 13:19:50 -070083}
84
Ian Rogers00f7d0e2012-07-19 15:28:27 -070085static void VMDebug_startMethodTracingFd(JNIEnv* env, jclass, jstring javaTraceFilename,
Jeff Hao4044bda2014-01-06 15:50:45 -080086 jobject javaFd, jint bufferSize, jint flags,
87 jboolean samplingEnabled, jint intervalUs) {
Elliott Hughes9d5ccec2011-09-19 13:19:50 -070088 int originalFd = jniGetFDFromFileDescriptor(env, javaFd);
89 if (originalFd < 0) {
90 return;
91 }
92
93 int fd = dup(originalFd);
94 if (fd < 0) {
Ian Rogers00f7d0e2012-07-19 15:28:27 -070095 ScopedObjectAccess soa(env);
Ian Rogers62d6c772013-02-27 08:32:07 -080096 ThrowLocation throw_location = soa.Self()->GetCurrentLocationForThrow();
97 soa.Self()->ThrowNewExceptionF(throw_location, "Ljava/lang/RuntimeException;",
98 "dup(%d) failed: %s", originalFd, strerror(errno));
Elliott Hughes9d5ccec2011-09-19 13:19:50 -070099 return;
100 }
101
102 ScopedUtfChars traceFilename(env, javaTraceFilename);
103 if (traceFilename.c_str() == NULL) {
104 return;
105 }
Jeff Hao4044bda2014-01-06 15:50:45 -0800106 Trace::Start(traceFilename.c_str(), fd, bufferSize, flags, false, samplingEnabled, intervalUs);
Elliott Hughes9d5ccec2011-09-19 13:19:50 -0700107}
108
Ian Rogers00f7d0e2012-07-19 15:28:27 -0700109static void VMDebug_startMethodTracingFilename(JNIEnv* env, jclass, jstring javaTraceFilename,
Jeff Hao4044bda2014-01-06 15:50:45 -0800110 jint bufferSize, jint flags,
111 jboolean samplingEnabled, jint intervalUs) {
Elliott Hughes9d5ccec2011-09-19 13:19:50 -0700112 ScopedUtfChars traceFilename(env, javaTraceFilename);
113 if (traceFilename.c_str() == NULL) {
114 return;
115 }
Jeff Hao4044bda2014-01-06 15:50:45 -0800116 Trace::Start(traceFilename.c_str(), -1, bufferSize, flags, false, samplingEnabled, intervalUs);
Elliott Hughes9d5ccec2011-09-19 13:19:50 -0700117}
118
Jeff Hao64caa7d2013-08-29 11:18:01 -0700119static jint VMDebug_getMethodTracingMode(JNIEnv*, jclass) {
120 return Trace::GetMethodTracingMode();
Elliott Hughes9d5ccec2011-09-19 13:19:50 -0700121}
122
Elliott Hughes0512f022012-03-15 22:10:52 -0700123static void VMDebug_stopMethodTracing(JNIEnv*, jclass) {
jeffhaoe343b762011-12-05 16:36:44 -0800124 Trace::Stop();
Elliott Hughes9d5ccec2011-09-19 13:19:50 -0700125}
126
Elliott Hughes0512f022012-03-15 22:10:52 -0700127static void VMDebug_startEmulatorTracing(JNIEnv*, jclass) {
Elliott Hughes9d5ccec2011-09-19 13:19:50 -0700128 UNIMPLEMENTED(WARNING);
Brian Carlstrom7934ac22013-07-26 10:54:15 -0700129 // dvmEmulatorTraceStart();
Elliott Hughes9d5ccec2011-09-19 13:19:50 -0700130}
131
Elliott Hughes0512f022012-03-15 22:10:52 -0700132static void VMDebug_stopEmulatorTracing(JNIEnv*, jclass) {
Elliott Hughes9d5ccec2011-09-19 13:19:50 -0700133 UNIMPLEMENTED(WARNING);
Brian Carlstrom7934ac22013-07-26 10:54:15 -0700134 // dvmEmulatorTraceStop();
Elliott Hughes9d5ccec2011-09-19 13:19:50 -0700135}
136
Elliott Hughes0512f022012-03-15 22:10:52 -0700137static jboolean VMDebug_isDebuggerConnected(JNIEnv*, jclass) {
Elliott Hughesc0f09332012-03-26 13:27:06 -0700138 return Dbg::IsDebuggerActive();
Elliott Hughes9d5ccec2011-09-19 13:19:50 -0700139}
140
Elliott Hughes0512f022012-03-15 22:10:52 -0700141static jboolean VMDebug_isDebuggingEnabled(JNIEnv*, jclass) {
Elliott Hughesc0f09332012-03-26 13:27:06 -0700142 return Dbg::IsJdwpConfigured();
Elliott Hughes9d5ccec2011-09-19 13:19:50 -0700143}
144
Elliott Hughes0512f022012-03-15 22:10:52 -0700145static jlong VMDebug_lastDebuggerActivity(JNIEnv*, jclass) {
Elliott Hughes872d4ec2011-10-21 17:07:15 -0700146 return Dbg::LastDebuggerActivity();
Elliott Hughes9d5ccec2011-09-19 13:19:50 -0700147}
148
Ian Rogers62d6c772013-02-27 08:32:07 -0800149static void ThrowUnsupportedOperationException(JNIEnv* env) {
Ian Rogers00f7d0e2012-07-19 15:28:27 -0700150 ScopedObjectAccess soa(env);
Ian Rogers62d6c772013-02-27 08:32:07 -0800151 ThrowLocation throw_location = soa.Self()->GetCurrentLocationForThrow();
152 soa.Self()->ThrowNewException(throw_location, "Ljava/lang/UnsupportedOperationException;", NULL);
153}
154
155static void VMDebug_startInstructionCounting(JNIEnv* env, jclass) {
156 ThrowUnsupportedOperationException(env);
Elliott Hughes9d5ccec2011-09-19 13:19:50 -0700157}
158
Ian Rogers00f7d0e2012-07-19 15:28:27 -0700159static void VMDebug_stopInstructionCounting(JNIEnv* env, jclass) {
Ian Rogers62d6c772013-02-27 08:32:07 -0800160 ThrowUnsupportedOperationException(env);
Elliott Hughes9d5ccec2011-09-19 13:19:50 -0700161}
162
Ian Rogers00f7d0e2012-07-19 15:28:27 -0700163static void VMDebug_getInstructionCount(JNIEnv* env, jclass, jintArray /*javaCounts*/) {
Ian Rogers62d6c772013-02-27 08:32:07 -0800164 ThrowUnsupportedOperationException(env);
Elliott Hughes9d5ccec2011-09-19 13:19:50 -0700165}
166
Ian Rogers00f7d0e2012-07-19 15:28:27 -0700167static void VMDebug_resetInstructionCount(JNIEnv* env, jclass) {
Ian Rogers62d6c772013-02-27 08:32:07 -0800168 ThrowUnsupportedOperationException(env);
Elliott Hughes9d5ccec2011-09-19 13:19:50 -0700169}
170
Ian Rogers00f7d0e2012-07-19 15:28:27 -0700171static void VMDebug_printLoadedClasses(JNIEnv* env, jclass, jint flags) {
Ian Rogers53b8b092014-03-13 23:45:53 -0700172 ScopedFastNativeObjectAccess soa(env);
Elliott Hughes9d5ccec2011-09-19 13:19:50 -0700173 return Runtime::Current()->GetClassLinker()->DumpAllClasses(flags);
174}
175
Ian Rogers7dfb28c2013-08-22 08:18:36 -0700176static jint VMDebug_getLoadedClassCount(JNIEnv* env, jclass) {
Ian Rogers53b8b092014-03-13 23:45:53 -0700177 ScopedFastNativeObjectAccess soa(env);
Elliott Hughes9d5ccec2011-09-19 13:19:50 -0700178 return Runtime::Current()->GetClassLinker()->NumLoadedClasses();
179}
180
181/*
182 * Returns the thread-specific CPU-time clock value for the current thread,
183 * or -1 if the feature isn't supported.
184 */
Elliott Hughes0512f022012-03-15 22:10:52 -0700185static jlong VMDebug_threadCpuTimeNanos(JNIEnv*, jclass) {
186 return ThreadCpuNanoTime();
Elliott Hughes9d5ccec2011-09-19 13:19:50 -0700187}
188
189/*
190 * static void dumpHprofData(String fileName, FileDescriptor fd)
191 *
192 * Cause "hprof" data to be dumped. We can throw an IOException if an
193 * error occurs during file handling.
194 */
Elliott Hughes0512f022012-03-15 22:10:52 -0700195static void VMDebug_dumpHprofData(JNIEnv* env, jclass, jstring javaFilename, jobject javaFd) {
Elliott Hughes9d5ccec2011-09-19 13:19:50 -0700196 // Only one of these may be NULL.
197 if (javaFilename == NULL && javaFd == NULL) {
Ian Rogers00f7d0e2012-07-19 15:28:27 -0700198 ScopedObjectAccess soa(env);
Ian Rogers62d6c772013-02-27 08:32:07 -0800199 ThrowNullPointerException(NULL, "fileName == null && fd == null");
Elliott Hughes9d5ccec2011-09-19 13:19:50 -0700200 return;
201 }
202
203 std::string filename;
204 if (javaFilename != NULL) {
205 ScopedUtfChars chars(env, javaFilename);
206 if (env->ExceptionCheck()) {
207 return;
208 }
209 filename = chars.c_str();
210 } else {
211 filename = "[fd]";
212 }
213
214 int fd = -1;
215 if (javaFd != NULL) {
216 fd = jniGetFDFromFileDescriptor(env, javaFd);
217 if (fd < 0) {
Ian Rogers00f7d0e2012-07-19 15:28:27 -0700218 ScopedObjectAccess soa(env);
Ian Rogers62d6c772013-02-27 08:32:07 -0800219 ThrowRuntimeException("Invalid file descriptor");
Elliott Hughes9d5ccec2011-09-19 13:19:50 -0700220 return;
221 }
222 }
223
Elliott Hughes622a6982012-06-08 17:58:54 -0700224 hprof::DumpHeap(filename.c_str(), fd, false);
Elliott Hughes9d5ccec2011-09-19 13:19:50 -0700225}
226
Elliott Hugheseac76672012-05-24 21:56:51 -0700227static void VMDebug_dumpHprofDataDdms(JNIEnv*, jclass) {
Elliott Hughes622a6982012-06-08 17:58:54 -0700228 hprof::DumpHeap("[DDMS]", -1, true);
Elliott Hughes9d5ccec2011-09-19 13:19:50 -0700229}
230
Elliott Hughes0512f022012-03-15 22:10:52 -0700231static void VMDebug_dumpReferenceTables(JNIEnv* env, jclass) {
Ian Rogers00f7d0e2012-07-19 15:28:27 -0700232 ScopedObjectAccess soa(env);
Elliott Hughes9d5ccec2011-09-19 13:19:50 -0700233 LOG(INFO) << "--- reference table dump ---";
234
Ian Rogers00f7d0e2012-07-19 15:28:27 -0700235 soa.Env()->DumpReferenceTables(LOG(INFO));
236 soa.Vm()->DumpReferenceTables(LOG(INFO));
Elliott Hughes9d5ccec2011-09-19 13:19:50 -0700237
238 LOG(INFO) << "---";
239}
240
Elliott Hughes0512f022012-03-15 22:10:52 -0700241static void VMDebug_crash(JNIEnv*, jclass) {
Elliott Hughes81ff3182012-03-23 20:35:56 -0700242 LOG(FATAL) << "Crashing runtime on request";
Elliott Hughes9d5ccec2011-09-19 13:19:50 -0700243}
244
Elliott Hughes0512f022012-03-15 22:10:52 -0700245static void VMDebug_infopoint(JNIEnv*, jclass, jint id) {
Elliott Hughes9d5ccec2011-09-19 13:19:50 -0700246 LOG(INFO) << "VMDebug infopoint " << id << " hit";
247}
248
Ian Rogers00f7d0e2012-07-19 15:28:27 -0700249static jlong VMDebug_countInstancesOfClass(JNIEnv* env, jclass, jclass javaClass,
250 jboolean countAssignable) {
251 ScopedObjectAccess soa(env);
Mathieu Chartier412c7fc2014-02-07 12:18:39 -0800252 gc::Heap* heap = Runtime::Current()->GetHeap();
Mathieu Chartier83c8ee02014-01-28 14:50:23 -0800253 // We only want reachable instances, so do a GC. Heap::VisitObjects visits all of the heap
254 // objects in the all spaces and the allocation stack.
Mathieu Chartier412c7fc2014-02-07 12:18:39 -0800255 heap->CollectGarbage(false);
Ian Rogers2dd0e2c2013-01-24 12:42:14 -0800256 mirror::Class* c = soa.Decode<mirror::Class*>(javaClass);
Mathieu Chartier412c7fc2014-02-07 12:18:39 -0800257 if (c == nullptr) {
Elliott Hughes9d5ccec2011-09-19 13:19:50 -0700258 return 0;
259 }
Ian Rogers2dd0e2c2013-01-24 12:42:14 -0800260 std::vector<mirror::Class*> classes;
Elliott Hughesec0f83d2013-01-15 16:54:08 -0800261 classes.push_back(c);
262 uint64_t count = 0;
Mathieu Chartier412c7fc2014-02-07 12:18:39 -0800263 heap->CountInstances(classes, countAssignable, &count);
Elliott Hughesec0f83d2013-01-15 16:54:08 -0800264 return count;
Elliott Hughes9d5ccec2011-09-19 13:19:50 -0700265}
266
Hiroshi Yamauchi09b07a92013-07-15 13:17:06 -0700267// We export the VM internal per-heap-space size/alloc/free metrics
268// for the zygote space, alloc space (application heap), and the large
269// object space for dumpsys meminfo. The other memory region data such
270// as PSS, private/shared dirty/shared data are available via
271// /proc/<pid>/smaps.
272static void VMDebug_getHeapSpaceStats(JNIEnv* env, jclass, jlongArray data) {
Ian Rogers6b99dd12013-07-25 12:11:32 -0700273 jlong* arr = reinterpret_cast<jlong*>(env->GetPrimitiveArrayCritical(data, 0));
Mathieu Chartier7410f292013-11-24 13:17:35 -0800274 if (arr == nullptr || env->GetArrayLength(data) < 9) {
Hiroshi Yamauchi09b07a92013-07-15 13:17:06 -0700275 return;
276 }
277
278 size_t allocSize = 0;
279 size_t allocUsed = 0;
280 size_t zygoteSize = 0;
281 size_t zygoteUsed = 0;
282 size_t largeObjectsSize = 0;
283 size_t largeObjectsUsed = 0;
Hiroshi Yamauchi09b07a92013-07-15 13:17:06 -0700284 gc::Heap* heap = Runtime::Current()->GetHeap();
Mathieu Chartier7410f292013-11-24 13:17:35 -0800285 for (gc::space::ContinuousSpace* space : heap->GetContinuousSpaces()) {
Hiroshi Yamauchi09b07a92013-07-15 13:17:06 -0700286 if (space->IsImageSpace()) {
287 // Currently don't include the image space.
288 } else if (space->IsZygoteSpace()) {
Mathieu Chartier1f3b5352014-02-03 14:00:42 -0800289 gc::space::ZygoteSpace* zygote_space = space->AsZygoteSpace();
290 zygoteSize += zygote_space->Size();
291 zygoteUsed += zygote_space->GetBytesAllocated();
Mathieu Chartier7410f292013-11-24 13:17:35 -0800292 } else if (space->IsMallocSpace()) {
293 // This is a malloc space.
Hiroshi Yamauchicf58d4a2013-09-26 14:21:22 -0700294 gc::space::MallocSpace* malloc_space = space->AsMallocSpace();
295 allocSize += malloc_space->GetFootprint();
296 allocUsed += malloc_space->GetBytesAllocated();
Mathieu Chartier7410f292013-11-24 13:17:35 -0800297 } else if (space->IsBumpPointerSpace()) {
Mathieu Chartier692fafd2013-11-29 17:24:40 -0800298 ScopedObjectAccess soa(env);
Mathieu Chartier7410f292013-11-24 13:17:35 -0800299 gc::space::BumpPointerSpace* bump_pointer_space = space->AsBumpPointerSpace();
300 allocSize += bump_pointer_space->Size();
301 allocUsed += bump_pointer_space->GetBytesAllocated();
Hiroshi Yamauchi09b07a92013-07-15 13:17:06 -0700302 }
303 }
Mathieu Chartier7410f292013-11-24 13:17:35 -0800304 for (gc::space::DiscontinuousSpace* space : heap->GetDiscontinuousSpaces()) {
Hiroshi Yamauchi09b07a92013-07-15 13:17:06 -0700305 if (space->IsLargeObjectSpace()) {
306 largeObjectsSize += space->AsLargeObjectSpace()->GetBytesAllocated();
307 largeObjectsUsed += largeObjectsSize;
308 }
309 }
310
311 size_t allocFree = allocSize - allocUsed;
312 size_t zygoteFree = zygoteSize - zygoteUsed;
313 size_t largeObjectsFree = largeObjectsSize - largeObjectsUsed;
314
315 int j = 0;
316 arr[j++] = allocSize;
317 arr[j++] = allocUsed;
318 arr[j++] = allocFree;
319 arr[j++] = zygoteSize;
320 arr[j++] = zygoteUsed;
321 arr[j++] = zygoteFree;
322 arr[j++] = largeObjectsSize;
323 arr[j++] = largeObjectsUsed;
324 arr[j++] = largeObjectsFree;
325 env->ReleasePrimitiveArrayCritical(data, arr, 0);
326}
327
Elliott Hughes0512f022012-03-15 22:10:52 -0700328static JNINativeMethod gMethods[] = {
Elliott Hughes9d5ccec2011-09-19 13:19:50 -0700329 NATIVE_METHOD(VMDebug, countInstancesOfClass, "(Ljava/lang/Class;Z)J"),
330 NATIVE_METHOD(VMDebug, crash, "()V"),
331 NATIVE_METHOD(VMDebug, dumpHprofData, "(Ljava/lang/String;Ljava/io/FileDescriptor;)V"),
332 NATIVE_METHOD(VMDebug, dumpHprofDataDdms, "()V"),
333 NATIVE_METHOD(VMDebug, dumpReferenceTables, "()V"),
334 NATIVE_METHOD(VMDebug, getAllocCount, "(I)I"),
Hiroshi Yamauchi09b07a92013-07-15 13:17:06 -0700335 NATIVE_METHOD(VMDebug, getHeapSpaceStats, "([J)V"),
Elliott Hughes9d5ccec2011-09-19 13:19:50 -0700336 NATIVE_METHOD(VMDebug, getInstructionCount, "([I)V"),
Ian Rogers53b8b092014-03-13 23:45:53 -0700337 NATIVE_METHOD(VMDebug, getLoadedClassCount, "!()I"),
Elliott Hughes9d5ccec2011-09-19 13:19:50 -0700338 NATIVE_METHOD(VMDebug, getVmFeatureList, "()[Ljava/lang/String;"),
339 NATIVE_METHOD(VMDebug, infopoint, "(I)V"),
Ian Rogers53b8b092014-03-13 23:45:53 -0700340 NATIVE_METHOD(VMDebug, isDebuggerConnected, "!()Z"),
341 NATIVE_METHOD(VMDebug, isDebuggingEnabled, "!()Z"),
Jeff Hao64caa7d2013-08-29 11:18:01 -0700342 NATIVE_METHOD(VMDebug, getMethodTracingMode, "()I"),
Ian Rogers53b8b092014-03-13 23:45:53 -0700343 NATIVE_METHOD(VMDebug, lastDebuggerActivity, "!()J"),
344 NATIVE_METHOD(VMDebug, printLoadedClasses, "!(I)V"),
Elliott Hughes9d5ccec2011-09-19 13:19:50 -0700345 NATIVE_METHOD(VMDebug, resetAllocCount, "(I)V"),
346 NATIVE_METHOD(VMDebug, resetInstructionCount, "()V"),
347 NATIVE_METHOD(VMDebug, startAllocCounting, "()V"),
348 NATIVE_METHOD(VMDebug, startEmulatorTracing, "()V"),
349 NATIVE_METHOD(VMDebug, startInstructionCounting, "()V"),
Jeff Hao23009dc2013-08-22 15:36:42 -0700350 NATIVE_METHOD(VMDebug, startMethodTracingDdmsImpl, "(IIZI)V"),
Jeff Hao4044bda2014-01-06 15:50:45 -0800351 NATIVE_METHOD(VMDebug, startMethodTracingFd, "(Ljava/lang/String;Ljava/io/FileDescriptor;IIZI)V"),
352 NATIVE_METHOD(VMDebug, startMethodTracingFilename, "(Ljava/lang/String;IIZI)V"),
Elliott Hughes9d5ccec2011-09-19 13:19:50 -0700353 NATIVE_METHOD(VMDebug, stopAllocCounting, "()V"),
354 NATIVE_METHOD(VMDebug, stopEmulatorTracing, "()V"),
355 NATIVE_METHOD(VMDebug, stopInstructionCounting, "()V"),
356 NATIVE_METHOD(VMDebug, stopMethodTracing, "()V"),
Ian Rogers53b8b092014-03-13 23:45:53 -0700357 NATIVE_METHOD(VMDebug, threadCpuTimeNanos, "!()J"),
Elliott Hughes9d5ccec2011-09-19 13:19:50 -0700358};
359
Elliott Hughes9d5ccec2011-09-19 13:19:50 -0700360void register_dalvik_system_VMDebug(JNIEnv* env) {
Elliott Hugheseac76672012-05-24 21:56:51 -0700361 REGISTER_NATIVE_METHODS("dalvik/system/VMDebug");
Elliott Hughes9d5ccec2011-09-19 13:19:50 -0700362}
363
364} // namespace art