hujun260 opened a new pull request, #3390:
URL: https://github.com/apache/nuttx-apps/pull/3390
## Summary
This PR introduces perf_gettime_test(), a new test module for validating
up_perf_gettime() performance counter functionality. The changes add a complete
test implementation with 5 independent test cases that verify performance event
counter behavior:
1. Initial time value acquisition and validation
2. Monotonically increasing time verification with 10 iterations
3. Time interval statistics collection and analysis
4. Performance counter frequency validation
5. Rapid consecutive call verification for high-frequency access patterns
The test implementation follows NuttX ostest coding standards with
conditional compilation support for CONFIG_ARCH_HAVE_PERF_EVENTS.
### Impact
• Functionality: Enables comprehensive testing of performance event counters
across supported architectures
• Coverage: Adds 5 detailed test cases covering initialization,
monotonicity, statistics, frequency, and rapid access patterns
• Quality: Includes complete error handling with 7 assertion verification
points and detailed output reporting
• Standards: Follows Apache-2.0 license format and NuttX ostest coding
conventions
### Testing
#### Test Environment:
qemu-armv7r:nsh
CONFIG_ARCH_PERF_EVENTS=y
CONFIG_PERF_OVERFLOW_CORRECTION=y
CONFIG_SYSTEM_TIME64=y
```
perf_gettime_test: Starting performance event test
Test 1: Getting initial performance time value
perf_gettime_test: Initial time = 1772431887
Test 2: Verify monotonically increasing time values
perf_gettime_test [0]: current=1873341545, interval=100909658
perf_gettime_test [1]: current=1974284158, interval=100942613
perf_gettime_test [2]: current=2075294261, interval=101010103
perf_gettime_test [3]: current=2176282297, interval=100988036
perf_gettime_test [4]: current=2277330625, interval=101048328
perf_gettime_test [5]: current=2378329244, interval=100998619
perf_gettime_test [6]: current=2479337636, interval=101008392
perf_gettime_test [7]: current=2580385082, interval=101047446
perf_gettime_test [8]: current=2681285935, interval=100900853
perf_gettime_test [9]: current=2782287337, interval=101001402
Test 3: Analyzing time intervals
perf_gettime_test: Interval statistics:
Minimum interval: 100900853
Maximum interval: 101048328
Average interval: 100985545
Total iterations: 10
perf_gettime_test: Time intervals look reasonable
Test 4: Getting performance counter frequency
perf_gettime_test: Performance frequency = 1000000000 Hz
perf_gettime_test: Performance frequency is valid
Test 5: Testing multiple rapid calls
perf_gettime_test: Rapid call 1: 2784078889
perf_gettime_test: Rapid call 2: 2784224923
perf_gettime_test: Rapid call 3: 2784390465
perf_gettime_test: Rapid call 4: 2784523721
perf_gettime_test: Rapid call 5: 2784620879
perf_gettime_test: Rapid call 6: 2784718050
perf_gettime_test: All performance event tests PASSED
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]