当前位置:网站首页>QPM performance monitoring components - General
QPM performance monitoring components - General
2022-06-26 09:27:00 【gdky005】
QPM (Quality Performance Monitor) Is a quality performance monitoring component , You can easily view the current App Performance and common data . At present, it mainly runs in Android On the platform , Through integration QPM Components , Can be in App Visualization of relevant real-time data through the suspension window . It is intended to help developers and test students quickly understand App Performance issues in the , And show a lot of commonly used data , Reduce numerous and complex operations .
After several months of program research , Constant optimization , And build iteration and testing , At present, it has stabilized . In Beijing, 2018 year GDG The performance optimization component was shared in the activity , And I have done a deep level of sharing and discussion internally , The functions you need , Plus finishing , Only for more convenient service to the masses Android developer . Now? QPM Official announcement of open source :
https://github.com/ZhuoKeTeam/QPM
Welcome to Star, No matter what strange ideas or ideas you have , We are looking forward to . Enjoy Issue and PR, Although not completely satisfied , But we will try our best .
QPM What we have now :
- Get basic information commonly used by mobile phones ( whether root, Version number ,wifi, Hardware information, etc ).
- Get current in real time App Of CPU And memory information , It can be used to judge whether the mobile phone takes up more resources .
- UI Interface card , Just look FPS( Green means normal , Red means carton ).
- Easy access to currently running Activity name , Quickly locate the current interface in the code .
- App How many threads are currently open , It can be used to judge whether too many resources are occupied .
- see App After running in 3G,4G Traffic consumption of .
- monitor H5 page , It can be judged White screen time and Resource request time .
- Components can be used when it is not convenient to capture packets Show API Interface , The request address will be recorded , Server related status code ,Cookie, Return the data .
- Get the current App Of AndroidManifest.xml Information , You can view the four commonly used components , And registration rights , And you can jump directly to the corresponding Activity On the page .
- Exemption Root You can get App All of the SharedPreferences Store information , also Modifiable . Easy to develop and test and quickly locate problems .
- Screen Recording , The process of solving problems that cannot be reproduced in some scenarios .
origin
Once I was like you , Business development all day , Every day except for working overtime , Or working overtime . But? ,bug Still keep , Look at others app So smooth , Why am I so frustrated ?What’s fuck! gradual , After mastering some performance optimization skills , Skilled in optimization ,app It's no longer so stuck , Looking at the masterpiece , My heart is full of joy .
origin ——GT
At that time, I saw Tencent GT Suspended window , Make an impression , This thing works well , Good good . But the time is over , You must install one for each mobile phone to view data GT, And some functions need root You can view it later . I think we app If you can show some constant data in GT The floating window is much more convenient , So try to put GT Put it on us App Go inside , This process is extremely cumbersome , Finally, it was added , As a result, our App Directly increases 3MB, Although our App already 70MB 了 , increase 3MB It's okay. , But I can't stand it , A component needs to be added 3MB Well ? So I want to combine with us App Characteristics of , Make one of your own QPM, The function is very simple , Some of the GT The data inside is displayed to QPM in , So reference GT, Start implementing .
The wheel already has , Why build a new wheel ? It's not , Although there are wheels , But this wheel doesn't match my model number , Can not play to the extreme . So refer to the general frame of the wheel , Transformed into our own wheels . Stick a lace , Change a screw , Get a small one . Ha ha ha , Finally, a simple version was made , But it's too rough , We don't want to use it ourselves .
origin ——FPS
Suddenly take over an old project , I don't know much about anything , although UI Interface card , But it cannot be easily optimized , In case of optimization , How to carry the pot ? Let's do it first , Until one day the boss said that the card was not good , Must be optimized . ok , Let's optimize it slowly . But I have no spectrum in my heart , How to calculate optimization ? There are no indicators , It's really hard to do . If there is a tool that can tell me which interface cards ? To what extent , What effect can be achieved after optimization , How nice . On some mobile phones, the system comes with FPS indicators , But there are no other mobile phones , You can't use this mobile phone as a criterion .
origin —— To the top of the stack Activity name
I remember looking at my colleagues' mobile phones before , Every time you open one App, Can display the current App The package name of and the current Activity Name , I feel very good , But it's no use . He said :『 I came to , The boss assigned some tasks , But I'm not familiar with the code , How to check the specific page , Not very convenient , With this, you can easily handle it !』 That makes sense , You can add one . One day I was repairing bug When , I can't find the page , I want to ask business students , Which page is this , He directly asked me to use the command line to get the top of the stack Activity name , The plug-in application mentioned by my colleagues before , Need to climb over the wall to download . From now on , I am determined to add this function to my QPM in , I want people who have had the same problems as me , Save the trouble . Every little progress , Then looking back, it was a big step .
origin —— Screen Recording
The functions are almost the same , Suddenly one day , A test student , Threw a small video to the group , Is the emergence of a bug In the video , Using another mobile phone to record the screen . I was wondering if I could add this to QPM Just inside . Come here for a few days , There is a problem on my mobile phone , I use Xiaomi's own screen recording tool , It was easy to record , Send it to the big guys . But the boss asked me , How to record ? I said to use the tools provided by the system , He said he couldn't record , Then let him download the software to record . This process feels very troublesome , It strengthened my determination . After inquiry, it turns out that Android 5.0 The above system provides methods , Then I'll put it directly in our QPM in , After that, you need to take a screenshot , But there is no tool at hand , You can turn it on directly QPM Recorded , It is another awesome function .
Thinking before preparing for optimization
Can repetitive work be reduced ?
Must be able to !
Repeat the same work every day , Go round and begin again , boring , Therefore, automatic operation is derived , Like scripts , Tools etc. , So that people can save time , Do more .
Android How to optimize performance ?
- Grab the bag : Charles,Fiddler, Wireshark;
- Android Studio: DDMS, Logcat;
- Android Studio in Profiler Of Memory , Traffic ,CPU;
- Android There are many auxiliary tools in the developer options of mobile phones .
These tools all have a premise , Many of them need a mobile phone to connect to a data cable , Open the tool again to use , If there is a problem with the customer's mobile phone , If so , It takes a lot of effort . For not root Your cell phone needs to get some information , It's really not easy. .
Can test students monitor performance optimization ?
Sure , But there are many business tests and requirements every day , The test students are not free , No energy to test the performance of this aspect . Unless there is a professional performance testing team , Be responsible for testing every day . Mobile phone fever , Interface jams need to be monitored .
function App You can view the performance
Everyone works overtime , Add some , Busy demand , There is not so much time to look at performance issues , It can be processed at several key time points at most . If our App After operation , There is a built-in function , Just turn on the switch , You can suspend the window to the main interface , according to FPS, Memory ,CPU, It would be better to check the jam condition of a detection page .
Optimization of power assisted performance of suspended window
Let's try to make some floating window functions that can be visualized , It can display some basic performance index data .
start-up App Then you can see some data , Unresolved root The mobile phone can't get data .
Package name
One apk There will be a fixed package name , But in some special situations , Multiple package names will be displayed , for example : Test package , Official package , Variant package , Push test package, etc , to QPM Show the package name of the current application , It is convenient for us to locate the problem at some time . for instance : We have been testing the push package before , Sometimes you need to switch to the official package , Switch between the two packages RD,ST Environmental Science , Finally, I don't remember what bag I used , Can only uninstall , reinstall .QPM The floating window of can directly display the package name of the current application , You can see it at a glance , In fact, the current process can also be + The thread number is printed , It is convenient for students to analyze problems .
At present Activity Name
Just imagine , Did 5 Years of the project , Let the newcomer take over ? Or a colleague leaves , Drop a pile of holes , I need you to fill the hole . After sorting out the process according to the code , It may not be able to take over immediately , If you look for Activity, One word ———— tired !
If you can directly display the current interface Activity name , Is it easier ?
CPU and Memory
Why is the interface so blocked , Quickly optimize . You may wonder where to start ? First render from the interface , Or from a business perspective ? The key is that we need to know what scenarios on the page will cause problems , It is easy to judge if there is an intuitive indicator . When CPU arrive 200% When , Memory explosion , There must be a problem , You can use performance tools to analyze this page in detail . Generally, first look at the interface CPU and Whether the memory is abnormal , Combine with the business logic to obtain the relevant data in advance or delay , Reduce concurrent access at the same time , So as to reduce the jamming of the main interface .
Number of threads
What the hell is this ? I still remember that the boss once said to reuse threads , Don't do it alone . If you find that 200 Multiple threads , Then you have to consider whether you need a thread pool . It can be handled according to the existing logic , Not absolute .
Activity Stack
Remember just learning Activity At that time ,Activity Of Four kinds of LaunchMode, Here you can record a stack of Activity The order of . It is convenient for you to intuitively understand the situation in the stack .
Traffic
We App How much traffic did your request use ? May be in 3G/4G More concerns , Although most of them are now WIFI, But our users will use under certain circumstances 3G/4G, So I still have to pay attention .
How about the network ? For example, I use Wifi, The Internet speed is poor in some corners , There is not even traffic data , We all hope to know .
At some point , The page is blank ? Why is there no data , You can try to see the download speed .
Especially for some small videos that have been invited more and more , You may be concerned about how much traffic is used .
Screen Recording
be based on Android 5.0 Of API, Record the entire screen , It is convenient for you to repeat some questions about operation records .
monitor H5 page
It needs to be matched with the corresponding settings , We can do that WebView Asynchronously detect any web page in , For example, get the current page address , Homepage white screen loading time , And the request time for each resource , And request resource addresses . Very easy to .
Five customized external styles
A unique identifier for , It means a item, If you want to add multiple , The unique identifier can be set to different .
- Large file box style
QPMManager.getInstance().showBigText(flag, bigText);
The first parameter flag It's the only sign , the second bigText Is to customize all text data displayed in the floating window .
- Key value pair text style
QPMManager.getInstance().showKeyValue(flag, key, value);
The first parameter flag It's the only sign , the second key Is displayed in the custom floating window key value , The third is In the suspended window value value .
- Key graph style
QPMManager.getInstance().showKeyPic(flag, key, picRes);
The first parameter flag It's the only sign , the second key Is displayed in the custom floating window key value , The third is In the suspended window pic Res Resource values in .
- Graph value style
QPMManager.getInstance().showPicValue(flag, picId, value);
The first parameter flag It's the only sign , the second key Is displayed in the custom floating window key value , The third is In the suspended window pic Res Resource values in ( You can put it in your Lord App in ).
- Custom style
QPMManager.getInstance().showCustom(flag,QPMTemplateCustomRenderer);
The first parameter flag It's the only sign , the second QPMTemplateCustomRenderer It is to customize the layout you want to add in the floating window , You can write a class , Inherited from QPMTemplateCustomRenderer, Implement the methods inside , The corresponding contents can be displayed on the floating window .
Suspension window Set up information
More practical information :
- Basic information of mobile phone
- AndroidManifest.xml Information
- App All of the SharePreference Information
- Configurable switches
- Network interface
Basic information of mobile phone
- No more Go to the complex interface of the mobile phone to view various data ;
- No more download Auxiliary apk pick up information ;
- No more Because some information does not , Query for half a day .
whether Root, SDK edition , Mobile phone model , The Internet , name ,IP,Mac Address , Screen resolution ,CPU Architecture and so on . Encounter key data , It can also be replicated .
The data obtained here is more comprehensive
AndroidManifest.xml Information
Package name , Version number ,App All permissions of , structure SDK Version information for , There are also the four most important registered components (Activity,Service,Receiver,Provider). Inside Activity You can directly click to jump ,Service You can see how many local services there are ,Receiver You can clearly know how many broadcasts are currently registered ,Provider You can view local content providers .
All of the applications SP Information
Root Mobile phone we directly through File manager Can be viewed directly SP file .
without Root Well ? Stupid way , By debugging code or log Printout .
Including the whole App All of the SP Information , You can view individual SP The message inside , Best of all, it can be modified directly Corresponding Value.
Greatly improve the development efficiency of programmers .
Other switches
We provide these basic functions , Turn on the switch , Relevant data information can be displayed directly in the suspension window .
Self control focus , Just focus on the information you need .
All switches , Can open , close , For some operations that affect performance , You can close everything else , Keep the indicators of concern .
For each switch, you can press and hold the switch name , Move up and down , Adjust the switch sequence .
Network interface
Get the latest 50 Network request data , You can see more :
- Request mode ;
- Return status code ;
- The length of the request ;
- Request size ;
- Returns the data size
need OkHttp, Then you can get all the data requested by the network , Including the request Request Header,Request Response,Response Data such as .
Lean mode
Too much data will fill the screen , Thin mode can be enabled , The top two options of the switch list are displayed by default . The switch list can be moved to the first two items by dragging .
QPM matters needing attention
QPM If you open too many functions of the suspension window , May affect performance , recommend : What functions are needed , Just turn on the switch , This will minimize the impact .
QPM With others of the same kind PM The difference between
With others of the same kind QPM Tool comparison , There are the following advantages :
- Any built-in QPM Of App, It can directly visualize relevant performance and data ;
- Built in multiple parameter indicator switches , Drive whatever you want ;
- Lean mode , Only the concerned data indicators are displayed ;
- Five customized templates , It can be done by simple API, Direct will app Dynamic display of changing data ;
- Screen Recording ;
- H5 Page performance monitoring ;
- Display of four components , And you can jump directly to the corresponding Activity in ;
- SharedPreferences Browse and modify the corresponding files directly key value ;
- adopt OkHttp Show relevant network request information ;
- At present App Traffic usage .
Open source address
QPM: https://github.com/ZhuoKeTeam/QPM
Please QPM One Star Well !
边栏推荐
- "One week's work on Analog Electronics" - integrated operational amplifier
- 《一周学习模电》-电容、三极管、场效应管
- 【CVPR 2021】DatasetGAN: Efficient Labeled Data Factory with Minimal Human Effort
- "One week's data collection" - logic gate
- 深度学习(初识tensorflow2.版本)之三好学生成绩问题(1)
- 【CVPR 2019】Semantic Image Synthesis with Spatially-Adaptive Normalization(SPADE)
- Yolov5 results Txt visualization
- The first techo day Tencent technology open day, 628
- Param in the paper
- 《一周搞定数电》-逻辑门
猜你喜欢
Board end power hardware debugging bug
Master data management of scientific research institutes? Suppliers or customers? I am a correspondent
《一周搞定模电》-二极管
Self taught neural network series - 9 convolutional neural network CNN
Detectron2 save (according to maxap50) model during training_ best. PTH weight
Error importerror: numpy core. multiarray failed to import
【CVPR 2021】Unsupervised Pre-training for Person Re-identification(UPT)
[Journal of Computer Aided Design & computer graphics] overview of research on pedestrian re recognition methods based on generated countermeasure network
《一周搞定数电》——组合逻辑电路
《一周搞定模电》—集成运算放大器
随机推荐
"One week to finish the model electricity" - 55 timer
"One week's study of model electricity" - capacitor, triode, FET
GAN Inversion: A Survey
install opencv-contrib-dev to use aruco code
全面解读!Golang中泛型的使用
The most complete and simple nanny tutorial: deep learning environment configuration anaconda+pychart+cuda+cudnn+tensorflow+pytorch
【C】 Frog jumping steps and Hanoi Tower problem (recursion)
php不让图片跟数据一起上传(不再是先上传图片再上传数据)
Regular expression learning
Execution process at runtime
Tutorial 1:hello behavioc
工企专利匹配数据(数十万数据量)1998-2014年
Understanding of swing transformer
【CVPR 2021】 Lifelong Person Re-Identification via Adaptive Knowledge Accumulation
Badge collection 6:api\_ Use of level
"One week to solve the model electricity" - negative feedback
Super data processing operator helps you finish data processing quickly
Badge series 4: use of circle Ci
【CVPR 2019】Semantic Image Synthesis with Spatially-Adaptive Normalization(SPADE)
Course paper: Copula modeling code of portfolio risk VaR