当前位置:网站首页>使用华为性能管理服务,按需配置采样率
使用华为性能管理服务,按需配置采样率
2022-07-02 07:16:00 【华为开发者论坛】
Android应用里使用了华为AppGallery Connect提供的性能管理服务,用来监控Android App的性能数据,其中调试APM的时候,从日志上来看,性能管理SDK里,有很多CPUMemoryEvent 的事件。还未集成性能管理服务的可以先参考文档配合Github Demo尝试接入。
从logccat上报的事件来看,上报的频率还是很高的,担心采集的频率过高,会占用手机CPU的资源,导致设备和应用都卡顿。 所以在研究如何配置性能管理SDK的采样率。
下面是配置华为性能管理的采样率的步骤和相关截图。
1、官方文档描述:
首先查看华为文档中,配置采样率的文档,是在“添加自定义监控配置”里面,隐藏的比较深,链接地址点击此处。
主要涉及三块,设置会话采样率、前台的CPU采集频率、前台的内存采集频率。
2、配置步骤
1、配置会话采样率
先介绍一下会话:每一次用户使用APP的时候,就是一次会话。比如你 应用启动或App切换到前台开始,到退出应用或切换到后台的过程,就是一次会话
会话采样率指一次会话采集的概率,默认为1%。采样率越高的情况下,则会提高还原问题发生时的设备信息和用户交互轨迹的概率,
配置的情况如下:打开应用的Manifest文件,在<application>标签里面配置如下data:
<meta-data
android:name="sessions_sampling_percentage"
android:value="1.0" />
其中的数字就代表百分比。
2、配置应用在前台的CPU采集频率
从名字意思就好理解,就是配置App在前台时候的CPU采样率。
打开应用的Manifest文件,在<application>标签里面配置如下data:
<meta-data
android:name="collect_cpu_frequency_fg_ms"
android:value="100" />
其中的数字单位是ms,上面配置的是100ms,表示每100ms采样一次。
3、配置应用在前台的内存采集频率
就是配置App在后台时候的CPU采样率,一般会配置更低一点,防止占用CPU资源。
<meta-data
android:name="collect_memory_frequency_fg_ms"
android:value="200" />
其中数字的单位也是ms,比如我上述写的,就是每200ms采样一次。
欲了解更多详情,请参见:
华为官网:
https://developer.huawei.com/consumer/cn/forum/topic/0201640794525030131?fid=0101271690375130218?ha_source=zzh
边栏推荐
- The nanny level tutorial of flutter environment configuration makes the doctor green to the end
- 软件产品管理系统有哪些?12个最佳产品管理工具盘点
- Retrofit's callback hell is really vulnerable in kotlin synergy mode!
- [Lua] summary of common knowledge points (including common interview sites)
- SPSS做Shapiro-Wilk正态分析
- 《实习报告》Skywalking分布式链路追踪?
- HDU1236 排名(结构体排序)
- 对话吴纲:我为什么笃信“大国品牌”的崛起?
- [unity3d] production progress bar - make image have the functions of filled and sliced at the same time
- js数组常用方法
猜你喜欢
随机推荐
学习open62541 --- [66] UA_String的生成方法
2. Hacking lab script off [detailed writeup]
"Talking about podcasts" vol.352 the age of children: breaking the inner scroll, what can we do before high school?
MongoDB 学习整理(条件操作符,$type 操作符,limit()方法,skip() 方法 和 sort() 方法)
Oracle notes
The URL in the RTSP setup header of the axis device cannot take a parameter
Kustomize user manual
Importing tables from sqoop
02-taildir source
4.随机变量
高考的意义是什么
Thanos Receiver
Use WinDbg to statically analyze dump files (summary of practical experience)
MySQL lethal serial question 4 -- are you familiar with MySQL logs?
快速做出原型
MySQL environment configuration
Internet News: Tencent conference application market was officially launched; Soul went to Hong Kong to submit the listing application
14.信号量的代码实现
2.hacking-lab脚本关[详细writeup]
JSP webshell免杀——webshell免杀