代码拉取完成,页面将自动刷新
dotnet-counters is a performance monitoring tool for ad-hoc health monitoring or 1st level performance investigation. It can observe performance counter values that are published via EventCounter
API (https://docs.microsoft.com/en-us/dotnet/api/system.diagnostics.tracing.eventcounter). For example, you can quickly monitor things like the CPU usage or the rate of exceptions being thrown in your .NET Core application to see if there is anything suspiscious before diving into more serious performance investigation using PerfView or dotnet-trace.
dotnet tool install --global dotnet-counters
SYNOPSIS
dotnet-counters [--version]
[-h, --help]
<command> [<args>]
OPTIONS
--version
Display the version of the dotnet-counters utility.
-h, --help
Show command line help
COMMANDS
list Display a list of counter names and descriptions
ps Display a list of dotnet processes that can be monitored
monitor Display periodically refreshing values of selected counters
collect Periodically collect selected counter values and export them into a specified file format for post-processing.
PS
dotnet-counters ps
Display a list of dotnet processes that can be monitored.
Examples:
> dotnet-counters ps
15683 WebApi /home/suwhang/repos/WebApi/WebApi
16324 dotnet /usr/local/share/dotnet/dotnet
LIST
dotnet-counters list [-h|--help]
Display a list of counter names and descriptions, grouped by provider.
-h, --help
Show command line help
Examples:
> dotnet-counters list
Showing well-known counters only. Specific processes may support additional counters.
System.Runtime
cpu-usage Amount of time the process has utilized the CPU (ms)
working-set Amount of working set used by the process (MB)
gc-heap-size Total heap size reported by the GC (MB)
gen-0-gc-count Number of Gen 0 GCs / sec
gen-1-gc-count Number of Gen 1 GCs / sec
gen-2-gc-count Number of Gen 2 GCs / sec
exception-count Number of Exceptions / sec
MONITOR
### Examples:
1. Monitoring all counters from `System.Runtime` at a refresh interval of 3 seconds:
> dotnet-counters monitor --process-id 1902 System.Runtime
Press p to pause, r to resume, q to quit.
System.Runtime:
CPU Usage (%) 24
Working Set (MB) 1982
GC Heap Size (MB) 811
Gen 0 GC / second 20
Gen 1 GC / second 4
Gen 1 GC / Second 1
Number of Exceptions / sec 4
2. Monitoring just CPU usage and GC heap size from `System.Runtime` at a refresh interval of 5 seconds:
> dotnet-counters monitor --process-id 1902 System.Runtime[cpu-usage,gc-heap-size,exception-count]
Press p to pause, r to resume, q to quit.
System.Runtime:
CPU Usage (%) 24
GC Heap Size (MB) 811
Number of Exceptions / sec 4
3. Monitoring EventCounter values from user-defined EventSource: (see https://github.com/dotnet/corefx/blob/master/src/System.Diagnostics.Tracing/documentation/EventCounterTutorial.md on how to do this.0)
> dotnet-counters monitor --process-id 1902 Samples-EventCounterDemos-Minimal
Press p to pause, r to resume, q to quit.
request 100
### Syntax:
dotnet-counters monitor [-h||--help]
[-p|--process-id <pid>]
[--refresh-interval <sec>]
counter_list
Display periodically refreshing values of selected counters
-h, --help
Show command line help
-p,--process-id
The ID of the process that will be monitored
--refresh-interval
The number of seconds to delay between updating the displayed counters
counter_list
A space separated list of counters. Counters can be specified provider_name[:counter_name]. If the
provider_name is used without a qualifying counter_name then all counters will be shown. To discover
provider and counter names, use the list command.
COLLECT
dotnet run collect --process-id 863148 --refresh-interval 10 --output test --format json
dotnet run collect --process-id 863148 --output mycounter --format csv System.Runtime Microsoft.AspNetCore.Hosting
### Syntax:
dotnet-counters collect [-h||--help]
[-p|--process-id <pid>]
[-o|--output <name>]
[--format <csv|json>]
[--refreshInterval <sec>]
counter_list
Periodically collect selected counter values and export them into a specified file format for post-processing.
-h, --help
Show command line help
-p,--process-id
The ID of the process that will be monitored
-o, --output
The name of the output file
--format
The format to be exported. Currently available: csv, json
--refresh-interval
The number of seconds to delay between updating the displayed counters
counter_list
A space separated list of counters. Counters can be specified provider_name[:counter_name]. If the
provider_name is used without a qualifying counter_name then all counters will be shown. To discover
provider and counter names, use the list command.
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。