Comments (1)
/*
* Stops tracking memory usage, binder transactions, and real & cpu timing.
* Stores collected data as type long into Bundle object for reporting.
*/
private void endPerformanceSnapshot() {
// Stop the timing. This must be done first before any other counting is
// stopped.
mSnapshotCpuTime = Process.getElapsedCpuTime() - mSnapshotCpuTime;
mSnapshotExecTime = SystemClock.uptimeMillis() - mSnapshotExecTime;
stopAllocCounting();
long nativeMax = Debug.getNativeHeapSize() / 1024;
long nativeAllocated = Debug.getNativeHeapAllocatedSize() / 1024;
long nativeFree = Debug.getNativeHeapFreeSize() / 1024;
Debug.MemoryInfo memInfo = new Debug.MemoryInfo();
Debug.getMemoryInfo(memInfo);
Runtime runtime = Runtime.getRuntime();
long dalvikMax = runtime.totalMemory() / 1024;
long dalvikFree = runtime.freeMemory() / 1024;
long dalvikAllocated = dalvikMax - dalvikFree;
// Add final binder counts
Bundle binderCounts = getBinderCounts();
for (String key : binderCounts.keySet()) {
mPerfSnapshot.putLong(key, binderCounts.getLong(key));
}
// Add alloc counts
Bundle allocCounts = getAllocCounts();
for (String key : allocCounts.keySet()) {
mPerfSnapshot.putLong(key, allocCounts.getLong(key));
}
mPerfSnapshot.putLong(METRIC_KEY_EXECUTION_TIME, mSnapshotExecTime);
mPerfSnapshot.putLong(METRIC_KEY_CPU_TIME, mSnapshotCpuTime);
mPerfSnapshot.putLong(METRIC_KEY_NATIVE_SIZE, nativeMax);
mPerfSnapshot.putLong(METRIC_KEY_NATIVE_ALLOCATED, nativeAllocated);
mPerfSnapshot.putLong(METRIC_KEY_NATIVE_FREE, nativeFree);
mPerfSnapshot.putLong(METRIC_KEY_NATIVE_PSS, memInfo.nativePss);
mPerfSnapshot.putLong(METRIC_KEY_NATIVE_PRIVATE_DIRTY, memInfo.nativePrivateDirty);
mPerfSnapshot.putLong(METRIC_KEY_NATIVE_SHARED_DIRTY, memInfo.nativeSharedDirty);
mPerfSnapshot.putLong(METRIC_KEY_JAVA_SIZE, dalvikMax);
mPerfSnapshot.putLong(METRIC_KEY_JAVA_ALLOCATED, dalvikAllocated);
mPerfSnapshot.putLong(METRIC_KEY_JAVA_FREE, dalvikFree);
mPerfSnapshot.putLong(METRIC_KEY_JAVA_PSS, memInfo.dalvikPss);
mPerfSnapshot.putLong(METRIC_KEY_JAVA_PRIVATE_DIRTY, memInfo.dalvikPrivateDirty);
mPerfSnapshot.putLong(METRIC_KEY_JAVA_SHARED_DIRTY, memInfo.dalvikSharedDirty);
mPerfSnapshot.putLong(METRIC_KEY_OTHER_PSS, memInfo.otherPss);
mPerfSnapshot.putLong(METRIC_KEY_OTHER_PRIVATE_DIRTY, memInfo.otherPrivateDirty);
mPerfSnapshot.putLong(METRIC_KEY_OTHER_SHARED_DIRTY, memInfo.otherSharedDirty);
}
from mobileperf.
Related Issues (20)
- android/tools/androiddevice.py中if "MOVE_TO_FOREGROUND" in line语句对华为,一加手机不生效 HOT 2
- no permission to access /data/anr, can't pull log file HOT 1
- 想请教一下,monkey可以和阿里的mitmproxy集成么,比如修改接口的response后,进行monkey HOT 1
- 没有生成fps的结果文档
- Android 10及以上系统,流量是全局流量,而不是当前进程流量
- 使用项目自带的adb,静态list_device方法传参问题 HOT 1
- 没找到upload.py文件,作者可以添加一下吗? HOT 2
- It doesn't work on the secondary process
- 内存统计耗时比较长
- pss_babymonitorplus表格无数据
- 感觉帧率的统计方式有误,一直是24,应用推到后台,显示为0 HOT 4
- 性能稳定性测试工具mobileperf使用总结(Android11下) HOT 1
- 游戏类app的FPS采集到的都是 0 HOT 1
- android10上获取不到流量 HOT 1
- 请问 如何计算帧率,并打印出来呢 HOT 1
- 代码优化:win-pycharm打开report.py 里有报警 HOT 1
- (hprof文件是空的)The hprof file is empty HOT 2
- androiddevice.py在py3.7-pycharm中打开报错 HOT 3
- 针对某个app的冷启动时长是否可以获取到呢?还有网络信息。 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mobileperf.