当前位置:网站首页>使用华为性能管理服务,按需配置采样率
使用华为性能管理服务,按需配置采样率
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
边栏推荐
- Win11 arm系统配置.net core环境变量
- nodejs+express+mysql简单博客搭建
- P1055 [NOIP2008 普及组] ISBN 号码
- C#中索引器
- Excuse me, is it cost-effective to insure love life patron saint 2.0 increased lifelong life insurance? What are the advantages of this product?
- Flutter——Canvas自定义曲线图
- 转换YV12到RGB565图像转换,附YUV转RGB测试
- 14.信号量的代码实现
- SPSS做Shapiro-Wilk正态分析
- 面对不确定性,供应链的作用
猜你喜欢
axis设备的rtsp setup头中的url不能带参
Read H264 parameters from mediarecord recording
VSCode工具使用
Shapiro Wilk normal analysis by SPSS
从MediaRecord录像中读取H264参数
"Matching" is true love, a new attitude for young people to make friends
Internet News: Tencent conference application market was officially launched; Soul went to Hong Kong to submit the listing application
Shutter - canvas custom graph
Session cookies and tokens
Dialogue Wu Gang: why do I believe in the rise of "big country brands"?
随机推荐
面对不确定性,供应链的作用
Easyexcel, a concise, fast and memory saving excel processing tool
JSP webshell免殺——JSP的基礎
The nanny level tutorial of flutter environment configuration makes the doctor green to the end
Redis set password
Session cookies and tokens
Sus system availability scale
Windows环境MySQL8忘记密码文件解决方案
Mongodb quickly get started with some simple operations of mongodb command line
从MediaRecord录像中读取H264参数
6种单例模式的实现方式
Pywin32打开指定窗口
Leetcode+ 76 - 80 storm search topic
HDU1228 A + B(map映射)
[MySQL] an exception occurs when connecting to MySQL: connection must be valid and open
[Fantasy 4] introduction and use of UMG components (under update...)
UVM - usage of common TLM port
MySQL environment configuration
UVM learning - build a simple UVM verification platform
Retrofit's callback hell is really vulnerable in kotlin synergy mode!