我想知道是否存在用于精确时间测量的".net集成"解决方案(如功能的执行时间)?目前我正在使用Kernel32中的PerformanceCounters.
[DllImport("Kernel32.dll")]
private static extern bool QueryPerformanceCounter(
out long lpPerformanceCount);
[DllImport("Kernel32.dll")]
private static extern bool QueryPerformanceFrequency(
out long lpFrequency);
Run Code Online (Sandbox Code Playgroud) 我们发现,从今天开始,“% Time in GC”(垃圾收集器中的时间百分比)性能计时器稳定地保持在 100%,只是偶尔会稍低一些。即使在晚上也没有访客在线。
然后我把它放在App_Offline.htm根目录下。通常这会导致所有 ASP.NET 活动停止。但由于某些奇怪的原因,“GC 时间百分比”虽然降低至 34%,但仍保持稳定。
我在这里寻找明显的东西吗?其他一些与 GC 相关的性能计数器似乎仍然起作用,但作用不大。
编辑:我写的是“只有今天”,但实际上是“从今天开始”。从那以后它就没有消失过。
在IIS中托管的ASP.NET应用程序的压力/负载测试期间,我应该在应用服务器上监控什么?
例如,Windows中内置的实用程序性能监视器有一个巨大的计数器列表,我可以监视.但是,我甚至不知道这些计数器中有一半实际上是什么意思?我知道我想看看内存,处理器,网络......但它很通用.
我怎样才能成功找到问题区域?
你们中的一些人过去使用了什么?
我有这个简单的代码:
public void CreateCounters() {
if (PerformanceCounterCategory.Exists(_categoryName)) {
PerformanceCounterCategory.Delete(_categoryName);
}
// create logic…
}
Run Code Online (Sandbox Code Playgroud)
适用于我的机器.我在我的服务器上运行它,得到以下堆栈跟踪:
System has detected a fatal error. EXITING...
NativeErrorCode: 1010
ErrorCode: -2147467259
Message: The configuration registry key is invalid
TargetSite: Void RegisterFiles(System.String, Boolean)
HelpLink:
Source: System
Stack Trace:
at System.Diagnostics.PerformanceCounterLib.RegisterFiles(String arg0, Boolean unregister)
at System.Diagnostics.PerformanceCounterCategory.Delete(String categoryName)
at myApp.Common.Utils.PerformanceCounters.PerformanceCounters.CreateCounters()
at myApp.Common.Utils.PerformanceCounters.myAppPerformanceCounterReporter.Init()
at myApp.Common.Utils.PerformanceCounters.myAppPerformanceCounterReporter.get_Instance()
at myApp.Program.Main(String[] args)
Run Code Online (Sandbox Code Playgroud)
该类别存在于服务器上,我可以在perfmonGUI中看到它.
我正在计算几台服务器上的CPU使用率.但计算非常非常缓慢.
到目前为止,这是我的代码:
While it <= 5
Dim myOptions As New ConnectionOptions
myOptions.Username = _myParameters("user")
myOptions.Password = _myParameters("password")
Dim myRoot As String = "\\" & _myParameters("server") & "\root\cimv2"
Dim myScope As New ManagementScope(myRoot, myOptions)
Dim myQuery As New ObjectQuery(String.Format("select * from Win32_Processor"))
Dim mySearcher As New ManagementObjectSearcher(myScope, myQuery)
Dim myCollection As ManagementObjectCollection = mySearcher.Get
For Each OS As ManagementObject In myCollection
values.Add(OS("LoadPercentage"))
Next
Threading.Thread.Sleep(100) //Set some time between two calculations
itCounter += 1
End While
Run Code Online (Sandbox Code Playgroud)
代码每次都挂起
For Each OS As ManagementObject …Run Code Online (Sandbox Code Playgroud) 我正在尝试将一些系统监视功能添加到我正在处理的WPF应用程序中,并且我想添加一个带宽使用监视器.现在我有一个CPU和一个RAM计数器工作,但我无法弄清楚什么用于性能计数器实例名称(抱歉,如果这不是正确的术语).这是我到目前为止使用的:
PerformanceCounter cpuCounter = new PerformanceCounter("Processor", "% Processor Time", "_Total");
PerformanceCounter ramCounter = new PerformanceCounter("Memory", "Available MBytes", string.Empty);
PerformanceCounter netSentCounter = new PerformanceCounter("Network Interface", "Bytes Received/sec", );
PerformanceCounter netRecCounter = new PerformanceCounter("Network Interface", "Bytes Sent/sec", );
Run Code Online (Sandbox Code Playgroud)
我有一个字符串,使用计时器刻度方法每1秒更新一次,更新我的WPF标签,RAM和CPU计数器工作,但我不知道如何为最后两个网络接口的实例名称.
提前致谢.
我试图了解 perf 记录的缓存未命中。我有一个最小的程序:
int main(void)
{
return 0;
}
Run Code Online (Sandbox Code Playgroud)
如果我编译这个:
gcc -std=c99 -W -Wall -Werror -O3 -S -o test.S test.c
Run Code Online (Sandbox Code Playgroud)
我得到了一个预期的小程序:
.file "test.c"
.section .text.startup,"ax",@progbits
.p2align 4,,15
.globl main
.type main, @function
main:
.LFB0:
.cfi_startproc
xorl %eax, %eax
ret
.cfi_endproc
.LFE0:
.size main, .-main
.ident "GCC: (Debian 4.7.2-5) 4.7.2"
.section .note.GNU-stack,"",@progbits
Run Code Online (Sandbox Code Playgroud)
只有两条指令, xorland ret,程序的大小应该小于一个缓存行,所以我希望如果我运行perf -e "cache-misses:u" ./test我应该只看到一个缓存未命中。但是,我看到的是 2 到 ~400。同样,perf -e "cache-misses" ./test结果是 ~700 到 ~2500。
这只是一个估计计数的情况,还是缓存未命中发生的方式使对它们的推理近似?例如,如果我生成并读取内存中的一个整数数组,我是否可以推理预取(顺序访问应该允许完美预取)或者还有其他东西在起作用吗?
我想在一段时间内捕获我的应用程序进程的CPU,内存,线程数,以分析是否有任何进程使用更多的CPU,内存消耗.我们怎样才能实现这一目标.
L3-misses我使用以下命令在简单的基准测试中提取导致用户级别的回溯evince:
sudo perf record -d --call-graph dwarf -c 10000 -e mem_load_uops_retired.l3_miss:uppp /opt/evince-3.28.4/bin/evince
Run Code Online (Sandbox Code Playgroud)
很明显,采样周期相当大(连续采样之间有 10000 个事件)。对于这个实验, 的输出perf script有一些与此类似的样本:
EvJobScheduler 27529 26441.375932: 10000 mem_load_uops_retired.l3_miss:uppp: 7fffcd5d8ec0 5080022 N/A|SNP N/A|TLB N/A|LCK N/A
7ffff17bec7f bits_image_fetch_separable_convolution_affine+0x2df (inlined)
7ffff17bec7f bits_image_fetch_separable_convolution_affine_pad_x8r8g8b8+0x2df (/usr/lib/x86_64-linux-gnu/libpixman-1.so.0.34.0)
7ffff17d1fd1 general_composite_rect+0x301 (/usr/lib/x86_64-linux-gnu/libpixman-1.so.0.34.0)
ffffffffffffffff [unknown] ([unknown])
Run Code Online (Sandbox Code Playgroud)
在回溯的底部,有一个名为 的符号[unknown],看起来没问题。但随后就呼叫了线路general_composite_rect()。这个回溯OK吗?
AFAIK,回溯中的第一个调用者应该是类似_start()或 的东西__GI___clone()。但回溯不是这种形式。怎么了?
有什么办法可以解决这个问题吗?截断的(部分)回溯可靠吗?
我们可以获取IIS7中输出缓存的URL列表吗?
我试图弄清楚它在我们的服务器中的使用效率.
请参阅显示性能计数器的附加截图. 
.net ×3
c# ×3
caching ×2
perf ×2
perfmon ×2
performance ×2
asp.net ×1
call-graph ×1
cpu-usage ×1
iis-7 ×1
jmeter ×1
linux ×1
load-testing ×1
outputcache ×1
trace ×1
vb.net ×1
wpf ×1