Background
One might want to profile an application on a remote system or in a container using dotTrace. This can be achieved using the dotTrace Command-Line Profiler, which enables application profiling via CLI.
Answer
The profiler allows you to connect to a running process or launch a new one, depending on your needs. dotTrace can be controlled via commands sent to stdin, Profiling API or by writing commands to a file using --service-input option
Below is an example demonstrating how to profile an application using dotTrace CLI. This example shows how to install dotTrace on a target system using dotnet tool, attach to a running process and control dotTrace via stdin):
- Install dotTrace as a global tool
dotnet tool install --global jetbrains.dottrace.globaltools - Run the target application on a target system
- Attach to the target process via
dottrace attach {process_id} --save-to={snapshot_path}.dtpwhere-
process_id- id of the target process -
snapshot_path-.dtpsnapshot storage location
-
- Wait until the profiler starts and connects to the target process (indicated by messages
##dotTrace["ready"]and##dotTrace["started"...]) - Type
##dotTrace["get-snapshot"]to collect a snapshot - Use
##dotTrace["disconnect"]to disconnect the profiler from the target application - Transfer the generated
{snapshot_name}.dtpto a target system and open it in dotTrace
Find more information about this process in Use dotTrace Command-Line Profiler.
Comments
0 comments
Please sign in to leave a comment.