openharmony 鸿蒙 subsys-toolchain-bytrace-guide

2022-08-09 浏览 (971)

bytrace

Overview

bytrace is a tool for you to trace processes and analyze performance. It encapsulates and extends the kernel ftrace and supports event tracking in the user space. With bytrace, you can open a user-space or kernel-space label you want to view (run the bytrace -l command to query all the supported labels) and run the --trace_begin and -o filename (or --output filename) commands to capture traces and dump them to a specified file.

How to Develop

bytrace supports the following commands:

Table 1 Commands

OptionDescription
-h, --helpViews the help text for bytrace.
-b n, --buffer_size nSets the size of the buffer (KB) for storing and reading traces. The default buffer size is 2048 KB.
-t n, --time nSets the bytrace uptime in seconds, which depends on the time required for analysis.
--trace_clock clockSets the type of the clock for adding a timestamp to a trace, which can be boot (default), global, mono, uptime, or perf.
--trace_beginStarts capturing traces.
--trace_dumpDumps traces to a specified position (console where you run this command by default).
--trace_finishStops capturing traces and dumps traces to a specified position (console where you run this command by default).
-l, --list_categoriesLists the bytrace categories supported by the device.
--overwriteSets the action to take when the buffer is full. If this option is used, the latest traces are discarded; if this option is not used, the earliest traces are discarded (default).
-o filename, --output filenameOutputs traces to a specified file.
-zCompresses a captured trace.

Usage Example

The following are some examples of bytrace commands:

  • Query supported labels.
bytrace -l  

Alternatively, run the following command to query the supported bytrace categories:

bytrace --list_categories
  • Capture traces whose label is ability, with the buffer size set to 4096 KB and bytrace uptime set to 10s.
bytrace -b 4096 -t 10 --overwrite ability > /data/mytrace.ftrace
  • Set the clock type for traces to mono.
bytrace --trace_clock mono -b 4096 -t 10 --overwrite ability > /data/mytrace.ftrace
  • Compress the captured trace.
bytrace -z -b 4096 -t 10 --overwrite ability > /data/mytrace.ftrace

你可能感兴趣的鸿蒙文章

harmony 鸿蒙Subsystems

harmony 鸿蒙AI Framework Development Guide

harmony 鸿蒙Neural Network Runtime Device Access

harmony 鸿蒙Application Privilege Configuration

harmony 鸿蒙Development Example

harmony 鸿蒙Setting Up a Development Environment

harmony 鸿蒙Development Guidelines

harmony 鸿蒙Application Framework Overview

harmony 鸿蒙ArkCompiler Development

harmony 鸿蒙Window Title Bar Customization Development (ArkTS)

  • 所属分类: 后端技术
  • 本文标签: 软件 鸿蒙
  • 版权声明: 本文链接 https://seaxiang.com/blog/5ada2efeff634a0d8482ad1e134ca664