openharmony 鸿蒙 use-jsvm-about-v8-trace

2026-08-25 浏览 (1)

Using HiSmartPerf to Collect JSVM Trace

Overview

JSVM trace is a tool provided by the JSVM engine for analyzing and debugging the execution process of JavaScript code. It records and outputs detailed information about code execution, including function calls, execution time, and memory usage, helping you understand code performance, diagnose potential problems, and optimize code.

Currently, HiSmartPerf supports trace points of the compile, runtime, builtin, and JS_Execution types in JSVM. You can view information about events of these types in HiSmartPerf.

How to Use

Default State

JSVM trace collection is controlled by the web.debug.rcs switch, which is disabled by default. When a web page is started, "RCS is off" is displayed in HiLog.

Collecting JSVM Trace

  1. To collect JSVM trace, you need to enable web.debug.rcs before starting the web page. Run the following command before starting the web page:

    hdc shell setenforce 0
    hdc shell param set web.debug.rcs true
    
  2. When a web page is started, "RCS is on" is displayed in HiLog.

  3. Use hitrace to capture traces of the corresponding scenario. For details about how to use hitrace, see hitrace.

  4. Use HiSmartPerf to parse the captured traces. The trace points prefixed with RCS_ are supported by HiSmartPerf.

  5. To view the trace data of compile, runtime, builtin, and JS_Execution, use the following keywords to filter the data:

    • compile: RCS_v8.compile
    • runtime: RCS_V8.Runtime
    • builtin: RCS_v8.runtime_V8.Builtin
    • JS_Execution: RCS_JS_Execution

你可能感兴趣的鸿蒙文章

openharmony 鸿蒙 use-napi-ark-runtime

openharmony 鸿蒙 use-napi-about-arraybuffer

openharmony 鸿蒙 use-jsvm-about-array

openharmony 鸿蒙 use-napi-load-module

openharmony 鸿蒙 jsvm-data-types-interfaces

openharmony 鸿蒙 ohos-abi

openharmony 鸿蒙 jsvm-guidelines

openharmony 鸿蒙 use-jsvm-trigger-gc

openharmony 鸿蒙 use-sendable-napi

openharmony 鸿蒙 use-napi-object-wrap

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