Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ESP32: profiling samples are inappropriately rounded due to limited histogram width (OCD-1087) #356

Closed
bryghtlabs-richard opened this issue Jan 24, 2025 · 4 comments

Comments

@bryghtlabs-richard
Copy link

Development Kit

ESP32-S3-WROOM-1

Module or chip used

ESP32-S3-WROOM-1

Debug Adapter

Internal USB JTAG

OpenOCD version

v0.12.0-esp32-20240821

Operating System

Windows 11

Using an IDE ?

No

OpenOCD command line

openocd -f board/esp32s3-builtin.cfg

JTAG Clock Speed

40MHz

ESP-IDF version

v5.1.5

Problem Description

  1. In OpenOCD, run profile 10 gmon.out
  2. While profiling, make sure to run a mix ROM, IRAM, and QSPI Flash instructions
  3. Run gprof gmon.out
  4. GProf's program-counter samples are all messed up because the histogram doesn't have enough bins to handle the spare address space used by ESP32 chips.

Debug Logs

Expected behavior

I would like instruction-accurate profiling, so that I may know which functions and which instructions we're spending time on during a long random-sampling run. The following series of patches addresses this with upstream OpenOCD:

Screenshots

No response

@bryghtlabs-richard bryghtlabs-richard changed the title ESP32: profiling samples are inappropriately ESP32: profiling samples are inappropriately rounded due to limited histogram width Jan 24, 2025
@github-actions github-actions bot changed the title ESP32: profiling samples are inappropriately rounded due to limited histogram width ESP32: profiling samples are inappropriately rounded due to limited histogram width (OCD-1087) Jan 24, 2025
@bryghtlabs-richard
Copy link
Author

Other requests for this here: https://www.esp32.com/viewtopic.php?f=13&t=39619

@erhankur
Copy link
Collaborator

@bryghtlabs-richard Sorry, just to understand. Are your upstream patches fixing the problem you described, or are you waiting for a solution on the target side ?

We have an internal task to keep all histograms on the target and sends them (via apptrace JTAG interface) to the host when user invokes special OpenOCD command. We did POC but it is not optimal in terms of RAM usage. So we will revisit it for optimization.

@bryghtlabs-richard
Copy link
Author

@erhankur, my upstream patches fix the problem, and I was just hoping that as an impacted CPU vendor, Espressif might be interested in reviewing.

@erhankur
Copy link
Collaborator

erhankur commented Feb 3, 2025

@bryghtlabs-richard thanks for the info. We will help with merging your patches.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants