blob: d8a537f94892811221eabbffd5c942518646db12 [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
Elliott Hughes9d5ccec2011-09-19 13:19:50 -070017#include <string.h>
18#include <unistd.h>
19
Elliott Hugheseac76672012-05-24 21:56:51 -070020#include "class_linker.h"
Ian Rogers62d6c772013-02-27 08:32:07 -080021#include "common_throws.h"
Elliott Hugheseac76672012-05-24 21:56:51 -070022#include "debugger.h"
Mathieu Chartier7410f292013-11-24 13:17:35 -080023#include "gc/space/bump_pointer_space.h"
Hiroshi Yamauchi09b07a92013-07-15 13:17:06 -070024#include "gc/space/dlmalloc_space.h"
25#include "gc/space/large_object_space.h"
26#include "gc/space/space-inl.h"
Mathieu Chartier1f3b5352014-02-03 14:00:42 -080027#include "gc/space/zygote_space.h"
Elliott Hugheseac76672012-05-24 21:56:51 -070028#include "hprof/hprof.h"
29#include "jni_internal.h"
Ian Rogers2dd0e2c2013-01-24 12:42:14 -080030#include "mirror/class.h"
Ian Rogersdd157d72014-05-15 14:47:50 -070031#include "ScopedLocalRef.h"
Elliott Hugheseac76672012-05-24 21:56:51 -070032#include "ScopedUtfChars.h"
Ian Rogers53b8b092014-03-13 23:45:53 -070033#include "scoped_fast_native_object_access.h"
Elliott Hugheseac76672012-05-24 21:56:51 -070034#include "trace.h"
Ian Rogersdd157d72014-05-15 14:47:50 -070035#include "well_known_classes.h"
Elliott Hugheseac76672012-05-24 21:56:51 -070036
Elliott Hughes9d5ccec2011-09-19 13:19:50 -070037namespace art {
38
Elliott Hughes0512f022012-03-15 22:10:52 -070039static jobjectArray VMDebug_getVmFeatureList(JNIEnv* env, jclass) {
Ian Rogersdd157d72014-05-15 14:47:50 -070040 static const char* features[] = {
41 "method-trace-profiling",
42 "method-trace-profiling-streaming",
43 "method-sample-profiling",
44 "hprof-heap-dump",
45 "hprof-heap-dump-streaming",
46 };
47 jobjectArray result = env->NewObjectArray(arraysize(features),
48 WellKnownClasses::java_lang_String,
49 nullptr);
50 if (result != nullptr) {
51 for (size_t i = 0; i < arraysize(features); ++i) {
52 ScopedLocalRef<jstring> jfeature(env, env->NewStringUTF(features[i]));
53 if (jfeature.get() == nullptr) {
54 return nullptr;
55 }
56 env->SetObjectArrayElement(result, i, jfeature.get());
57 }
58 }
59 return result;
Elliott Hughes9d5ccec2011-09-19 13:19:50 -070060}
61
Elliott Hughes0512f022012-03-15 22:10:52 -070062static void VMDebug_startAllocCounting(JNIEnv*, jclass) {
Jeff Hao69dbec62014-09-15 18:03:41 -070063 Runtime::Current()->SetStatsEnabled(true, false);
Elliott Hughes9d5ccec2011-09-19 13:19:50 -070064}
65
Elliott Hughes0512f022012-03-15 22:10:52 -070066static void VMDebug_stopAllocCounting(JNIEnv*, jclass) {
Jeff Hao69dbec62014-09-15 18:03:41 -070067 Runtime::Current()->SetStatsEnabled(false, false);
Elliott Hughes9d5ccec2011-09-19 13:19:50 -070068}
69
Elliott Hughes1bac54f2012-03-16 12:48:31 -070070static jint VMDebug_getAllocCount(JNIEnv*, jclass, jint kind) {
Elliott Hughes9d5ccec2011-09-19 13:19:50 -070071 return Runtime::Current()->GetStat(kind);
72}
73
Elliott Hughes0512f022012-03-15 22:10:52 -070074static void VMDebug_resetAllocCount(JNIEnv*, jclass, jint kinds) {
Elliott Hughes9d5ccec2011-09-19 13:19:50 -070075 Runtime::Current()->ResetStats(kinds);
76}
77
Jeff Hao23009dc2013-08-22 15:36:42 -070078static void VMDebug_startMethodTracingDdmsImpl(JNIEnv*, jclass, jint bufferSize, jint flags,
79 jboolean samplingEnabled, jint intervalUs) {
80 Trace::Start("[DDMS]", -1, bufferSize, flags, true, samplingEnabled, intervalUs);
Elliott Hughes9d5ccec2011-09-19 13:19:50 -070081}
82
Ian Rogers00f7d0e2012-07-19 15:28:27 -070083static void VMDebug_startMethodTracingFd(JNIEnv* env, jclass, jstring javaTraceFilename,
Jeff Hao4044bda2014-01-06 15:50:45 -080084 jobject javaFd, jint bufferSize, jint flags,
85 jboolean samplingEnabled, jint intervalUs) {
Elliott Hughes9d5ccec2011-09-19 13:19:50 -070086 int originalFd = jniGetFDFromFileDescriptor(env, javaFd);
87 if (originalFd < 0) {
88 return;
89 }
90
91 int fd = dup(originalFd);
92 if (fd < 0) {
Ian Rogers00f7d0e2012-07-19 15:28:27 -070093 ScopedObjectAccess soa(env);
Ian Rogers62d6c772013-02-27 08:32:07 -080094 ThrowLocation throw_location = soa.Self()->GetCurrentLocationForThrow();
95 soa.Self()->ThrowNewExceptionF(throw_location, "Ljava/lang/RuntimeException;",
96 "dup(%d) failed: %s", originalFd, strerror(errno));
Elliott Hughes9d5ccec2011-09-19 13:19:50 -070097 return;
98 }
99
100 ScopedUtfChars traceFilename(env, javaTraceFilename);
101 if (traceFilename.c_str() == NULL) {
102 return;
103 }
Jeff Hao4044bda2014-01-06 15:50:45 -0800104 Trace::Start(traceFilename.c_str(), fd, bufferSize, flags, false, samplingEnabled, intervalUs);
Elliott Hughes9d5ccec2011-09-19 13:19:50 -0700105}
106
Ian Rogers00f7d0e2012-07-19 15:28:27 -0700107static void VMDebug_startMethodTracingFilename(JNIEnv* env, jclass, jstring javaTraceFilename,
Jeff Hao4044bda2014-01-06 15:50:45 -0800108 jint bufferSize, jint flags,
109 jboolean samplingEnabled, jint intervalUs) {
Elliott Hughes9d5ccec2011-09-19 13:19:50 -0700110 ScopedUtfChars traceFilename(env, javaTraceFilename);
111 if (traceFilename.c_str() == NULL) {
112 return;
113 }
Jeff Hao4044bda2014-01-06 15:50:45 -0800114 Trace::Start(traceFilename.c_str(), -1, bufferSize, flags, false, samplingEnabled, intervalUs);
Elliott Hughes9d5ccec2011-09-19 13:19:50 -0700115}
116
Jeff Hao64caa7d2013-08-29 11:18:01 -0700117static jint VMDebug_getMethodTracingMode(JNIEnv*, jclass) {
118 return Trace::GetMethodTracingMode();
Elliott Hughes9d5ccec2011-09-19 13:19:50 -0700119}
120
Elliott Hughes0512f022012-03-15 22:10:52 -0700121static void VMDebug_stopMethodTracing(JNIEnv*, jclass) {
jeffhaoe343b762011-12-05 16:36:44 -0800122 Trace::Stop();
Elliott Hughes9d5ccec2011-09-19 13:19:50 -0700123}
124
Elliott Hughes0512f022012-03-15 22:10:52 -0700125static void VMDebug_startEmulatorTracing(JNIEnv*, jclass) {
Elliott Hughes9d5ccec2011-09-19 13:19:50 -0700126 UNIMPLEMENTED(WARNING);
Brian Carlstrom7934ac22013-07-26 10:54:15 -0700127 // dvmEmulatorTraceStart();
Elliott Hughes9d5ccec2011-09-19 13:19:50 -0700128}
129
Elliott Hughes0512f022012-03-15 22:10:52 -0700130static void VMDebug_stopEmulatorTracing(JNIEnv*, jclass) {
Elliott Hughes9d5ccec2011-09-19 13:19:50 -0700131 UNIMPLEMENTED(WARNING);
Brian Carlstrom7934ac22013-07-26 10:54:15 -0700132 // dvmEmulatorTraceStop();
Elliott Hughes9d5ccec2011-09-19 13:19:50 -0700133}
134
Elliott Hughes0512f022012-03-15 22:10:52 -0700135static jboolean VMDebug_isDebuggerConnected(JNIEnv*, jclass) {
Elliott Hughesc0f09332012-03-26 13:27:06 -0700136 return Dbg::IsDebuggerActive();
Elliott Hughes9d5ccec2011-09-19 13:19:50 -0700137}
138
Elliott Hughes0512f022012-03-15 22:10:52 -0700139static jboolean VMDebug_isDebuggingEnabled(JNIEnv*, jclass) {
Elliott Hughesc0f09332012-03-26 13:27:06 -0700140 return Dbg::IsJdwpConfigured();
Elliott Hughes9d5ccec2011-09-19 13:19:50 -0700141}
142
Elliott Hughes0512f022012-03-15 22:10:52 -0700143static jlong VMDebug_lastDebuggerActivity(JNIEnv*, jclass) {
Elliott Hughes872d4ec2011-10-21 17:07:15 -0700144 return Dbg::LastDebuggerActivity();
Elliott Hughes9d5ccec2011-09-19 13:19:50 -0700145}
146
Ian Rogers62d6c772013-02-27 08:32:07 -0800147static void ThrowUnsupportedOperationException(JNIEnv* env) {
Ian Rogers00f7d0e2012-07-19 15:28:27 -0700148 ScopedObjectAccess soa(env);
Ian Rogers62d6c772013-02-27 08:32:07 -0800149 ThrowLocation throw_location = soa.Self()->GetCurrentLocationForThrow();
150 soa.Self()->ThrowNewException(throw_location, "Ljava/lang/UnsupportedOperationException;", NULL);
151}
152
153static void VMDebug_startInstructionCounting(JNIEnv* env, jclass) {
154 ThrowUnsupportedOperationException(env);
Elliott Hughes9d5ccec2011-09-19 13:19:50 -0700155}
156
Ian Rogers00f7d0e2012-07-19 15:28:27 -0700157static void VMDebug_stopInstructionCounting(JNIEnv* env, jclass) {
Ian Rogers62d6c772013-02-27 08:32:07 -0800158 ThrowUnsupportedOperationException(env);
Elliott Hughes9d5ccec2011-09-19 13:19:50 -0700159}
160
Ian Rogers00f7d0e2012-07-19 15:28:27 -0700161static void VMDebug_getInstructionCount(JNIEnv* env, jclass, jintArray /*javaCounts*/) {
Ian Rogers62d6c772013-02-27 08:32:07 -0800162 ThrowUnsupportedOperationException(env);
Elliott Hughes9d5ccec2011-09-19 13:19:50 -0700163}
164
Ian Rogers00f7d0e2012-07-19 15:28:27 -0700165static void VMDebug_resetInstructionCount(JNIEnv* env, jclass) {
Ian Rogers62d6c772013-02-27 08:32:07 -0800166 ThrowUnsupportedOperationException(env);
Elliott Hughes9d5ccec2011-09-19 13:19:50 -0700167}
168
Ian Rogers00f7d0e2012-07-19 15:28:27 -0700169static void VMDebug_printLoadedClasses(JNIEnv* env, jclass, jint flags) {
Ian Rogers53b8b092014-03-13 23:45:53 -0700170 ScopedFastNativeObjectAccess soa(env);
Elliott Hughes9d5ccec2011-09-19 13:19:50 -0700171 return Runtime::Current()->GetClassLinker()->DumpAllClasses(flags);
172}
173
Ian Rogers7dfb28c2013-08-22 08:18:36 -0700174static jint VMDebug_getLoadedClassCount(JNIEnv* env, jclass) {
Ian Rogers53b8b092014-03-13 23:45:53 -0700175 ScopedFastNativeObjectAccess soa(env);
Elliott Hughes9d5ccec2011-09-19 13:19:50 -0700176 return Runtime::Current()->GetClassLinker()->NumLoadedClasses();
177}
178
179/*
180 * Returns the thread-specific CPU-time clock value for the current thread,
181 * or -1 if the feature isn't supported.
182 */
Elliott Hughes0512f022012-03-15 22:10:52 -0700183static jlong VMDebug_threadCpuTimeNanos(JNIEnv*, jclass) {
184 return ThreadCpuNanoTime();
Elliott Hughes9d5ccec2011-09-19 13:19:50 -0700185}
186
187/*
188 * static void dumpHprofData(String fileName, FileDescriptor fd)
189 *
190 * Cause "hprof" data to be dumped. We can throw an IOException if an
191 * error occurs during file handling.
192 */
Elliott Hughes0512f022012-03-15 22:10:52 -0700193static void VMDebug_dumpHprofData(JNIEnv* env, jclass, jstring javaFilename, jobject javaFd) {
Elliott Hughes9d5ccec2011-09-19 13:19:50 -0700194 // Only one of these may be NULL.
195 if (javaFilename == NULL && javaFd == NULL) {
Ian Rogers00f7d0e2012-07-19 15:28:27 -0700196 ScopedObjectAccess soa(env);
Ian Rogers62d6c772013-02-27 08:32:07 -0800197 ThrowNullPointerException(NULL, "fileName == null && fd == null");
Elliott Hughes9d5ccec2011-09-19 13:19:50 -0700198 return;
199 }
200
201 std::string filename;
202 if (javaFilename != NULL) {
203 ScopedUtfChars chars(env, javaFilename);
204 if (env->ExceptionCheck()) {
205 return;
206 }
207 filename = chars.c_str();
208 } else {
209 filename = "[fd]";
210 }
211
212 int fd = -1;
213 if (javaFd != NULL) {
214 fd = jniGetFDFromFileDescriptor(env, javaFd);
215 if (fd < 0) {
Ian Rogers00f7d0e2012-07-19 15:28:27 -0700216 ScopedObjectAccess soa(env);
Ian Rogers62d6c772013-02-27 08:32:07 -0800217 ThrowRuntimeException("Invalid file descriptor");
Elliott Hughes9d5ccec2011-09-19 13:19:50 -0700218 return;
219 }
220 }
221
Elliott Hughes622a6982012-06-08 17:58:54 -0700222 hprof::DumpHeap(filename.c_str(), fd, false);
Elliott Hughes9d5ccec2011-09-19 13:19:50 -0700223}
224
Elliott Hugheseac76672012-05-24 21:56:51 -0700225static void VMDebug_dumpHprofDataDdms(JNIEnv*, jclass) {
Elliott Hughes622a6982012-06-08 17:58:54 -0700226 hprof::DumpHeap("[DDMS]", -1, true);
Elliott Hughes9d5ccec2011-09-19 13:19:50 -0700227}
228
Elliott Hughes0512f022012-03-15 22:10:52 -0700229static void VMDebug_dumpReferenceTables(JNIEnv* env, jclass) {
Ian Rogers00f7d0e2012-07-19 15:28:27 -0700230 ScopedObjectAccess soa(env);
Elliott Hughes9d5ccec2011-09-19 13:19:50 -0700231 LOG(INFO) << "--- reference table dump ---";
232
Ian Rogers00f7d0e2012-07-19 15:28:27 -0700233 soa.Env()->DumpReferenceTables(LOG(INFO));
234 soa.Vm()->DumpReferenceTables(LOG(INFO));
Elliott Hughes9d5ccec2011-09-19 13:19:50 -0700235
236 LOG(INFO) << "---";
237}
238
Elliott Hughes0512f022012-03-15 22:10:52 -0700239static void VMDebug_crash(JNIEnv*, jclass) {
Elliott Hughes81ff3182012-03-23 20:35:56 -0700240 LOG(FATAL) << "Crashing runtime on request";
Elliott Hughes9d5ccec2011-09-19 13:19:50 -0700241}
242
Elliott Hughes0512f022012-03-15 22:10:52 -0700243static void VMDebug_infopoint(JNIEnv*, jclass, jint id) {
Elliott Hughes9d5ccec2011-09-19 13:19:50 -0700244 LOG(INFO) << "VMDebug infopoint " << id << " hit";
245}
246
Ian Rogers00f7d0e2012-07-19 15:28:27 -0700247static jlong VMDebug_countInstancesOfClass(JNIEnv* env, jclass, jclass javaClass,
248 jboolean countAssignable) {
249 ScopedObjectAccess soa(env);
Mathieu Chartier412c7fc2014-02-07 12:18:39 -0800250 gc::Heap* heap = Runtime::Current()->GetHeap();
Mathieu Chartier83c8ee02014-01-28 14:50:23 -0800251 // We only want reachable instances, so do a GC. Heap::VisitObjects visits all of the heap
252 // objects in the all spaces and the allocation stack.
Mathieu Chartier412c7fc2014-02-07 12:18:39 -0800253 heap->CollectGarbage(false);
Ian Rogers2dd0e2c2013-01-24 12:42:14 -0800254 mirror::Class* c = soa.Decode<mirror::Class*>(javaClass);
Mathieu Chartier412c7fc2014-02-07 12:18:39 -0800255 if (c == nullptr) {
Elliott Hughes9d5ccec2011-09-19 13:19:50 -0700256 return 0;
257 }
Ian Rogers2dd0e2c2013-01-24 12:42:14 -0800258 std::vector<mirror::Class*> classes;
Elliott Hughesec0f83d2013-01-15 16:54:08 -0800259 classes.push_back(c);
260 uint64_t count = 0;
Mathieu Chartier412c7fc2014-02-07 12:18:39 -0800261 heap->CountInstances(classes, countAssignable, &count);
Elliott Hughesec0f83d2013-01-15 16:54:08 -0800262 return count;
Elliott Hughes9d5ccec2011-09-19 13:19:50 -0700263}
264
Hiroshi Yamauchi09b07a92013-07-15 13:17:06 -0700265// We export the VM internal per-heap-space size/alloc/free metrics
266// for the zygote space, alloc space (application heap), and the large
267// object space for dumpsys meminfo. The other memory region data such
268// as PSS, private/shared dirty/shared data are available via
269// /proc/<pid>/smaps.
270static void VMDebug_getHeapSpaceStats(JNIEnv* env, jclass, jlongArray data) {
Ian Rogers6b99dd12013-07-25 12:11:32 -0700271 jlong* arr = reinterpret_cast<jlong*>(env->GetPrimitiveArrayCritical(data, 0));
Mathieu Chartier7410f292013-11-24 13:17:35 -0800272 if (arr == nullptr || env->GetArrayLength(data) < 9) {
Hiroshi Yamauchi09b07a92013-07-15 13:17:06 -0700273 return;
274 }
275
276 size_t allocSize = 0;
277 size_t allocUsed = 0;
278 size_t zygoteSize = 0;
279 size_t zygoteUsed = 0;
280 size_t largeObjectsSize = 0;
281 size_t largeObjectsUsed = 0;
Hiroshi Yamauchi09b07a92013-07-15 13:17:06 -0700282 gc::Heap* heap = Runtime::Current()->GetHeap();
Mathieu Chartier7410f292013-11-24 13:17:35 -0800283 for (gc::space::ContinuousSpace* space : heap->GetContinuousSpaces()) {
Hiroshi Yamauchi09b07a92013-07-15 13:17:06 -0700284 if (space->IsImageSpace()) {
285 // Currently don't include the image space.
286 } else if (space->IsZygoteSpace()) {
Mathieu Chartier1f3b5352014-02-03 14:00:42 -0800287 gc::space::ZygoteSpace* zygote_space = space->AsZygoteSpace();
288 zygoteSize += zygote_space->Size();
289 zygoteUsed += zygote_space->GetBytesAllocated();
Mathieu Chartier7410f292013-11-24 13:17:35 -0800290 } else if (space->IsMallocSpace()) {
291 // This is a malloc space.
Hiroshi Yamauchicf58d4a2013-09-26 14:21:22 -0700292 gc::space::MallocSpace* malloc_space = space->AsMallocSpace();
293 allocSize += malloc_space->GetFootprint();
294 allocUsed += malloc_space->GetBytesAllocated();
Mathieu Chartier7410f292013-11-24 13:17:35 -0800295 } else if (space->IsBumpPointerSpace()) {
Mathieu Chartier692fafd2013-11-29 17:24:40 -0800296 ScopedObjectAccess soa(env);
Mathieu Chartier7410f292013-11-24 13:17:35 -0800297 gc::space::BumpPointerSpace* bump_pointer_space = space->AsBumpPointerSpace();
298 allocSize += bump_pointer_space->Size();
299 allocUsed += bump_pointer_space->GetBytesAllocated();
Hiroshi Yamauchi09b07a92013-07-15 13:17:06 -0700300 }
301 }
Mathieu Chartier7410f292013-11-24 13:17:35 -0800302 for (gc::space::DiscontinuousSpace* space : heap->GetDiscontinuousSpaces()) {
Hiroshi Yamauchi09b07a92013-07-15 13:17:06 -0700303 if (space->IsLargeObjectSpace()) {
304 largeObjectsSize += space->AsLargeObjectSpace()->GetBytesAllocated();
305 largeObjectsUsed += largeObjectsSize;
306 }
307 }
308
309 size_t allocFree = allocSize - allocUsed;
310 size_t zygoteFree = zygoteSize - zygoteUsed;
311 size_t largeObjectsFree = largeObjectsSize - largeObjectsUsed;
312
313 int j = 0;
314 arr[j++] = allocSize;
315 arr[j++] = allocUsed;
316 arr[j++] = allocFree;
317 arr[j++] = zygoteSize;
318 arr[j++] = zygoteUsed;
319 arr[j++] = zygoteFree;
320 arr[j++] = largeObjectsSize;
321 arr[j++] = largeObjectsUsed;
322 arr[j++] = largeObjectsFree;
323 env->ReleasePrimitiveArrayCritical(data, arr, 0);
324}
325
Elliott Hughes0512f022012-03-15 22:10:52 -0700326static JNINativeMethod gMethods[] = {
Elliott Hughes9d5ccec2011-09-19 13:19:50 -0700327 NATIVE_METHOD(VMDebug, countInstancesOfClass, "(Ljava/lang/Class;Z)J"),
328 NATIVE_METHOD(VMDebug, crash, "()V"),
329 NATIVE_METHOD(VMDebug, dumpHprofData, "(Ljava/lang/String;Ljava/io/FileDescriptor;)V"),
330 NATIVE_METHOD(VMDebug, dumpHprofDataDdms, "()V"),
331 NATIVE_METHOD(VMDebug, dumpReferenceTables, "()V"),
332 NATIVE_METHOD(VMDebug, getAllocCount, "(I)I"),
Hiroshi Yamauchi09b07a92013-07-15 13:17:06 -0700333 NATIVE_METHOD(VMDebug, getHeapSpaceStats, "([J)V"),
Elliott Hughes9d5ccec2011-09-19 13:19:50 -0700334 NATIVE_METHOD(VMDebug, getInstructionCount, "([I)V"),
Ian Rogers53b8b092014-03-13 23:45:53 -0700335 NATIVE_METHOD(VMDebug, getLoadedClassCount, "!()I"),
Elliott Hughes9d5ccec2011-09-19 13:19:50 -0700336 NATIVE_METHOD(VMDebug, getVmFeatureList, "()[Ljava/lang/String;"),
337 NATIVE_METHOD(VMDebug, infopoint, "(I)V"),
Ian Rogers53b8b092014-03-13 23:45:53 -0700338 NATIVE_METHOD(VMDebug, isDebuggerConnected, "!()Z"),
339 NATIVE_METHOD(VMDebug, isDebuggingEnabled, "!()Z"),
Jeff Hao64caa7d2013-08-29 11:18:01 -0700340 NATIVE_METHOD(VMDebug, getMethodTracingMode, "()I"),
Ian Rogers53b8b092014-03-13 23:45:53 -0700341 NATIVE_METHOD(VMDebug, lastDebuggerActivity, "!()J"),
342 NATIVE_METHOD(VMDebug, printLoadedClasses, "!(I)V"),
Elliott Hughes9d5ccec2011-09-19 13:19:50 -0700343 NATIVE_METHOD(VMDebug, resetAllocCount, "(I)V"),
344 NATIVE_METHOD(VMDebug, resetInstructionCount, "()V"),
345 NATIVE_METHOD(VMDebug, startAllocCounting, "()V"),
346 NATIVE_METHOD(VMDebug, startEmulatorTracing, "()V"),
347 NATIVE_METHOD(VMDebug, startInstructionCounting, "()V"),
Jeff Hao23009dc2013-08-22 15:36:42 -0700348 NATIVE_METHOD(VMDebug, startMethodTracingDdmsImpl, "(IIZI)V"),
Jeff Hao4044bda2014-01-06 15:50:45 -0800349 NATIVE_METHOD(VMDebug, startMethodTracingFd, "(Ljava/lang/String;Ljava/io/FileDescriptor;IIZI)V"),
350 NATIVE_METHOD(VMDebug, startMethodTracingFilename, "(Ljava/lang/String;IIZI)V"),
Elliott Hughes9d5ccec2011-09-19 13:19:50 -0700351 NATIVE_METHOD(VMDebug, stopAllocCounting, "()V"),
352 NATIVE_METHOD(VMDebug, stopEmulatorTracing, "()V"),
353 NATIVE_METHOD(VMDebug, stopInstructionCounting, "()V"),
354 NATIVE_METHOD(VMDebug, stopMethodTracing, "()V"),
Ian Rogers53b8b092014-03-13 23:45:53 -0700355 NATIVE_METHOD(VMDebug, threadCpuTimeNanos, "!()J"),
Elliott Hughes9d5ccec2011-09-19 13:19:50 -0700356};
357
Elliott Hughes9d5ccec2011-09-19 13:19:50 -0700358void register_dalvik_system_VMDebug(JNIEnv* env) {
Elliott Hugheseac76672012-05-24 21:56:51 -0700359 REGISTER_NATIVE_METHODS("dalvik/system/VMDebug");
Elliott Hughes9d5ccec2011-09-19 13:19:50 -0700360}
361
362} // namespace art