Skip to content
Merged
Show file tree
Hide file tree
Changes from 15 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions docs/core/additional-tools/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ The [.NET Core Uninstall Tool](https://github.com/dotnet/cli-lab/releases) (`dot

[dotnet-dump](../diagnostics/dotnet-dump.md) provides a way to collect and analyze Windows and Linux core dumps without a native debugger.

[dotnet-gcdump](../diagnostics/dotnet-gcdump.md) provides a way to collect gcdumps of live .NET processes.

[dotnet-trace](../diagnostics/dotnet-trace.md) collects profiling data from your app that can help in scenarios where you need to find out what causes an app to run slow.

## WCF Web Service Reference tool
Expand Down
110 changes: 110 additions & 0 deletions docs/core/diagnostics/dotnet-gcdump.md
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
Copy link
Contributor

Choose a reason for hiding this comment

The 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).
Copy link
Contributor

Choose a reason for hiding this comment

The 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?

Copy link
Member Author

Choose a reason for hiding this comment

The 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?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/cc @josalem

Copy link
Contributor

Choose a reason for hiding this comment

The 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.

4 changes: 4 additions & 0 deletions docs/core/diagnostics/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ This article helps you find the various tools you need.

The [dotnet-dump](dotnet-dump.md) tool is a way to collect and analyze Windows and Linux core dumps without a native debugger.

### dotnet-gcdump

The [dotnet-gcdump](dotnet-gcdump.md) tool is a way to collect gcdumps of live .NET processes.

### dotnet-trace

.NET Core includes what is called the `EventPipe` through which diagnostics data is exposed. The [dotnet-trace](dotnet-trace.md) tool allows you to consume interesting profiling data from your app that can help in scenarios where you need to root cause apps running slow.
Expand Down
2 changes: 2 additions & 0 deletions docs/core/toc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,8 @@ items:
href: diagnostics/dotnet-counters.md
- name: dotnet-dump
href: diagnostics/dotnet-dump.md
- name: dotnet-gcdump
href: diagnostics/dotnet-gcdump.md
- name: dotnet-trace
href: diagnostics/dotnet-trace.md
- name: .NET Core diagnostics tutorials
Expand Down