I want to know results such as gputrace or cudaapitrace of nsys stats --report in a specific nvtx range.( for example, “Dense layer-21” in the blue box of picture above.)
In the short term, you could look in the reports directory of your installation and find the script named “gputrace” and make a copy of that edited to limit time. (See documentation in the product for the SQLite schema, or use the .schema command in sqlite3, shipped with Nsight Systems).
In the moderate term, you can now get stats in the GUI as of Nsight Systems 2021.5 in that drop box (currently “Events View” in your screenshot) for the lower pane. Right now those stats are for the entire run, but we are in the process of making it possible for the user to set time/nvtx range limits for the statistics there.
Using the CLI with the --formatcsv option obtains from the beginning to the end of the process. (except for cudaprofilerstart()), but I want to get only the results of the nvtx range in csv.
Once you make a modified script (the scripts are in python) by adding the thing that Joan suggested, running nsys stats with that script will do what you are asking.