Skip to content

Commit ef0ca10

Browse files
committed
appium app profiling doc
1 parent 9d69735 commit ef0ca10

File tree

4 files changed

+89
-73
lines changed

4 files changed

+89
-73
lines changed
73.5 KB
Loading

assets/images/appium-app/disk.png

90.9 KB
Loading
40.4 KB
Loading

docs/appium-app-performance.md

Lines changed: 89 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -39,130 +39,146 @@ import {YOUR_LAMBDATEST_USERNAME, YOUR_LAMBDATEST_ACCESS_KEY} from "@site/src/co
3939
})
4040
}}
4141
></script>
42-
When it comes to building an application, tracking its performance is crucial. You can follow the performance of your applications with LambdaTest's Real Device cloud platform on metrics like CPU consumption, network usage and many more. Go through the page below to understand each metric that LambdaTest provides you with.
4342

44-
## Metrics
43+
App performance is critical factor for user satisfaction and adoption. Identifying and resolving bottlenecks early is essential for delivering a high-quality experience but it requires constant monitoring and optimization across various device metrics. LambdaTest’s App Profiling feature helps you to detect and optimize performance issues before release by providing real-time insights into key metrics like CPU usage, memory consumption, and network activity on real devices.
4544

46-
### 1. CPU Consumption
45+
You can enable performance tracking in your existing automation tests with the following capability:
4746

48-
The CPU is responsible for carrying out all the operations in a mobile device. As it is a shared resource, high usage by a single app can affect other running services.
47+
```javascript
48+
"appProfiling" : true;
49+
```
4950

50-
Moreover, high CPU usage can also cause high battery usage. You can work around this by identifying and addressing areas of high CPU usage. This will increase the efficiency of your app and reduce its overall resource utilisation. Reducing the CPU consumption of your application improves performance and provides the user with a smoother experience.
51+
> This feature is available for Appium tests on **iOS and Android (version 9+)**. For full functionality, ensure the `resignApp` capability is set to `true`.
5152
52-
LambdaTest provides you with two metrics in a time-series format representing the following:
53+
<img loading="lazy" src={require('../assets/images/appium-app/app-profiling.png').default} alt="cmd" width="768" height="373" className="doc_img"/>
5354

54-
1. **System CPU Usage (%)**: The total percentage of CPU being used by the entire system
55+
## Basic Summary
56+
Here is a description of each metric from the App Profiling summary:
5557

56-
2. **App CPU Usage (%)**: The share of "System CPU usage" being used by the AUT.
58+
- **Cold Startup Time :** Time taken by the app to launch from a complete shutdown or a non-running state. A lower cold startup time improves user experience, as it reduces wait time when the app is opened for the first time.
59+
- **Hot Startup Time :** Time taken by the app to resume from a background state. A fast hot startup ensures that users can quickly switch between apps without delays.
60+
- **Maximum CPU Utilisation :** It indicates the peak percentage of CPU consumed by the app during its execution. High CPU utilization can affect other processes and contribute to battery drain, so it's important to keep it optimized.
61+
- **Average CPU :** Average CPU utilization gives a more balanced view of the app’s typical CPU usage during a session. This value helps assess the app’s efficiency in resource usage over time.
62+
- **Maximum Memory Usage :** It refers to the highest amount of RAM consumed by the app during the session. Monitoring this metric helps developers ensure that their app doesn't consume excessive memory, which can lead to slower performance or crashes on low-memory devices.
63+
- **Average Memory Usage :** Average memory usage shows the typical amount of memory used by the app. This value is useful for identifying memory leaks and optimizing the overall resource consumption of the application.
64+
- **Maximum Disk Usage :** Highest amount of storage consumed by the app on the device. Keeping disk usage minimal helps improve app performance and ensures better storage management for end users.
65+
- **Average Disk Usage :** It reflects the typical amount of storage space used by the app over time. This metric is important for identifying opportunities to reduce the app’s footprint on the device's storage.
66+
- **Average Frame Rate :** The frame rate measures the smoothness of the app’s graphical rendering. A higher frame rate (measured in frames per second or fps) indicates smoother animations and a better visual experience. A rate close to 60 fps or higher is typically desired for smooth app performance.
67+
- **Network Download/Upload :** This metric tracks the amount of data downloaded and uploaded by the app during the session. Monitoring network usage helps developers optimize how the app handles data transmission to ensure it uses bandwidth efficiently.
68+
- **Application Not Responding :** ANR events occur when the app becomes unresponsive and prompts the user to wait or close the app. A value of zero indicates the app has not faced any ANR issues, which is crucial for maintaining a stable and responsive app. You can also ANR Dumps, and Data logs.
69+
- **App Crashes :** This metric tracks the number of times the app has crashed during the session. Zero crashes indicate that the app is stable, ensuring a reliable user experience.
5770

58-
<img loading="lazy" src={require('../assets/images/appium-app/cpu.png').default} alt="cmd" width="768" height="373" className="doc_img"/>
71+
## Key Performance Metrics
5972

60-
***
73+
### 1. CPU Consumption
74+
The CPU handles all operations within a mobile device. High CPU usage impacts overall system performance and drains the battery faster. By monitoring CPU consumption, you can pinpoint which features are resource-heavy and optimize them for better performance. LambdaTest provides two CPU metrics in a time-series format:
6175

62-
### 2. Memory Consumption
76+
- **System CPU Usage (%):** Total CPU usage across the system.
77+
- **App CPU Usage (%):** CPU usage specific to your app.
6378

64-
Memory or RAM is one of the most critical resources in a mobile device. Identifying areas where your application is consuming more than expected memory is essential.
79+
Using these insights, you can minimize CPU-intensive operations, delivering a smoother user experience and enhancing device efficiency.
6580

66-
You can also identify areas of your application that may be causing memory leaks. Memory leaks can cause your application to consume more and more memory over time, leading to decreased performance and eventually causing the application to crash.
81+
<img loading="lazy" src={require('../assets/images/appium-app/cpu.png').default} alt="cmd" width="768" height="373" className="doc_img"/>
6782

68-
LambdaTest provides you with three metrics in a time-series format representing the following:
83+
### 2. Memory Consumption
84+
RAM is a critical resource for mobile apps. Excessive memory consumption can lead to memory leaks, degraded performance, and application crashes.
6985

70-
1. Memory Consumed by the system (in MB) throughout the session
71-
2. Memory Consumed by your application (in MB) throughout the session
72-
3. Memory Available for use (in MB) throughout the session
86+
LambdaTest offers three memory metrics:
87+
- **System Memory Usage (MB):** Overall memory consumption during the session.
88+
- **App Memory Usage (MB):** Memory consumed by your application.
89+
- **Available Memory (MB):** Remaining memory available for use.
7390

91+
By tracking these, you can optimize memory utilization and prevent crashes caused by memory leaks.
7492
<img loading="lazy" src={require('../assets/images/appium-app/memory.png').default} alt="cmd" width="768" height="373" className="doc_img"/>
7593

76-
***
94+
### 3. Disk Usage
95+
The Disk Usage metric provides insights into how much disk space is being utilized by both the system and the application during a session. Monitoring disk usage is crucial for optimizing storage consumption and ensuring efficient app performance, especially on devices with limited storage capacity.
7796

78-
### 3. Battery
97+
- **System Disk (MB):** Indicates the total amount of disk space used by the entire system, including the operating system and other background processes, displayed in megabytes (MB).
98+
- **App Disk (MB):** Shows the disk space specifically consumed by your application (App Under Test) during the session, helping you track how much space your app is utilizing and whether it might cause storage-related issues.
7999

80-
A high-performing app could also drain the mobile device's battery quickly, affecting the overall usage of the device and its performance.
100+
<img loading="lazy" src={require('../assets/images/appium-app/disk.png').default} alt="cmd" width="768" height="373" className="doc_img"/>
81101

82-
You can monitor the battery drained while using your app and subsequently optimize the features that may contribute to a lot of battery drain, improving the battery life of devices running your app.
102+
### 4. Rendering (Frame Rate)
103+
Smooth rendering directly affects how responsive your app feels to users. Rendering performance is a typical performance issue that any app faces. It is measured at different stages in the app’s lifecycle to ensure that users do not have a bad experience with the app.
83104

84-
<img loading="lazy" src={require('../assets/images/appium-app/battery.png').default} alt="cmd" width="768" height="373" className="doc_img"/>
105+
LambdaTest measures your app's Frames Per Second (FPS) across its lifecycle, which helps you identify performance bottlenecks in rendering and improve user experience.
85106

86-
***
107+
- **Frames Per Second (FPS):** Real-time measurement of rendering performance throughout the session.
87108

88-
### 4. Temperature
89-
90-
You can identify elements that cause the battery to overheat by monitoring the battery temperatures while using your app. This might help you decide which features to optimise first to save energy and prolong the battery life of the devices running your app. You won't have to worry about your smartphone overheating or encountering performance issues due to a heated battery, improving the user experience.
91-
92-
<img loading="lazy" src={require('../assets/images/appium-app/temperature.png').default} alt="cmd" width="768" height="373" className="doc_img"/>
93-
94-
***
95-
96-
### 5. Rendering (Frame Rate)
109+
<img loading="lazy" src={require('../assets/images/appium-app/rendering.png').default} alt="cmd" width="768" height="373" className="doc_img"/>
97110

98-
Rendering performance is a typical performance issue that any app faces. Rendering is measured at different stages in the app’s lifecycle to ensure that users do not have a bad experience with the app.
111+
### 5. Network Usage
112+
Understanding how your app utilizes network resources is essential for optimizing data transfer and ensuring efficient performance.
99113

100-
LambdaTest provides the frames rate or FPS (frames per second) observed throughout the session.
114+
LambdaTest tracks:
115+
- **Download Size (MB):** Amount of data downloaded during the session.
116+
- **Upload Size (MB):** Amount of data uploaded during the session.
101117

102-
<img loading="lazy" src={require('../assets/images/appium-app/rendering.png').default} alt="cmd" width="768" height="373" className="doc_img"/>
118+
This helps you to monitor:
103119

104-
***
120+
- **Data Efficiency:** Optimize data usage to enhance performance and reduce costs.
121+
- **Performance Optimization:** Identify and mitigate high network usage areas that may affect app responsiveness.
105122

106-
### 6. Network Usage
107-
108-
Tracking the amount of data your app sends and receives can help you understand how it uses the network. By looking at this data over time, you can see when and how your app sends data and use it to make code changes to improve its performance.
123+
<img loading="lazy" src={require('../assets/images/appium-app/network.png').default} alt="cmd" width="768" height="373" className="doc_img"/>
109124

110-
You can use your application to monitor how much data it operates on an actual device, which can help you identify and optimise areas of high network usage.
125+
### 6. Battery Consumption
126+
Apps that consume excessive battery negatively affect user experience. With LambdaTest, you can monitor how your app impacts battery drain, identify features that are energy hogs, and optimize them. This will help extend battery life for devices running your app.
111127

112-
LambdaTest provides the following information to capture network usage better:
113-
1. Network download size throughout the session in time-series
114-
2. Network upload size throughout the session in time-series
128+
- **Battery Drain Rate:** Amount of battery consumed while using the app.
115129

116-
<img loading="lazy" src={require('../assets/images/appium-app/network.png').default} alt="cmd" width="768" height="373" className="doc_img"/>
130+
<img loading="lazy" src={require('../assets/images/appium-app/battery.png').default} alt="cmd" width="768" height="373" className="doc_img"/>
117131

118-
***
132+
### 7. Temperature Monitoring
133+
High device temperature can degrade performance and harm the user experience. LambdaTest lets you monitor battery temperature during app usage, helping you optimize features causing excessive heat generation and reducing the risk of device overheating.
119134

120-
### 7. ANR (Application Not Responding)
135+
- **Temperature:** Temperature of the device battery during app usage.
121136

122-
Sometimes, your application stops responding, and you receive a pop-up to wait or close the app. Knowing what part of the application's life cycle results in an ANR and in which condition is critical. Such instances can ruin the user experience, especially when inputting any information.
137+
<img loading="lazy" src={require('../assets/images/appium-app/temperature.png').default} alt="cmd" width="768" height="373" className="doc_img"/>
123138

124-
LambdaTest provides information on the number of times your app faced ANR and a dump of logs to find more details quickly. However, this feature is supported only for Android devices for now.
139+
### 8. ANR (Application Not Responding)
125140

126-
***
141+
Sometimes, your application stops responding, and you receive a pop-up to wait or close the app. Application freezes and crashes are frustrating for users. LambdaTest provides detailed logs on ANR events, that helps you diagnose the root causes and eliminate them.
127142

128-
### 8. Application Start-up Time
143+
> Currently, ANR monitoring is available for **Android devices** only.
129144
130-
A faster startup time means a better user experience. By identifying and addressing bottlenecks in the startup process, you can improve the overall performance of your app.
145+
Metrics Provided:
131146

132-
This can result in a more responsive and smoother user experience. Currently, you can view the cold start-up time and hot start-up time separately, with cold start-up time being supported for Android devices.
147+
- **ANR Count:** Number of times the app encountered ANR during the session.
148+
- **Log Dumps:** Detailed logs for each ANR event to aid in troubleshooting.
133149

134-
***
150+
### 9. Application Start-up Time
151+
Application start-up time significantly impacts the first impression and overall user experience. Slow startup times create a poor first impression. LambdaTest tracks both cold and hot startup times for Android devices, giving you the data needed to reduce delays and deliver a faster app launch.
135152

136-
## Starting a Performance Session
153+
## Fetch your App Profiling details via API
154+
LambdaTest provides an API that allows you to programmatically access detailed app profiling metrics captured during your test sessions. By integrating this API into your CI/CD pipelines or automation frameworks, you can fetch real-time data such as CPU usage, memory consumption, disk usage, and network activity for deeper analysis. This enables continuous monitoring and performance optimization without manual intervention.
137155

138-
### Track the Metrics via App Automation
156+
To retrieve profiling details, simply make a request to the LambdaTest API using your **authentication token (username and access key)** and the relevant **session ID**. The response will include comprehensive metrics in JSON format, allowing easy integration with other tools or reporting systems for further insights.
139157

140-
You can track the performance metrics for your application inside an app automation test. The data will be captured at the test level and shown on the test details page. Just add the following capability inside your test, and set it to `true`.
158+
<div className="lambdatest__codeblock">
159+
<CodeBlock className="language-bash">
160+
{`https://${ YOUR_LAMBDATEST_USERNAME()}:${ YOUR_LAMBDATEST_ACCESS_KEY()}@mobile-api.lambdatest.com/mobile-automation/api/v1/sessions/SESSION_ID/log/appmetrics`}
161+
</CodeBlock>
162+
</div>
141163

142-
```javascript
143-
"appProfiling" : true;
144-
```
164+
**Step 1:** Run your app automation test on the Real Device Cloud.
145165

146-
:::tip
147-
The `appProfiling` flag is supported for Appium tests on iOS and Android devices. However, it is only supported on devices with an **Android version >=9** and tests where the `resignApp` capability is not set to `false`.
148-
:::
166+
**Step 2:** Get your **SESSION_ID** from the **Meta Data** section.
167+
<img loading="lazy" src={require('../assets/images/appium-app/meta-data.png').default} alt="cmd" width="768" height="373" className="doc_img"/>
149168

150-
:::note
151-
You can also also use this API to enable the app profiling feature in your tests:
169+
**Step 3:** Replace the `YOUR_SESSION_ID` parameter in the given API with your actual session id.
152170

153-
<div className="lambdatest__codeblock">
154-
<CodeBlock className="language-bash">
155-
{`https://${ YOUR_LAMBDATEST_USERNAME()}:${ YOUR_LAMBDATEST_ACCESS_KEY()}@mobile-api.lambdatest.com/mobile-automation/api/v1/sessions/`}
156-
</CodeBlock>
157-
</div>
171+
<div className="lambdatest__codeblock">
172+
<CodeBlock className="language-bash">
173+
{`https://${ YOUR_LAMBDATEST_USERNAME()}:${ YOUR_LAMBDATEST_ACCESS_KEY()}@mobile-api.lambdatest.com/mobile-automation/api/v1/sessions/YOUR_SESSION_ID/log/appmetrics`}
174+
</CodeBlock>
175+
</div>
158176

159-
:::
177+
**Step 4:** Now go to any API testing platform, and pass the above URL (GET Method) to fetch the relevant results.
160178

161-
A sample output of this test will look like:
179+
<img loading="lazy" src={require('../assets/images/appium-app/app-profiling-api-result.png').default} alt="cmd" width="768" height="373" className="doc_img"/>
162180

163-
<img loading="lazy" src={require('../assets/images/appium-app/app-profiling.png').default} alt="cmd" width="768" height="373" className="doc_img"/>
164181

165-
***
166182

167183
> Got any questions?<br/>
168184
> Please reach out at our <span className="doc\_\_lt" onClick={() => window.openLTChatWidget()}>**24x7 Chat Support**</span> or you could also mail us at [[email protected]](https://support.lambdatest.com/).

0 commit comments

Comments
 (0)