gpt4 book ai didi

performance - 在Powershell脚本或命令行中创建和编辑性能计数器

转载 作者:行者123 更新时间:2023-12-03 14:58:00 25 4
gpt4 key购买 nike

我正在尝试将性能计数器组以及计数器本身的验证和创建从Web服务中移出,并移到在部署期间运行的Powershell脚本中。

能做到吗?还是我坚持使用简单的应用程序来构建群组和计数器?

非常感谢 :)

最佳答案

前一段时间想通了,但从未发布过。
这是我的解决方案:

//save out the type name for sanity's sake
$ccdTypeName = 'System.Diagnostics.CounterCreationData'
$CounterCollection = New-Object System.Diagnostics.CounterCreationDataCollection

//create as many counters as we'd like, and add them to the collection. here's just one:
$CounterCollection.Add( (New-Object $ccdTypeName "Counter Name", "Counter Description", NumberOfItems32) )

//create the category with the counter collection
[System.Diagnostics.PerformanceCounterCategory]::Create($perfCounterCategoryName, $perfCounterVersion, [Diagnostics.PerformanceCounterCategoryType]::SingleInstance, $CounterCollection);

关于performance - 在Powershell脚本或命令行中创建和编辑性能计数器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3605146/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com