Mobile Development 14 min read

Analyzing and Optimizing Device Overheating Issues Using Trace Data

This article explains how to evaluate device overheating using metrics such as CPU/GPU usage and temperature, collect and visualize Trace data with SmartPerf or DevEco Studio, analyze high‑load threads and frequency scaling, and apply targeted code changes—disabling sensors, releasing Lottie resources, and simplifying components—to reduce heat and restore frame‑rate stability.

Sohu Tech Products
Sohu Tech Products
Sohu Tech Products
Analyzing and Optimizing Device Overheating Issues Using Trace Data

Device overheating significantly impacts user experience and performance. This article introduces key evaluation metrics for overheating, then explains how to analyze and resolve the issue using Trace data, and finally presents a practical case study.

Evaluation Metrics include CPU usage, GPU usage, battery temperature, sensor data from various components, and frequency scaling.

Analysis Approach Based on Trace Data involves data collection with SmartPerf Host or DevEco Studio's Profile tool, processing and visualizing CPU/GPU usage and temperature curves, locating high‑load periods, examining frequency adjustments, and investigating abnormal behaviors.

Case Study : The Sohu Video HarmonyOS page shows severe heating after navigating to the detail page. Temperature and frame‑rate data are recorded in a table (showing temperature rising above 40 °C and frame rate dropping to 60 fps). Screenshots illustrate the profiling UI.

Step 1 – Collect Trace Data : Use SmartPerf Host or DevEco Studio to record CPU/GPU usage, sensor readings, and battery temperature while running the app. The Profiler provides sessions such as Launch, Frame, Time, Allocation, Snapshot, and CPU.

Step 2 – Data Analysis : Visualize CPU/GPU curves, identify high‑load threads (e.g., sofa_msg_thread ), and examine frequency scaling. Frame analysis reveals AppDeadlineMissed frames causing jank. The ArkTS callback lane shows heavy usage of SensorUtil and deep nesting of the Lottie framework.

Code snippet for conditional SensorUtil listening:

export function onOrientationChange() {
  let currentOrientation = Side.TOP
  let context = getContext() as common.UIAbilityContext;
  try {
    sensor.on(sensor.SensorId.ORIENTATION, (data: sensor.OrientationResponse) => {
      let gamma = Math.abs(data.gamma)
      let beta = Math.abs(data.beta)
      /** 
       * Whether to use the accelerometer to change screen orientation.
       * 1 = enabled, 0 = disabled.
       */
      settings.getValue(context, settings.general.ACCELEROMETER_ROTATION_STATUS, settings.domainName.DEVICE_SHARED).then((value) => {
        if(value==='1'){
          if (gamma < 10 && beta > 45 && data.beta < 0 && currentOrientation != Side.TOP) {
            currentOrientation = Side.TOP
            context.eventHub.emit(EventConstants.orientationChange, currentOrientation);
          } else if (gamma > 70) {
            if (data.gamma > 70 && currentOrientation != Side.LEFT) {
              currentOrientation = Side.LEFT
              context.eventHub.emit(EventConstants.orientationChange, currentOrientation);
            } else if (data.gamma < -70 && currentOrientation != Side.RIGHT) {
              currentOrientation = Side.RIGHT
              context.eventHub.emit(EventConstants.orientationChange, currentOrientation);
            }
          }
        } else if (value==='0') {
          // disabled
        }
      });
    }, { interval: 100000000 });
  } catch (error) {}
}

Code snippet for Lottie memory release:

build() {
  Canvas(this.canvasRenderingContext)
    .width(this.viewWidth)
    .height(this.viewHeight)
    .backgroundColor(Color.Transparent)
    .onReady(() => {
      // load animation
      this.loadView()
    })
    .onDisAppear(() => {
      // destroy animation
      lottie.destroy(this.animateName);
    })
}

Step 3 – Optimization : Disable SensorUtil when auto‑rotate is off, recycle Lottie animations promptly, simplify property settings, reduce unnecessary component nesting, and replace @Component with @Builder to lower creation overhead.

Overall, systematic profiling with DevEco Studio, combined with targeted code optimizations, effectively mitigates device overheating and restores frame rate stability.

Performance ProfilingHarmonyOSCPU optimizationtrace analysisDevEco Studiodevice overheating
Sohu Tech Products
Written by

Sohu Tech Products

A knowledge-sharing platform for Sohu's technology products. As a leading Chinese internet brand with media, video, search, and gaming services and over 700 million users, Sohu continuously drives tech innovation and practice. We’ll share practical insights and tech news here.

0 followers
Reader feedback

How this landed with the community

login Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.