Skip to content

Commit

Permalink
Relocate files
Browse files Browse the repository at this point in the history
  • Loading branch information
sdmaclea committed Oct 7, 2019
1 parent f660001 commit 91fcc7d
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ In this scenario, the endpoint will slowly start leaking memory and eventually w

## Memory counters

Before we dig into collecting diagnostics data to help us root cause this scenario, we need to convince ourselves that what we are actually seeing is a memory leak (memory growth). We can use the [dotnet-counters](../cli-tools/dotnet-counters.md) tool to get at this information.
Before we dig into collecting diagnostics data to help us root cause this scenario, we need to convince ourselves that what we are actually seeing is a memory leak (memory growth). We can use the [dotnet-counters](dotnet-counters.md) tool to get at this information.

Lets run the [Sample debug target](sample-debug-target.md).

Expand Down Expand Up @@ -71,7 +71,7 @@ We can safely say that memory is growing or leaking. The next step is collect th

### Core dump generation

When analyzing possible memory leaks, we need access to the apps memory heap. We then analyze the memory contents. Looking at relationships between objects, we create theories on why memory isn't being freed. A common diagnostics data source is a memory dump (Win) or the equivalent core dump (Linux). To generate a core dump of a .NET Core application, we can use the [dotnet-dump)](../cli-tools/dotnet-dump.md) tool.
When analyzing possible memory leaks, we need access to the apps memory heap. We then analyze the memory contents. Looking at relationships between objects, we create theories on why memory isn't being freed. A common diagnostics data source is a memory dump (Win) or the equivalent core dump (Linux). To generate a core dump of a .NET Core application, we can use the [dotnet-dump)](dotnet-dump.md) tool.

Using the previous [Sample debug target](sample-debug-target.md) started above, run the following command to generate a core dump:

Expand All @@ -86,7 +86,7 @@ sudo ./dotnet-dump collect -p 4807
### Analyzing the core dump

Now that we have a core dump generated, use the [dotnet-dump)](../cli-tools/dotnet-dump.md) tool to analyze the dump:
Now that we have a core dump generated, use the [dotnet-dump)](dotnet-dump.md) tool to analyze the dump:

```bash
dotnet-dump analyze core_20190430_185145
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ Then find the process ID using:
dotnet-trace list-processes
```

Before hitting the above URL that will cause the high CPU condition, lets check our CPU counters using the [dotnet-counters](../cli-tools/dotnet-counters.md) tool:
Before hitting the above URL that will cause the high CPU condition, lets check our CPU counters using the [dotnet-counters](dotnet-counters.md) tool:

```bash
dotnet-counters monitor --refresh-interval 1 -p 22884
Expand All @@ -41,7 +41,7 @@ Here we can see that right after startup, the CPU isn't being consumed at all (0

Now, let's hit the URL (http://localhost:5000/api/diagscenario/highcpu/60000)

Rerun the [dotnet-counters](../cli-tools/dotnet-counters.md) command. We should see an increase in CPU usage as shown below:
Rerun the [dotnet-counters](dotnet-counters.md) command. We should see an increase in CPU usage as shown below:

![alt text](https://user-images.githubusercontent.com/15442480/57110736-6be9a000-6cee-11e9-86b6-6e128318a267.jpg)

Expand All @@ -59,15 +59,15 @@ When analyzing a slow request, we need a diagnostics tool that can give us insig

### Profile with `dotnet-trace` then view with Windows `PerfView`

We can use the [dotnet-trace](../cli-tools/dotnet-trace.md) tool. Using the previous [sample debug target](sample-debug-target.md), hit the URL (http://localhost:5000/api/diagscenario/highcpu/60000) again and while its running within the 1-minute request, run:
We can use the [dotnet-trace](dotnet-trace.md) tool. Using the previous [sample debug target](sample-debug-target.md), hit the URL (http://localhost:5000/api/diagscenario/highcpu/60000) again and while its running within the 1-minute request, run:

```bash
dotnet-trace collect -p 2266 --providers Microsoft-DotNETCore-SampleProfiler
```

22884 is the process ID that was found using `dotnet-trace list-processes`.

Let [dotnet-trace](../cli-tools/dotnet-trace.md) run for about 20-30 seconds and then hit enter to exit the collection. The result is a `nettrace` file located in the same folder. `nettrace` files are a great way to use existing analysis tools on Windows.
Let [dotnet-trace](dotnet-trace.md) run for about 20-30 seconds and then hit enter to exit the collection. The result is a `nettrace` file located in the same folder. `nettrace` files are a great way to use existing analysis tools on Windows.

Open the `nettrace` with `PerfView` as shown below.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,12 @@ Each of the scenarios:

### Debugging a memory leak

[Debugging a memory leak](app_is_leaking_memory_eventual_crash.md) walks through finding a memory leak. The [dotnet-counters](../cli-tools/dotnet-counters.md) tool is used to confirm the leak. Then the [dotnet-dump](../cli-tools/dotnet-dump.md) tool is used to diagnose the leak.
[Debugging a memory leak](app_is_leaking_memory_eventual_crash.md) walks through finding a memory leak. The [dotnet-counters](dotnet-counters.md) tool is used to confirm the leak. Then the [dotnet-dump](dotnet-dump.md) tool is used to diagnose the leak.

### Debugging a slow running application

[Debugging high CPU usage](app_running_slow_highcpu.md) walks through investigating high CPU usage. It uses the [dotnet-counters](../cli-tools/dotnet-counters.md) tool to confirm the high CPU usage. It then walks through using [Trace for performance analysis utility (`dotnet-trace`)](../cli-tools/dotnet-trace.md) or Linux `perf` to collect and view CPU usage profile.
[Debugging high CPU usage](app_running_slow_highcpu.md) walks through investigating high CPU usage. It uses the [dotnet-counters](dotnet-counters.md) tool to confirm the high CPU usage. It then walks through using [Trace for performance analysis utility (`dotnet-trace`)](dotnet-trace.md) or Linux `perf` to collect and view CPU usage profile.

### Debugging deadlock

The [debugging deadlock](hung_app.md) tutorial explores using the [dotnet-dump](../cli-tools/dotnet-dump.md) tool to investigate threads and locks.
The [debugging deadlock](hung_app.md) tutorial explores using the [dotnet-dump](dotnet-dump.md) tool to investigate threads and locks.
File renamed without changes.
2 changes: 1 addition & 1 deletion docs/core/diagnostics/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,4 @@ The [dotnet-dump](dotnet-dump.md) tool is a way to collect and analyze Windows a

## .NET Core diagnostics walk throughs

The [.NET Core diagnostics walk throughs](tutorial/diagnostic-scenarios.md) are designed to highlight key use cases.
The [.NET Core diagnostics walk throughs](diagnostic-scenarios.md) are designed to highlight key use cases.
10 changes: 5 additions & 5 deletions docs/toc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -282,15 +282,15 @@
- name: .NET Core diagnostics walk throughs
items:
- name: Overview
href: core/diagnostics/tutorial/diagnostic-scenarios.md
href: core/diagnostics/diagnostic-scenarios.md
- name: DiagnosticScenarios sample debug target
href: core/diagnostics/tutorial/sample-debug-target.md
href: core/diagnostics/sample-debug-target.md
- name: Debugging a memory leak
href: core/diagnostics/tutorial/app_is_leaking_memory_eventual_crash.md
href: core/diagnostics/app_is_leaking_memory_eventual_crash.md
- name: Debugging high CPU usage
href: core/diagnostics/tutorial/app_running_slow_highcpu.md
href: core/diagnostics/app_running_slow_highcpu.md
- name: Debugging deadlock
href: core/diagnostics/tutorial/hung_app.md
href: core/diagnostics/hung_app.md
- name: Unit Testing
href: core/testing/index.md
items:
Expand Down

0 comments on commit 91fcc7d

Please sign in to comment.