Skip to content
This repository was archived by the owner on Jan 23, 2023. It is now read-only.

Commit 51f010f

Browse files
authored
Merge pull request #5885 from brianrob/docker_perf
Update Linux Tracing Instructions for Docker Containers
2 parents a576c83 + f5f41ae commit 51f010f

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

Documentation/project-docs/linux-performance-tracing.md

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,19 @@ Follow these steps to prepare your machine to collect a performance trace.
8181

8282
The compressed trace file is now stored in the current working directory.
8383

84+
#Collecting in a Docker Container#
85+
Perfcollect can be used to collect data for an application running inside a Docker container. The main thing to know is that collecting a trace requires elevated privileges because the [default seccomp profile](https://docs.docker.com/engine/security/seccomp/) blocks a required syscall - perf_events_open.
86+
87+
In order to use the instructions in this document to collect a trace, spawn a new shell inside the container that is privileged.
88+
89+
>```bash
90+
>docker exec -it --privileged <container_name> /bin/bash
91+
>```
92+
93+
Even though the application hosted in the container isn't privileged, this new shell is, and it will have all the privileges it needs to collect trace data. Now, simply follow the instructions in [Collecting a Trace](#collecting-a-trace) using the privileged shell.
94+
95+
If you want to try tracing in a container, we've written a [demo Dockerfile](https://raw.githubusercontent.com/dotnet/corefx-tools/master/src/performance/perfcollect/docker-demo/Dockerfile) that installs all of the performance tracing pre-requisites, sets the environment up for tracing, and starts a sample CPU-bound app.
96+
8497
#Viewing a Trace#
8598
Traces are best viewed using PerfView on Windows. Note that we're currently looking into porting the analysis pieces of PerfView to Linux so that the entire investigation can occur on Linux.
8699
@@ -89,7 +102,7 @@ Traces are best viewed using PerfView on Windows. Note that we're currently loo
89102
2. Download PerfView from <http://aka.ms/perfview>.
90103
3. Run PerfView.exe
91104
92-
> ```bash
105+
> ```cmd
93106
> PerfView.exe <path to trace.zip file>
94107
> ```
95108

0 commit comments

Comments
 (0)