Missing cpu samples when profiling within Docker, but no errors reported

I have installed Nsight Systems inside a docker container along with an application that I wish to profile. When running the docker container, I have added the run arguments that are suggested in the documentation (–privileged=true, as specified
here Nsight Systems User Guide :: Nsight Systems Documentation), which allow Nsight to run and generate reports. However, no cpu samples are collected, nor any backtraces available.

When running the nsys status -e command within docker to verify the environment, no issues seem to be raised:

Timestamp counter supported: Yes
Sampling Environment Check
Linux Kernel Paranoid Level = -1: OK
Linux Distribution = Ubuntu
Linux Kernel Version = 4.9.201-tegra: OK
Linux perf_event_open syscall available: OK
Sampling trigger event available: OK
Intel(c) Last Branch Record support: Not Available
Root privileges: Yes
Kernel module: Available
Sampling Environment: OK

I have also tested profiling a simple Hello World application inside docker and the report is also missing cpu samples.

Release notes (Release Notes :: Nsight Systems Documentation) seem to indicate issues with Docker, but the kernel version that I am working with is more recent than v4.3, so it is unclear if this issue is related.

Platform Jetson AGX Xavier, Kernel 4.9.201-tegra.

Any help and clarifications would be greatly appreciated!

Thank you for reporting this issue. I’ll pass it on to the team, it looks like we’ll need to fix it in a future release.

1 Like

@nchang,

Different host/container PID namespaces - it leads to broken sampling in NSys profiler.

Quick workaround: use host PID namespace, for example:
docker run --privileged=true --pid=host ...

Fixing this problem in NSys is in progress.

Thanks,
Igor.

1 Like

@nchang,

You can also use another event source (Perf) in NSys: please add --sampling-trigger=perf option for this purpose.

For example:
docker run --privileged=true ...

echo '-1' > /proc/sys/kernel/perf_event_paranoid
nsys profile --sampling-trigger=perf ...

Thanks,
Igor.