In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)05/31 Report--
This article mainly introduces how to test the startup time in App, which has a certain reference value, interested friends can refer to, I hope you can learn a lot after reading this article, let the editor take you to know about it.
Background introduction
Android users may often encounter the following problems: 1) the application background is on and the phone dies quickly-- the application consumes a lot of power; 2) the app is launched for the first time / not for the first time, and it is particularly slow to enter the application-slow to start the application; 3) the application becomes more and more stuck during use-insufficient CPU capacity / memory leakage; 4) application page stutter-low frame rate, page stutter. Therefore, the performance of the developed Android application must be tested, otherwise it will directly affect the user experience.
Android application performance testing usually includes: startup time, memory, CPU, power consumption, traffic, fluency and so on. This time first introduces the test method of startup time.
Startup time for App performance testing, startup time is an important indicator, startup time is divided into two cases, one is cold start time (usually system restart, that is, there is no App process before startup), and the other is hot start, that is, App is switched to the foreground (click back to exit and then click the icon to start). When QA testing, generally pay attention to the start time of cold start. The following introduces three methods of testing startup time for your reference and can be used pertinently.
1.1 use the adb command
1.1.1 the test method inputs the adbshell am start-W packagename/MainActivity command to calculate the startup time. As shown below:
Figure 1 the first startup of the application is what we often call cold startup, when the process of your application is not created. This is also the scenario for most applications. After the user clicks on the icon of your application on the desktop, the process must be created before starting MainActivity. At this point, the result returned by adbshell am start-w packagename/MainActivity is the standard startup time of the application. Note that phones before Android 5. 0 do not have the value of WaitTime. The following is the explanation for the difference between ThisTime/TotalTime/WaitTime. WaitTime=endTime-startTime
StartTime recorded the point in time when startActivityAndWait () was about to be called
EndTime records the point in time returned by the startActivityAndWait () function call.
The WaitTime = startActivityAndWait () call takes time.
WaitTime is the total time consuming, including the previous application Activity pause time and the new application startup time; ThisTime indicates that it takes time to start the last Activity in a series of launches of Activity; TotalTime refers to the time spent launching new applications, including the start of new processes and Activity, but excluding the time spent by the previous application Activity pause. In other words, developers generally only need to care about TotalTime, which is the time it takes to start their applications.
To sum up, if you only care about the time-consuming startup of an application, refer to TotalTime;. If you are concerned about the time-consuming startup of the application, refer to WaitTime;. If you are concerned about the time-consuming startup of an application with an interface, refer to ThisTime.
1.1.2 Summary
The time calculated by this method is the time from the time when the system starts to start activity to the time it finishes running layout and draw functions. The simple understanding is the time to start the Activity, which does not include the time from clicking icon to the time when the system receives the message. Obviously, this time can not completely simulate the startup time of the user operation scenario. Secondly, this method only calculates the overall start-up time of an Activity, and does not count the time of each function separately, so it is not convenient to locate the problem. In view of these two problems, let's take a look at how the following two methods are solved.
In fact, what we focused on in the test was the startup time of the user experience, so the above time could not meet our needs. Since it's a user experience, we can use screenrecord for on-screen recording and analyze the video in a more intuitive way.
1.2 use screenrecord for screen recording
1.2.1 Test method (1) input command adb shellscreenrecord-bugreport / sdcard/lanch.mp4--bugreport parameters will make the video output some time information and frame information to facilitate us to analyze the startup time. (2) Click the collection icon, and after app is fully started, use ctrl+c to end video recording. (3) use the command adb pullsdcard/lanch.mp4. /, export the video (4) Export the video to the computer, open it with a video software that can be played by frame (quicktime on mac, kmplayer can be used in win), and play it by frame. As shown in the following figure: figure 3 shows what has been done in each step, you can refer to the following table.
1.3.2 summing up this management, you can clearly see the total time of Activity and the time of each function, so that in the testing process, if you encounter problems, you can easily locate the specific function. There are also specific points during testing. For example, Tieba LVB will be integrated into Tieba in the form of plug-ins. During testing, you can pay more attention to the initialization time of plugin.
For the performance indicator of startup time, I think the way to manage the output log is more ideal. When QA finds a suspected problem in the testing process, it can give a specific function that takes time.
Thank you for reading this article carefully. I hope the article "how to Test Startup time in App" shared by the editor will be helpful to everyone. At the same time, I also hope that you will support and follow the industry information channel. More related knowledge is waiting for you to learn!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.