当前位置: 首页>>代码示例>>Java>>正文


Java Debug.getMemoryInfo方法代码示例

本文整理汇总了Java中android.os.Debug.getMemoryInfo方法的典型用法代码示例。如果您正苦于以下问题:Java Debug.getMemoryInfo方法的具体用法?Java Debug.getMemoryInfo怎么用?Java Debug.getMemoryInfo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.os.Debug的用法示例。


在下文中一共展示了Debug.getMemoryInfo方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
}
 
开发者ID:TeamThresh,项目名称:Lantern-sdk,代码行数:17,代码来源:MemoryResource.java

示例2: printMemoryStatus

import android.os.Debug; //导入方法依赖的package包/类
/**
 * 打印当前内存占用日志,方便外界诊断。注意,这会显著消耗性能(约50ms左右)
 *
 * @param tag Used to identify the source of a log message.  It usually identifies
 *            the class or activity where the log call occurs.
 * @param msg The message you would like logged.
 */
public static int printMemoryStatus(String tag, String msg) {
    if (RePluginInternal.FOR_DEV) {
        Debug.MemoryInfo mi = new Debug.MemoryInfo();
        Debug.getMemoryInfo(mi);

        String mit = "desc=, memory_v_0_0_1, process=, " + IPC.getCurrentProcessName() +
                ", totalPss=, " + mi.getTotalPss() +
                ", dalvikPss=, " + mi.dalvikPss +
                ", nativeSize=, " + mi.nativePss +
                ", otherPss=, " + mi.otherPss + ", ";

        return Log.i(tag + "-MEMORY", mit + msg);
    }
    return -1;
}
 
开发者ID:wangyupeng1-iri,项目名称:springreplugin,代码行数:23,代码来源:LogDebug.java

示例3: run

import android.os.Debug; //导入方法依赖的package包/类
@Override
public void run() {
    while(mRunning) {
        mCpuStats.parseTopResults();

        Debug.getMemoryInfo(mi);

        if(mHandler != null) {
            mQosObject.cpuUsage = mCpuStats.getProcessCpuUsage();
            mQosObject.pss = mi.getTotalPss();
            mQosObject.vss = mi.getTotalPrivateDirty();
            mHandler.obtainMessage(VideoPlayerActivity.UPDATE_QOSMESS, mQosObject).sendToTarget();
        }
        try {
            sleep(3);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }
}
 
开发者ID:ksvc,项目名称:ksyhttpcache_android,代码行数:21,代码来源:QosThread.java

示例4: printDeviceInformation

import android.os.Debug; //导入方法依赖的package包/类
public static void printDeviceInformation(Context ctx, PrintWriter out) {
	out.println();
	out.println("Memory Information --------");
	MemoryInfo mem = new MemoryInfo();
	Debug.getMemoryInfo(mem);
	out.println("TotalPss: " + mem.getTotalPss() + "KB");
	out.println("TotalPrivateDirty: " + mem.getTotalPrivateDirty() + "KB");
	out.println("TotalSharedDirty: " + mem.getTotalSharedDirty() + "KB");
	out.println("HeapAllocatedSize: " + Debug.getNativeHeapAllocatedSize() / 1024 + "KB");
	out.println("HeapSize: " + Debug.getNativeHeapSize() / 1024 + "KB");

	out.println();
	out.println("Device Information ---------");
	out.println("manufactor: " + Build.MANUFACTURER);
	out.println("model: " + Build.MODEL);
	out.println("version: " + Build.VERSION.RELEASE);
	out.println("product: " + Build.PRODUCT);
	out.println("hardware: " + Build.HARDWARE);
	out.println("board: " + Build.BOARD);
	out.println("device: " + Build.DEVICE);
	out.println("CPU_ABI: " + Build.CPU_ABI);
	out.println("CPU_ABI2: " + Build.CPU_ABI2);

	out.println();
	out.println("Display Information --------");
	DisplayMetrics dm = ctx.getResources().getDisplayMetrics();
	out.println("Width: " + dm.widthPixels);
	out.println("Height: " + dm.heightPixels);
	out.println("Density: " + dm.density);
	out.println("DPI: " + dm.densityDpi);
	out.println("ScaledDensity: " + dm.scaledDensity);

}
 
开发者ID:ROKOLabs,项目名称:ROKO.Stickers-Android,代码行数:34,代码来源:CrashMonitor.java

示例5: memoryOK

import android.os.Debug; //导入方法依赖的package包/类
private boolean memoryOK() {
    ActivityManager.MemoryInfo mi = new ActivityManager.MemoryInfo();
    ActivityManager activityManager = (ActivityManager) getSystemService(ACTIVITY_SERVICE);
    activityManager.getMemoryInfo(mi);

    Debug.MemoryInfo md = new Debug.MemoryInfo();
    Debug.getMemoryInfo(md);
    Runtime rt = Runtime.getRuntime();
    long used_memory = md.getTotalPss() / 1024;
    long max_memory = rt.maxMemory() / (1024 * 1024);
    return true;
    //return (max_memory - used_memory) > MEMORY_LIMIT;
}
 
开发者ID:bbodin,项目名称:slambench-android,代码行数:14,代码来源:BenchmarkActivity.java

示例6: getMemoryInfo

import android.os.Debug; //导入方法依赖的package包/类
public static MemoryInfo getMemoryInfo() {
	/* Lazy allocation. */
	if (SystemUtils.sMemoryInfo == null) {
		SystemUtils.sMemoryInfo = new MemoryInfo();
	}

	Debug.getMemoryInfo(SystemUtils.sMemoryInfo);

	return SystemUtils.sMemoryInfo;
}
 
开发者ID:ArturVasilov,项目名称:AndroidCourses,代码行数:11,代码来源:SystemUtils.java

示例7: getMemoryInfo

import android.os.Debug; //导入方法依赖的package包/类
public static void getMemoryInfo(Debug.MemoryInfo mi) {
	Debug.getMemoryInfo(mi);
}
 
开发者ID:imknown,项目名称:IMKBaseFrameworkLibrary,代码行数:4,代码来源:DeviceUtil.java

示例8: a

import android.os.Debug; //导入方法依赖的package包/类
public static rgv a()
{
  Debug.MemoryInfo localMemoryInfo = new Debug.MemoryInfo();
  Debug.getMemoryInfo(localMemoryInfo);
  return a(localMemoryInfo);
}
 
开发者ID:ChiangC,项目名称:FMTech,代码行数:7,代码来源:gec.java

示例9: Allocated

import android.os.Debug; //导入方法依赖的package包/类
/**
 * 
 * @return - The amount of memory in MB that is currently allocated to this app.
 */
public static double Allocated() {				
	Debug.MemoryInfo memInfo = new Debug.MemoryInfo();
	Debug.getMemoryInfo(memInfo);
	return new Double(memInfo.getTotalPss()/1024/1024);
}
 
开发者ID:roadlabs,项目名称:alternate-java-bridge-library,代码行数:10,代码来源:MemUtil.java

示例10: Free

import android.os.Debug; //导入方法依赖的package包/类
/**
 * 
 * @return - The amount of free memory left in this heap (in MB)
 */
public static double Free() {		
	Debug.MemoryInfo memInfo = new Debug.MemoryInfo();
	Debug.getMemoryInfo(memInfo);
	return new Double((Runtime.getRuntime().maxMemory() - memInfo.getTotalPss())/1024/1024);
}
 
开发者ID:roadlabs,项目名称:alternate-java-bridge-library,代码行数:10,代码来源:MemUtil.java

示例11: getNativeMemoryInfo

import android.os.Debug; //导入方法依赖的package包/类
public static int getNativeMemoryInfo() {
    Debug.MemoryInfo memoryInfo = new Debug.MemoryInfo();
    Debug.getMemoryInfo(memoryInfo);


    return memoryInfo.nativePss;
}
 
开发者ID:FacePlusPlus,项目名称:MegviiFacepp-Android-SDK,代码行数:8,代码来源:UiTest.java

示例12: printAvailableMemory

import android.os.Debug; //导入方法依赖的package包/类
private void printAvailableMemory() {


        ActivityManager.MemoryInfo mi = new ActivityManager.MemoryInfo();
        ActivityManager activityManager = (ActivityManager) getSystemService(ACTIVITY_SERVICE);
        activityManager.getMemoryInfo(mi);

        Debug.MemoryInfo md = new Debug.MemoryInfo();
        Debug.getMemoryInfo(md);

        Runtime rt = Runtime.getRuntime();

        long availableMegs = mi.availMem / 1048576L;

        long used_memory = md.getTotalPss() / 1024;
        long max_memory = rt.maxMemory() / (1024 * 1024);

        MessageLog.addInfo("Used memory:" + Long.toString(used_memory) + "Mo" + " max app memory:" + Long.toString(max_memory) + "Mo" + " available memory:" + Long.toString(availableMegs) + "Mo");

        MessageLog.addDebug(
                " dalvikPss:" + Long.toString(md.dalvikPss) + "Ko" +
                        " nativePss:" + Long.toString(md.nativePss) + "Ko" +
                        " otherPss:" + Long.toString(md.otherPss) + "Ko"
        );

        MessageLog.addDebug(
                " NativeHeapAllocatedSize:" + Debug.getNativeHeapAllocatedSize() / 1048576L + "Mo" +
                        " NativeHeapSize:" + Debug.getNativeHeapSize() / 1048576L + "Mo");

    }
 
开发者ID:bbodin,项目名称:slambench-android,代码行数:31,代码来源:LiveActivity.java


注:本文中的android.os.Debug.getMemoryInfo方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。