# qualcomm/libqcperf architecture

> Architecture diagram of the GitHub repository qualcomm/libqcperf, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-10). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/qualcomm/libqcperf
- Repository: https://github.com/qualcomm/libqcperf

## Overview

libqcperf is a cross-platform Qualcomm performance-profiling library. An application uses the public API to discover backend capabilities and request metrics; the core connects the selected backend, which collects platform metrics and delivers results through callbacks. The documented backend set spans CPU, NPU, thermal, power, and a dummy reference implementation. The graph also shows the shared asynchronous/threading layer. Several backend implementations were not sampled, so their detailed internal dependencies are omitted.

Main entry points: [`qcperf/core/src/qcperf.c`](https://github.com/qualcomm/libqcperf/blob/main/qcperf/core/src/qcperf.c) (Core Runtime), [`qcperf/backends/qcom-linux-cpu/src/qcom_linux_cpu.c`](https://github.com/qualcomm/libqcperf/blob/main/qcperf/backends/qcom-linux-cpu/src/qcom_linux_cpu.c) (Linux CPU), [`qcperf/backends/wos-cpu/src/wos_cpu.c`](https://github.com/qualcomm/libqcperf/blob/main/qcperf/backends/wos-cpu/src/wos_cpu.c) (WoS CPU), [`qcperf/backends/wos-power-backend/src/wos_power_backend.c`](https://github.com/qualcomm/libqcperf/blob/main/qcperf/backends/wos-power-backend/src/wos_power_backend.c) (WoS Power)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["Application API"]
  node_public_api["Public API<br/>[qcperf.h]"]
end

subgraph group_core["Core Dispatch"]
  node_core_runtime["Core Runtime<br/>[qcperf.c]"]
  node_backend_registry["Backend Registry<br/>[qcperf_backends.h]"]
  node_backend_contract["Backend Contract"]
  node_shared_types["Metric Types<br/>[qcperf_common.h]"]
end

subgraph group_platform["Metric Backends"]
  node_linux_cpu["Linux CPU<br/>[qcom_linux_cpu.c]"]
  node_dsp_npu["DSP NPU<br/>[qcom_dsp_npu.c]"]
  node_wos_cpu["WoS CPU<br/>[wos_cpu.c]"]
  node_wos_power["WoS Power"]
  node_wos_thermal["WoS Thermal<br/>[wos_thermal.c]"]
  node_dummy["Dummy Backend<br/>[dummy.c]"]
  node_thermal_support["Thermal Support<br/>[thermal_common.cpp]"]
end

subgraph group_internal["Shared Internals"]
  node_threading["Thread Utility<br/>[qthread.h]"]
  node_timing["Time Utility<br/>[qtime.h]"]
end

node_application(("Application"))

node_application -->|"requests metrics"| node_public_api
node_public_api -.->|"routes API calls"| node_core_runtime
node_core_runtime -->|"selects backends"| node_backend_registry
node_core_runtime -->|"initializes interface"| node_backend_contract
node_core_runtime -->|"uses metric types"| node_shared_types
node_core_runtime -.->|"dispatches requests"| node_linux_cpu
node_core_runtime -.->|"dispatches requests"| node_dsp_npu
node_core_runtime -.->|"dispatches requests"| node_wos_cpu
node_core_runtime -.->|"dispatches requests"| node_wos_power
node_core_runtime -.->|"dispatches requests"| node_wos_thermal
node_core_runtime -.->|"dispatches requests"| node_dummy
node_linux_cpu -->|"uses threads"| node_threading
node_linux_cpu -->|"reads time"| node_timing
node_wos_cpu -->|"uses threads"| node_threading
node_wos_cpu -->|"reads time"| node_timing
node_wos_power -->|"uses threads"| node_threading
node_wos_power -->|"reads time"| node_timing
node_wos_thermal -->|"uses support"| node_thermal_support
node_core_runtime -.->|"delivers callbacks"| node_application

click node_public_api "https://github.com/qualcomm/libqcperf/blob/main/qcperf/core/inc/qcperf.h"
click node_core_runtime "https://github.com/qualcomm/libqcperf/blob/main/qcperf/core/src/qcperf.c"
click node_backend_registry "https://github.com/qualcomm/libqcperf/blob/main/qcperf/backends/inc/qcperf_backends.h"
click node_backend_contract "https://github.com/qualcomm/libqcperf/blob/main/qcperf/core/inc/internal/qcperf_backend_interface.h"
click node_shared_types "https://github.com/qualcomm/libqcperf/blob/main/qcperf/core/inc/qcperf_common.h"
click node_linux_cpu "https://github.com/qualcomm/libqcperf/blob/main/qcperf/backends/qcom-linux-cpu/src/qcom_linux_cpu.c"
click node_dsp_npu "https://github.com/qualcomm/libqcperf/blob/main/qcperf/backends/qcom-dsp-npu/src/qcom_dsp_npu.c"
click node_wos_cpu "https://github.com/qualcomm/libqcperf/blob/main/qcperf/backends/wos-cpu/src/wos_cpu.c"
click node_wos_power "https://github.com/qualcomm/libqcperf/blob/main/qcperf/backends/wos-power-backend/src/wos_power_backend.c"
click node_wos_thermal "https://github.com/qualcomm/libqcperf/blob/main/qcperf/backends/wos-thermal/src/wos_thermal.c"
click node_dummy "https://github.com/qualcomm/libqcperf/blob/main/qcperf/backends/dummy/src/dummy.c"
click node_thermal_support "https://github.com/qualcomm/libqcperf/blob/main/qcperf/backends/utils/wos/cpu-thermal-etw/src/thermal_common.cpp"
click node_threading "https://github.com/qualcomm/libqcperf/blob/main/qcperf/utils/qthread/inc/qthread.h"
click node_timing "https://github.com/qualcomm/libqcperf/blob/main/qcperf/utils/qtime/inc/qtime.h"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_public_api toneBlue
class node_core_runtime,node_backend_registry,node_backend_contract,node_shared_types toneAmber
class node_linux_cpu,node_dsp_npu,node_wos_cpu,node_wos_power,node_wos_thermal,node_dummy,node_thermal_support toneMint
class node_threading,node_timing toneRose
class node_application toneIndigo
```

## Components

### Application API

- [Public API](https://github.com/qualcomm/libqcperf/blob/main/qcperf/core/inc/qcperf.h): `qcperf/core/inc/qcperf.h`

### Core Dispatch

- [Core Runtime](https://github.com/qualcomm/libqcperf/blob/main/qcperf/core/src/qcperf.c): `qcperf/core/src/qcperf.c`
- [Backend Registry](https://github.com/qualcomm/libqcperf/blob/main/qcperf/backends/inc/qcperf_backends.h): `qcperf/backends/inc/qcperf_backends.h`
- [Backend Contract](https://github.com/qualcomm/libqcperf/blob/main/qcperf/core/inc/internal/qcperf_backend_interface.h): `qcperf/core/inc/internal/qcperf_backend_interface.h`
- [Metric Types](https://github.com/qualcomm/libqcperf/blob/main/qcperf/core/inc/qcperf_common.h): `qcperf/core/inc/qcperf_common.h`

### Metric Backends

- [Linux CPU](https://github.com/qualcomm/libqcperf/blob/main/qcperf/backends/qcom-linux-cpu/src/qcom_linux_cpu.c): `qcperf/backends/qcom-linux-cpu/src/qcom_linux_cpu.c`
- [DSP NPU](https://github.com/qualcomm/libqcperf/blob/main/qcperf/backends/qcom-dsp-npu/src/qcom_dsp_npu.c): `qcperf/backends/qcom-dsp-npu/src/qcom_dsp_npu.c`
- [WoS CPU](https://github.com/qualcomm/libqcperf/blob/main/qcperf/backends/wos-cpu/src/wos_cpu.c): `qcperf/backends/wos-cpu/src/wos_cpu.c`
- [WoS Power](https://github.com/qualcomm/libqcperf/blob/main/qcperf/backends/wos-power-backend/src/wos_power_backend.c): `qcperf/backends/wos-power-backend/src/wos_power_backend.c`
- [WoS Thermal](https://github.com/qualcomm/libqcperf/blob/main/qcperf/backends/wos-thermal/src/wos_thermal.c): `qcperf/backends/wos-thermal/src/wos_thermal.c`
- [Dummy Backend](https://github.com/qualcomm/libqcperf/blob/main/qcperf/backends/dummy/src/dummy.c): `qcperf/backends/dummy/src/dummy.c`
- [Thermal Support](https://github.com/qualcomm/libqcperf/blob/main/qcperf/backends/utils/wos/cpu-thermal-etw/src/thermal_common.cpp): `qcperf/backends/utils/wos/cpu-thermal-etw/src/thermal_common.cpp`

### Shared Internals

- [Thread Utility](https://github.com/qualcomm/libqcperf/blob/main/qcperf/utils/qthread/inc/qthread.h): `qcperf/utils/qthread/inc/qthread.h`
- [Time Utility](https://github.com/qualcomm/libqcperf/blob/main/qcperf/utils/qtime/inc/qtime.h): `qcperf/utils/qtime/inc/qtime.h`

### Other components

- **Application**

## Connections

- Application → Public API: requests metrics (evidence: `README.md`)
- Public API → Core Runtime: routes API calls (evidence: `qcperf/core/src/qcperf.c`)
- Core Runtime → Backend Registry: selects backends (evidence: `qcperf/core/src/qcperf.c`)
- Core Runtime → Backend Contract: initializes interface (evidence: `qcperf/core/src/qcperf.c`)
- Core Runtime → Metric Types: uses metric types (evidence: `qcperf/core/src/qcperf.c`)
- Core Runtime → Linux CPU: dispatches requests (evidence: `README.md`)
- Core Runtime → DSP NPU: dispatches requests (evidence: `README.md`)
- Core Runtime → WoS CPU: dispatches requests (evidence: `README.md`)
- Core Runtime → WoS Power: dispatches requests (evidence: `README.md`)
- Core Runtime → WoS Thermal: dispatches requests (evidence: `README.md`)
- Core Runtime → Dummy Backend: dispatches requests (evidence: `README.md`)
- Linux CPU → Thread Utility: uses threads (evidence: `qcperf/backends/qcom-linux-cpu/src/qcom_linux_cpu.c`)
- Linux CPU → Time Utility: reads time (evidence: `qcperf/backends/qcom-linux-cpu/src/qcom_linux_cpu.c`)
- WoS CPU → Thread Utility: uses threads (evidence: `qcperf/backends/wos-cpu/src/wos_cpu.c`)
- WoS CPU → Time Utility: reads time (evidence: `qcperf/backends/wos-cpu/src/wos_cpu.c`)
- WoS Power → Thread Utility: uses threads (evidence: `qcperf/backends/wos-power-backend/src/wos_power_backend.c`)
- WoS Power → Time Utility: reads time (evidence: `qcperf/backends/wos-power-backend/src/wos_power_backend.c`)
- WoS Thermal → Thermal Support: uses support
- Core Runtime → Application: delivers callbacks (evidence: `README.md`)
