监测Lyft的安卓应用程序的CPU性能

Photo by Michael Dziedzic on Unsplash

摄影:Michael DziedziconUnsplash

?? #StandWithUkraine

?? #与乌克兰站在一起

Android applications such as Lyft’s apps are developed by a large number of contributors. This means that the codebase grows and changes very quickly. Features are constantly being added or improved, and all these modifications can potentially impact the performance of the application. Thus, it is important to understand how the application consumes CPU resources and to see the dynamics of such metrics across product releases.

像Lyft的应用程序这样的Android应用程序是由大量的贡献者开发的。这意味着代码库的增长和变化非常快。功能不断被添加或改进,所有这些修改都有可能影响应用程序的性能。因此,了解应用程序是如何消耗CPU资源的,以及看到这些指标在不同产品版本中的动态变化是很重要的。

What we are trying to achieve

我们正在努力实现的目标

The main idea of the CPU analysis is to track how much load the app puts on the device’s CPU while it’s running. Based on this data, it is possible to obtain average values across product releases, compare them and act accordingly.

CPU分析的主要想法是跟踪应用程序在运行时对设备的CPU造成多大的负荷。基于这些数据,可以获得不同产品版本的平均值,进行比较并采取相应行动。

The primary metric that we are targeting is the relative average CPU usage. This value shows a percentage of how much load the application has put on the CPU between 2 points in time.

我们所针对的主要指标是 相对平均CPU使用率.这个值显示了在2个时间点之间,应用程序对CPU造成的负载的百分比。

How the data is collected

数据是如何收集的

To compute the above value, we must gather many intermediary metrics. There are 2 primary sources for collecting CPU metrics on Android:

为了计算上述数值,我们必须收集许多中间指标。在Android上收集CPU指标有2个主要来源。

  • Reading Linux system files. Since Android is based on the Linux kernel, it keeps the system directory structure from the kernel.
  • 读取Linux系统文件。由于安卓系统是基于Linux内核的,它保留了来自内核的系统目录结构。
  • Using the native system API. This can be called either directly with the C language or using JVM wrappers provided by the Android SDK.
  • 使用本地系统API。这可以用C语言直接调用,也可以使用Android SDK提供的JVM封装器。

Note: The latest Android versions introduced permission limitations for accessing some Linux system files because of security reasons. Therefore, not all CPU monitoring approaches that are available on Linux work on A...

开通本站会员,查看完整译文。

ホーム - Wiki
Copyright © 2011-2025 iteam. Current version is 2.144.1. UTC+08:00, 2025-07-27 02:21
浙ICP备14020137号-1 $お客様$