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