本文整理匯總了Java中android.os.Debug.getNativeHeapSize方法的典型用法代碼示例。如果您正苦於以下問題:Java Debug.getNativeHeapSize方法的具體用法?Java Debug.getNativeHeapSize怎麽用?Java Debug.getNativeHeapSize使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類android.os.Debug
的用法示例。
在下文中一共展示了Debug.getNativeHeapSize方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: MemoryResource
import android.os.Debug; //導入方法依賴的package包/類
public MemoryResource() {
memoryInfoList.clear();
memoryInfoList.add(Runtime.getRuntime().maxMemory());
memoryInfoList.add(Runtime.getRuntime().totalMemory());
memoryInfoList.add(Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory());
memoryInfoList.add(Runtime.getRuntime().freeMemory());
this.natHeapSize = Debug.getNativeHeapSize();
this.natHeapFreeSize = Debug.getNativeHeapFreeSize();
this.pss = Debug.getPss();
this.loadedClassCount = Debug.getLoadedClassCount();
this.memoryInfo = new Debug.MemoryInfo();
Debug.getMemoryInfo(memoryInfo);
}
示例2: nativePrintMemory
import android.os.Debug; //導入方法依賴的package包/類
/**
* 打印native內存占用情況
*
* @param info 相關信息
*/
public static void nativePrintMemory(String info) {
if ( !DEBUG_MEMORY) {
return;
}
long totalNativeMemory = Debug.getNativeHeapAllocatedSize();
long freeNativeMemory = Debug.getNativeHeapFreeSize();
long nativeMemory = Debug.getNativeHeapSize();
String content =
info + "-->totalNativeMemory:" + (totalNativeMemory >> 10) + ",freeNativeMemory:" + (freeNativeMemory >> 10) + ",nativeMemory:" + (nativeMemory >> 10) + "\n";
Log.d(
content);
}
示例3: logHeap
import android.os.Debug; //導入方法依賴的package包/類
public static void logHeap() {
Double allocated = new Double(Debug.getNativeHeapAllocatedSize())/new Double((1048576));
Double available = new Double(Debug.getNativeHeapSize())/1048576.0;
Double free = new Double(Debug.getNativeHeapFreeSize())/1048576.0;
DecimalFormat df = new DecimalFormat();
df.setMaximumFractionDigits(2);
df.setMinimumFractionDigits(2);
Log.d("tag", "debug. =================================");
Log.d("tag", "debug.heap native: allocated " + df.format(allocated) + "MB of " + df.format(available) + "MB (" + df.format(free) + "MB free)");
Log.d("tag", "debug.memory: allocated: " + df.format(new Double(Runtime.getRuntime().totalMemory()/1048576)) + "MB of " + df.format(new Double(Runtime.getRuntime().maxMemory()/1048576))+ "MB (" + df.format(new Double(Runtime.getRuntime().freeMemory()/1048576)) +"MB free)");
}
示例4: getHeapNative
import android.os.Debug; //導入方法依賴的package包/類
public static long[] getHeapNative() {
long[] value = new long[2];
value[0] = Debug.getNativeHeapSize() >> 10;
value[1] = Debug.getNativeHeapAllocatedSize() >> 10;
return value;
}
示例5: getNativeHeapSize
import android.os.Debug; //導入方法依賴的package包/類
/** 堆內存大小, 單位 MB */
public static long getNativeHeapSize() {
return Debug.getNativeHeapSize() / 1024 / 1024;
}
示例6: getNativeHeapSize
import android.os.Debug; //導入方法依賴的package包/類
public static long getNativeHeapSize() {
return Debug.getNativeHeapSize() / DataConstants.BYTES_PER_KILOBYTE;
}