< Back

Install-CPerformanceCounter

Sun Jan 12, 2020 10:19 pm

NAME Install-CPerformanceCounter



SYNOPSIS

Installs a performance counter.





SYNTAX

Install-CPerformanceCounter -CategoryName <String> -Name <String> [-Description <String>] -Type

{NumberOfItemsHEX32 | NumberOfItemsHEX64 | NumberOfItems32 | NumberOfItems64 | CounterDelta32 | CounterDelta64 |

SampleCounter | CountPerTimeInterval32 | CountPerTimeInterval64 | RateOfCountsPerSecond32 |

RateOfCountsPerSecond64 | RawFraction | CounterTimer | Timer100Ns | SampleFraction | CounterTimerInverse |

Timer100NsInverse | CounterMultiTimer | CounterMultiTimer100Ns | CounterMultiTimerInverse |

CounterMultiTimer100NsInverse | AverageTimer32 | ElapsedTime | AverageCount64 | SampleBase | AverageBase | RawBase

| CounterMultiBase} [-Force] [-WhatIf] [-Confirm] [<CommonParameters>]



Install-CPerformanceCounter -CategoryName <String> -Name <String> [-Description <String>] -Type

{NumberOfItemsHEX32 | NumberOfItemsHEX64 | NumberOfItems32 | NumberOfItems64 | CounterDelta32 | CounterDelta64 |

SampleCounter | CountPerTimeInterval32 | CountPerTimeInterval64 | RateOfCountsPerSecond32 |

RateOfCountsPerSecond64 | RawFraction | CounterTimer | Timer100Ns | SampleFraction | CounterTimerInverse |

Timer100NsInverse | CounterMultiTimer | CounterMultiTimer100Ns | CounterMultiTimerInverse |

CounterMultiTimer100NsInverse | AverageTimer32 | ElapsedTime | AverageCount64 | SampleBase | AverageBase | RawBase

| CounterMultiBase} -BaseName <String> [-BaseDescription <String>] -BaseType {NumberOfItemsHEX32 |

NumberOfItemsHEX64 | NumberOfItems32 | NumberOfItems64 | CounterDelta32 | CounterDelta64 | SampleCounter |

CountPerTimeInterval32 | CountPerTimeInterval64 | RateOfCountsPerSecond32 | RateOfCountsPerSecond64 | RawFraction

| CounterTimer | Timer100Ns | SampleFraction | CounterTimerInverse | Timer100NsInverse | CounterMultiTimer |

CounterMultiTimer100Ns | CounterMultiTimerInverse | CounterMultiTimer100NsInverse | AverageTimer32 | ElapsedTime |

AverageCount64 | SampleBase | AverageBase | RawBase | CounterMultiBase} [-Force] [-WhatIf] [-Confirm]

[<CommonParameters>]





DESCRIPTION

Creates a new performance counter with a specific name, description, and type under a given category. The

counter's category is re-created: its current counters are retrieved, the category is removed, a the category is

re-created. Unfortunately, we haven't been able to find any .NET APIs that allow us to delete and create an

existing counter.



If you're creating a performance counter that relies on an accompanying base counter, use the `BaseName`,

`BaseDescription`, and `BaseType` parameters to properly add the base counter.





PARAMETERS

-CategoryName <String>

The category's name where the counter will be created.



Required? true

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-Name <String>

The performance counter's name.



Required? true

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-Description <String>

The performance counter's description (i.e. help message).



Required? false

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-Type

The performance counter's type (from the Diagnostics.PerformanceCounterType enumeration).



Required? true

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-BaseName <String>

The base performance counter's name.



Required? true

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-BaseDescription <String>

The base performance counter's description (i.e. help message).



Required? false

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-BaseType

The base performance counter's type (from the Diagnostics.PerformanceCounterType enumeration).



Required? true

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-Force [<SwitchParameter>]

Re-create the performance counter even if it already exists.



Required? false

Position? named

Default value False

Accept pipeline input? false

Accept wildcard characters? false



-WhatIf [<SwitchParameter>]



Required? false

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-Confirm [<SwitchParameter>]



Required? false

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



<CommonParameters>

This cmdlet supports the common parameters: Verbose, Debug,

ErrorAction, ErrorVariable, WarningAction, WarningVariable,

OutBuffer, PipelineVariable, and OutVariable. For more information, see

about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216).



INPUTS



OUTPUTS



-------------------------- EXAMPLE 1 --------------------------



PS C:\\>Install-CPerformanceCounter -CategoryName ToyotaCamry -Name MilesPerGallon -Description 'The miles per

gallon fuel efficiency.' -Type NumberOfItems32



Creates a new miles per gallon performance counter for the ToyotaCamry category.









-------------------------- EXAMPLE 2 --------------------------



PS C:\\>Install-CPerformanceCounter -CategoryName "Dispatcher" -Name "Average Dispatch time" -Type AverageTimer32

-BaseName "Average Dispatch Base" -BaseType AverageBase -Force



Creates a counter to collect average timings, with a base counter. Some counters require base counters, which

have to be added a specific way to work properly.











RELATED LINKS

http://msdn.microsoft.com/en-us/library ... rtype.aspx