apache / apache/nuttx

[FEATURE] Support more perf events in Nuttx.

Open
#13,370 4 comments 0 reactions 0 assignees View on GitHub
Type: Enhancement
Dominant language
C
Stars
4k
Forks
1.7k
Avg merge
1d 17h
Merged PRs (30d)
237

Description

### Is your feature request related to a problem? Please describe.

Currently, Nuttx provides a basic perf support interface, as shown below:
``` c
/****************************************************************************
* Name: up_perf_*
*
* Description:
* The first interface simply provides the current time value in unknown
* units. NOTE: This function may be called early before the timer has
* been initialized. In that event, the function should just return a
* start time of zero.
*
* Nothing is assumed about the units of this time value. The following
* are assumed, however: (1) The time is an unsigned integer value, (2)
* the time is monotonically increasing, and (3) the elapsed time (also
* in unknown units) can be obtained by subtracting a start time from
* the current time.
*
* The second interface simple converts an elapsed time into well known
* units.
*
****************************************************************************/

void up_perf_init(FAR void *arg);
unsigned long up_perf_gettime(void);
unsigned long up_perf_getfreq(void);
void up_perf_convert(unsigned long elapsed, FAR struct timespec *ts);
```
It seems that only time-related events are monitored. Can we support more perf events in Nuttx, just like in Linux, so that we can monitor more hardware performance, such as cache or bpu performance?

### Describe the solution you'd like

More perf event support is added in Nuttx, providing an interface or framework so that platforms with PMU can be adapted according to the interface.
It would be better to port perf to Nuttx app, so that we can use perf tool to monitor the hardware performance when running the application just like on Linux.

### Describe alternatives you've considered

_No response_

### Verification

- [X] I have verified before submitting the report.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.