Kể từ ngày 27 tháng 3 năm 2025, bạn nên sử dụng android-latest-release
thay vì aosp-main
để xây dựng và đóng góp cho AOSP. Để biết thêm thông tin, hãy xem phần Thay đổi đối với AOSP.
Công cụ hiệu suất hệ thống
Sử dụng bộ sưu tập để sắp xếp ngăn nắp các trang
Lưu và phân loại nội dung dựa trên lựa chọn ưu tiên của bạn.
Trang này mô tả các công cụ mà bạn có thể sử dụng để đo lường các chỉ số hiệu suất.
Thời gian khởi động
Để phân tích thời gian khởi động, hãy sử dụng tài liệu về Simpleperf.
Tệp config.yaml
để đưa vào các sự kiện mà bạn muốn tìm kiếm. config.yaml
sẽ xuất hiện như sau:
stop_event: <logcat log message which will terminate log collection after reboot>
events:
event1_name: <pattern that matches log message>
event2_
...
Trên một số thiết bị, việc khởi động đồng hồ có thể hiển thị thời gian không chính xác trong vài giây đầu tiên. Mặc dù công cụ bootanalyze có thể hỗ trợ tính năng chỉnh sửa thời gian ngay từ đầu, nhưng bạn có thể cung cấp mẫu chỉnh sửa thời gian không bắt buộc trong config.yaml
.
Tối ưu hoá thời gian khởi động giải thích cách cải thiện thời gian khởi động bằng các thành phần như Trình tải khởi động, Hạt nhân thiết bị, Điều chỉnh I/O, Ảnh động khởi động và chính sách SELinux.
Thời gian khởi động ứng dụng
Người dùng mong muốn ứng dụng tải nhanh và phản hồi nhanh.
Thời gian khởi động ứng dụng trình bày chi tiết về các yếu tố bên trong trong quy trình khởi chạy và thảo luận về cách phân tích và tối ưu hoá hiệu suất khởi động.
Giao diện người dùng
Kiểm thử hiệu suất giao diện người dùng (UI) đảm bảo rằng ứng dụng của bạn đáp ứng các yêu cầu về chức năng và các hoạt động tương tác của người dùng với ứng dụng diễn ra suôn sẻ, chạy ở tốc độ 60 khung hình/giây nhất quán (xem Mẫu hiệu suất Android: Tại sao nên dùng tốc độ 60 khung hình/giây?) mà không có khung hình nào bị bỏ qua hoặc bị trễ.
Để biết thêm thông tin, hãy xem phần Kiểm thử hiệu suất giao diện người dùng và JankTest.
Bộ nhớ
Bạn có thể kiểm tra mức sử dụng bộ nhớ của ứng dụng theo một trong hai cách:
- Theo thời gian, sử dụng
procstats
.
- Ảnh chụp nhanh tại một thời điểm, sử dụng
meminfo
.
Để biết chi tiết, hãy xem:
Bộ xử lý trung tâm
Bạn có thể sử dụng các công cụ sau để truy vấn CPU.
- Để lập hồ sơ cho ứng dụng Android và quy trình gốc chạy trên Android, hãy sử dụng tài liệu về Simpleperf.
một công cụ lập hồ sơ bộ xử lý trung tâm (CPU) gốc cho Android. Simpleperf có thể lập hồ sơ mã Java và C++ trên Android. Tệp thực thi Simpleperf có thể chạy trên các bản phát hành Android mới hơn L và bạn có thể sử dụng tập lệnh Python trên các bản phát hành Android mới hơn N.
Tài liệu về Simpleperf.
Để biết thông tin chi tiết, hãy xem tài liệu về Simpleperf.
- Để kiểm tra mức sử dụng CPU và hoạt động của luồng trong ứng dụng theo thời gian thực trong khi tương tác với ứng dụng, hãy sử dụng Trình phân tích CPU.
Việc này có nhiều ưu điểm, chẳng hạn như đem lại trải nghiệm người dùng nhanh và hiệu quả, đồng thời duy trì tuổi thọ pin của thiết bị. Ngoài ra, bạn có thể kiểm tra thông tin chi tiết về phương thức, hàm và dấu vết hệ thống đã ghi lại.
Nội dung và mã mẫu trên trang này phải tuân thủ các giấy phép như mô tả trong phần Giấy phép nội dung. Java và OpenJDK là nhãn hiệu hoặc nhãn hiệu đã đăng ký của Oracle và/hoặc đơn vị liên kết của Oracle.
Cập nhật lần gần đây nhất: 2025-07-27 UTC.
[[["Dễ hiểu","easyToUnderstand","thumb-up"],["Giúp tôi giải quyết được vấn đề","solvedMyProblem","thumb-up"],["Khác","otherUp","thumb-up"]],[["Thiếu thông tin tôi cần","missingTheInformationINeed","thumb-down"],["Quá phức tạp/quá nhiều bước","tooComplicatedTooManySteps","thumb-down"],["Đã lỗi thời","outOfDate","thumb-down"],["Vấn đề về bản dịch","translationIssue","thumb-down"],["Vấn đề về mẫu/mã","samplesCodeIssue","thumb-down"],["Khác","otherDown","thumb-down"]],["Cập nhật lần gần đây nhất: 2025-07-27 UTC."],[],[],null,["# System performance tools\n\nThis page describes the tools you can use to measure performance metrics.\n\nBoot time\n---------\n\nTo profile boot timing, use the\n[Simpleperf](https://android.googlesource.com/platform/system/extras/+/android16-release/simpleperf/doc/README.md)\ndocumentation.\n`config.yaml` file to include events you want to search for. `config.yaml`\nshould appear as follows: \n\n```scdoc\n stop_event: \u003clogcat log message which will terminate log collection after reboot\u003e\n events:\n event1_name: \u003cpattern that matches log message\u003e\n event2_\n ...\n```\n\nOn some devices, booting the clock may display an incorrect time for the first few seconds. While\nthe bootanalyze tool can accommodate a time correction out-of-the-box, you can provide an optional\ntime correction pattern in `config.yaml`.\n[Optimizing boot times](/devices/tech/perf/boot-times) explains how to improve boot\ntime using components such as Bootloader, Device Kernel, I/O tuning, Boot animation, and the\nSELinux policy.\n\nApp start-up time\n-----------------\n\nUsers expect apps to be quick to load and responsive.\n[App Startup Time](https://developer.android.com/topic/performance/vitals/launch-time)\ndetails the internals of the launch process and discusses how to profile and optimize startup\nperformance.\n\nUser interface\n--------------\n\nUser interface (UI) performance testing ensures that your app meets functional requirements and\nthat user interactions with your app are smooth, run at a consistent 60 frames per second (see\n[Android\nPerformance Patterns: Why 60fps?](https://www.youtube.com/watch?v=CaMTIgxCSqU&index=25&list=PLWz5rJ2EKKc9CBxr3BVjPTPoDPLdPIFCE)), and all without dropping or delaying frames.\n\nFor more information, see [Test\nUI Performance](https://developer.android.com/training/testing/performance) and\n[JankTest](https://developer.android.com/reference/android/support/test/jank/JankTest).\n\nMemory\n------\n\nYou can inspect app memory usage in one of two ways:\n\n- Over time, using `procstats`.\n- Snapshot in time, using `meminfo`.\n\nFor details, see:\n\n- To measure memory usage, see [View\n Memory Allocations](https://developer.android.com/studio/command-line/dumpsys.html#ViewingAllocations).\n- To use the Android Studio IDE to inspect memory, Android Studio provides a GUI-based memory usage tool. For details, see [View the Java Heap and\n Memory Allocations with Memory Profiler](https://developer.android.com/studio/profile/memory-profiler).\n- To conduct performance instrumentation and tracing on the Linux, Android, and Chrome platform and in user-space apps, use open source [Perfetto](https://perfetto.dev/#/).\n\nCentral processing unit\n-----------------------\n\nYou can use the following tools to query the CPU.\n\n- To profile Android apps *and* native processes running on Android, use [Simpleperf](https://android.googlesource.com/platform/system/extras/+/android16-release/simpleperf/doc/README.md) documentation.\na native central processing unit (CPU) profiling tool for Android. Simpleperf can profile Java and C++ code on Android. The Simpleperf executable can run on Android releases later than L and Python scripts can be used on Android releases later than N. \n\n[Simpleperf](https://android.googlesource.com/platform/system/extras/+/android16-release/simpleperf/doc/README.md) documentation. For details, see the [Simpleperf](https://android.googlesource.com/platform/system/extras/+/android16-release/simpleperf/doc/README.md) documentation.\n- To inspect your app's CPU usage and thread activity in real time while interacting with your app, use the [CPU Profiler](https://developer.android.com/studio/profile/cpu-profiler). Doing so has many advantages, such as providing a faster and smoother user experience and preserving device battery life. In addition, you can inspect the details of recorded method, function, and system traces."]]