1 /* 2 * Copyright (C) 2007 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 17 package org.apache.harmony.dalvik.ddmc; 18 19 import dalvik.annotation.optimization.FastNative; 20 21 /** 22 * Declarations for some VM-internal DDM stuff. 23 */ 24 public class DdmVmInternal { 25 26 /* do not instantiate */ 27 private DdmVmInternal() {} 28 29 /** 30 * Enable thread notification. 31 * 32 * This is built into the VM, since that's where threads get managed. 33 */ 34 native public static void threadNotify(boolean enable); 35 36 /** 37 * Enable heap info updates. 38 * 39 * This is built into the VM, since that's where the heap is managed. 40 * 41 * @param when when to send the next HPIF chunk 42 * @return true on success. false if 'when' is bad or if there was 43 * an internal error. 44 */ 45 @FastNative 46 native public static boolean heapInfoNotify(int when); 47 48 /** 49 * Enable heap segment updates for the java (isNative == false) or 50 * native (isNative == true) heap. 51 * 52 * This is built into the VM, since that's where the heap is managed. 53 */ 54 native public static boolean heapSegmentNotify(int when, int what, 55 boolean isNative); 56 57 /** 58 * Get status info for all threads. This is for the THST chunk. 59 * 60 * Returns a byte array with the THST data, or null if something 61 * went wrong. 62 */ 63 native public static byte[] getThreadStats(); 64 65 /** 66 * Get a stack trace for the specified thread ID. The ID can be found 67 * in the data from getThreadStats. 68 */ 69 native public static StackTraceElement[] getStackTraceById(int threadId); 70 71 /** 72 * Enable or disable "recent allocation" tracking. 73 */ 74 native public static void enableRecentAllocations(boolean enable); 75 76 /* 77 * Return a boolean indicating whether or not the "recent allocation" 78 * feature is currently enabled. 79 */ 80 @FastNative 81 native public static boolean getRecentAllocationStatus(); 82 83 /** 84 * Fill a buffer with data on recent heap allocations. 85 */ 86 @FastNative 87 native public static byte[] getRecentAllocations(); 88 } 89 90