- Notifications
You must be signed in to change notification settings - Fork 6.1k
Document dotnet-gcdump tool #19697
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Document dotnet-gcdump tool #19697
Changes from 16 commits
33011bf 7483a4d 46a9cbe 213e86d 21a343c ff66ddd c13732f ab60c23 7c5979b e91dc39 1d9b217 ca17a77 616233f cb20b0e 7c210c8 d6869e2 09eee65 bede90a 9f5836d 07d2d89 a8e4f51 File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,110 @@ | ||
| --- | ||
| title: dotnet-gcdump - .NET Core | ||
| description: Installing and using the dotnet-gcdump command-line tool. | ||
| ms.date: 07/26/2020 | ||
| --- | ||
| # Heap analysis tool (dotnet-gcdump) | ||
| | ||
| **This article applies to:** ✔️ .NET Core 3.1 SDK and later versions | ||
| | ||
| ## Install dotnet-gcdump | ||
| | ||
| To install the latest release version of the `dotnet-gcdump` [NuGet package](https://www.nuget.org/packages/dotnet-gcdump), use the [dotnet tool install](../tools/dotnet-tool-install.md) command: | ||
| | ||
| ```dotnetcli | ||
| dotnet tool install -g dotnet-gcdump | ||
| ``` | ||
| | ||
| ## Synopsis | ||
| | ||
| ```console | ||
| dotnet-gcdump [-h|--help] [--version] <command> | ||
| ``` | ||
| | ||
| ## Description | ||
| | ||
| The `dotnet-gcdump` global tool is a way to collect GC (Garbage Collector) dumps of live .NET processes. It uses the EventPipe technology, which is a cross-platform alternative to ETW on Windows. GC dumps are created by triggering a GC in the target process, turning on special events, and regenerating the graph of object roots from the event stream. This allows for GC dumps to be collected while the process is running, with minimal overhead. These dumps are useful for several scenarios: | ||
| | ||
| - Comparing the number of objects on the heap at several points in time. | ||
| - Analyzing roots of objects (answering questions like, "what still has a reference to this type?"). | ||
| - Collecting general statistics about the counts of objects on the heap. | ||
| | ||
| ## Options | ||
| | ||
| - **`--version`** | ||
| | ||
| Displays the version of the `dotnet-gcdump` utility. | ||
| | ||
| - **`-h|--help`** | ||
| | ||
| Shows command-line help. | ||
| | ||
| ## `dotnet-gcdump collect` | ||
| | ||
| Collects a GC dump from a currently running process. | ||
| | ||
| ### Synopsis | ||
| | ||
| ```console | ||
| dotnet-gcdump collect [-h|--help] [-p|--process-id <pid>] [-o|--output <gcdump-file-path>] [-v|--verbose] [-t|--timeout <timeout>] [-n|--name <name>] | ||
| ``` | ||
| | ||
| ### Options | ||
| Contributor There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Following the pattern of https://raw.githubusercontent.com/dotnet/docs/master/docs/core/diagnostics/dotnet-counters.md we should have an Examples h3 section following each Options h3 section. | ||
| | ||
| - **`-h|--help`** | ||
| | ||
| Shows command-line help. | ||
| | ||
| - **`-p|--process-id <pid>`** | ||
| | ||
| The process id to collect the GC dump from. | ||
| | ||
| - **`-o|--output <gcdump-file-path>`** | ||
| | ||
| The path where collected GC dumps should be written. Defaults to *.\\YYYYMMDD\_HHMMSS\_\<pid>.gcdump*. | ||
| | ||
| - **`-v|--verbose`** | ||
| | ||
| Output the log while collecting the GC dump. | ||
| | ||
| - **`-t|--timeout <timeout>`** | ||
| | ||
| Give up on collecting the GC dump if it takes longer than this many seconds. The default value is 30. | ||
| | ||
| - **`-n|--name <name>`** | ||
| | ||
| The name of the process to collect the GC dump from. | ||
| | ||
| ## `dotnet-gcdump ps` | ||
| | ||
| Lists the dotnet processes that GC dumps can be collected for. | ||
| | ||
| ### Synopsis | ||
| | ||
| ```console | ||
| dotnet-gcdump ps | ||
| ``` | ||
| | ||
| ## `dotnet-gcdump report <gcdump_filename>` | ||
| | ||
| Generate a report from a previously generated GC dump or from a running process, and write to `stdout`. | ||
| | ||
| ### Synopsis | ||
| | ||
| ```console | ||
| dotnet-gcdump report [-h|--help] [-p|--process-id <pid>] [-t|--report-type <HeapStat>] | ||
| ``` | ||
| | ||
| ### Options | ||
| | ||
| - **`-h|--help`** | ||
| | ||
| Shows command-line help. | ||
| | ||
| - **`-p|--process-id <pid>`** | ||
| | ||
| The process id to collect the GC dump from. | ||
| | ||
| - **`-t|--report-type <HeapStat>`** | ||
| | ||
| The type of report to generate. Available options: heapstat (default). | ||
| Contributor There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If this is the only option, what's the difference between specifying it an omitting it? Member Author There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @tdykstra, I had this question myself. It looks like there shouldn't be a difference. Perhaps the tool team might be planning to add other options later? Contributor There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. /cc @josalem Contributor There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is only report type available right now and therefore the default, but we created this flag for future use if/when we add more report types. | ||
Uh oh!
There was an error while loading. Please reload this page.