fs: Add Kernel-level VFS Performance Profiler#18607
fs: Add Kernel-level VFS Performance Profiler#18607Sumit6307 wants to merge 1 commit intoapache:masterfrom
Conversation
6cbaa23 to
b34527a
Compare
cederom
left a comment
There was a problem hiding this comment.
- Thank you @Sumit6307 very nice idea! :-)
- My remarks noted in the code.
- We should align the nomenclature
PROFILEvsPROFILER(second seems better suited imho), as both names are used for the same functionality. MaybePERForPERFPROFwould clearly indicate performance profiler? - Please also provide simple
nuttx/Documentationfor the new functionality.
|
@Sumit6307 why are you including mnemofs commit here? |
Yup, I would put that into a separate PR too :-P |
|
@Sumit6307 why not reuse sched_note syscall to profile fs performance? you can learn from Documentation |
b34527a to
f8a783e
Compare
5361d4f to
9b91c66
Compare
@acassis Done I have normalized the |
|
@Sumit6307 still failing for citest board profile (sim:citest) |
9b91c66 to
5739cb0
Compare
@acassis Ah, thank you for catching that! My local editor accidentally sorted the disabled Kconfig comments ( I have manually reverted those negated configurations back to the top of the |
5739cb0 to
4b98324
Compare
|
Error: /home/runner/work/nuttx/nuttx/nuttx/fs/procfs/fs_procfsprofile.c:75:78: error: Long line found |
e4998b7 to
ed503d0
Compare
14dee63 to
472b99f
Compare
This adds a kernel-level performance profiler for the VFS. By enabling CONFIG_FS_PROFILER, the core VFS system calls (file_read, file_write, file_open, and file_close) are instrumented to track high-resolution execution times using clock_systime_timespec() seamlessly. The collected statistics are exposed dynamically via a new procfs node at /proc/fs/profile, allowing CI regression testing without needing external debugging tools. Signed-off-by: Sumit6307 <sumitkesar6307@gmail.com>
472b99f to
1fd8903
Compare
|
@xiaoxiang781216 All final cleanup and refactoring is complete:
The PR is now ready for final review. |
cederom
left a comment
There was a problem hiding this comment.
Thank you @Sumit6307 great work! :-)
|
@acassis If everything looks good and correct now, please merge this PR. |
@Sumit6307 yes, but since @anchao added a Change Request, we need an approval from him to merge this PR |
|
Hi @anchao, I’ve addressed all the requested changes and updated the PR accordingly. Could you please review the latest changes and approve if everything looks good? Once approved, we can proceed with merging. Thanks |
Note: Please adhere to Contributing Guidelines.
Summary
Currently, assessing the latency or throughput of VFS operations requires external tools, ad-hoc test apps, or complex debug setups. This makes automated performance regression testing in CI difficult.
This PR introduces a Kernel-level VFS Performance Profiler to address this gap.
By enabling the new
CONFIG_FS_PROFILERconfiguration, the core VFS system calls (file_read, file_write, file_open, and file_close) are instrumented to track high-resolution execution times (in nanoseconds) and invocation counts seamlessly usingclock_systime_timespec().The collected statistics are exposed dynamically via a new procfs node at
/proc/fs/profile. This enables any testing script, CI workflow, or user-space application to effortlessly monitor filesystem performance bottlenecks and catch regressions.Impact
cat /proc/fs/profile.CONFIG_FS_PROFILER). When disabled, code size and performance impact are exactly zero.enter_critical_section) to ensure SMP (multi-core) scaling is not bottlenecked.Testing
Tested on Host: Windows 11 (via WSL2).
Tested on Board:
sim:nsh(NuttX Simulator).Test procedure:
CONFIG_FS_PROFILER=yandCONFIG_FS_PROCFS=y.Test Log: