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;
}
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);
}
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;
}
Aggregations