Search in sources :

Example 6 with MemoryInfo

use of android.os.Debug.MemoryInfo in project android_frameworks_base by DirtyUnicorns.

the class MemoryUsageTest method getPss.

private int getPss(String processName) {
    ActivityManager am = (ActivityManager) getInstrumentation().getContext().getSystemService(Context.ACTIVITY_SERVICE);
    List<RunningAppProcessInfo> apps = am.getRunningAppProcesses();
    for (RunningAppProcessInfo proc : apps) {
        if (!proc.processName.equals(processName)) {
            continue;
        }
        int[] pids = { proc.pid };
        MemoryInfo meminfo = am.getProcessMemoryInfo(pids)[0];
        return meminfo.getTotalPss();
    }
    return -1;
}
Also used : MemoryInfo(android.os.Debug.MemoryInfo) RunningAppProcessInfo(android.app.ActivityManager.RunningAppProcessInfo) ActivityManager(android.app.ActivityManager) IActivityManager(android.app.IActivityManager)

Example 7 with MemoryInfo

use of android.os.Debug.MemoryInfo in project chromeview by pwnall.

the class PerfTraceEvent method savePerfString.

/**
     * Save a perf trace event as a JSON dict.  The format mirrors a TraceEvent dict.
     *
     * @param name The trace data
     * @param id The id of the event
     * @param type the type of trace event (I, S, F)
     * @param includeMemory Whether to include current browser process memory usage in the trace.
     */
private static void savePerfString(String name, long id, EventType type, boolean includeMemory) {
    long timestampUs = (System.nanoTime() - sBeginNanoTime) / 1000;
    MemoryInfo memInfo = null;
    if (includeMemory) {
        memInfo = new MemoryInfo();
        Debug.getMemoryInfo(memInfo);
    }
    savePerfString(name, id, type, timestampUs, memInfo);
}
Also used : MemoryInfo(android.os.Debug.MemoryInfo)

Example 8 with MemoryInfo

use of android.os.Debug.MemoryInfo in project android_frameworks_base by ResurrectionRemix.

the class MemoryUsageTest method getPss.

private int getPss(String processName) {
    ActivityManager am = (ActivityManager) getInstrumentation().getContext().getSystemService(Context.ACTIVITY_SERVICE);
    List<RunningAppProcessInfo> apps = am.getRunningAppProcesses();
    for (RunningAppProcessInfo proc : apps) {
        if (!proc.processName.equals(processName)) {
            continue;
        }
        int[] pids = { proc.pid };
        MemoryInfo meminfo = am.getProcessMemoryInfo(pids)[0];
        return meminfo.getTotalPss();
    }
    return -1;
}
Also used : MemoryInfo(android.os.Debug.MemoryInfo) RunningAppProcessInfo(android.app.ActivityManager.RunningAppProcessInfo) ActivityManager(android.app.ActivityManager) IActivityManager(android.app.IActivityManager)

Aggregations

MemoryInfo (android.os.Debug.MemoryInfo)8 ActivityManager (android.app.ActivityManager)7 RunningAppProcessInfo (android.app.ActivityManager.RunningAppProcessInfo)5 IActivityManager (android.app.IActivityManager)5