English 中文(简体)
如何对C#应用程序中失效的指令进行采样
原标题:how to sample instructions retired from C# application

我想从C#应用程序的英特尔芯片中采样硬件事件“指令失效”或“独占指令失效”。

具体来说,我需要在函数调用的开头和结尾对这个数字进行采样,因此根据本文在visualstudio2010中使用cpu计数器运行评测:

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

没有帮助。使用CPU计数器并运行采样配置文件,您可以获得整个应用程序的失效指令总数。我不能重新组装这个应用程序只调用这个函数,所以我需要更具体地说明这个指令失效示例的“开始”和“结束”。

有人知道某些程序集指令会读取指令失效硬件事件吗?据推测,如果这是可用的,我可以以某种方式直接从C#方法的开头和结尾调用这个汇编指令。

问题回答

PAPI是一个非常有前景的线索,然而,我相信他们在几年前就停止了对Windows(因此也停止了对.NET C#)的支持。

在窗口方面,Visual Studio 2010 Premium附带了性能资源管理器。如果在检测模式下运行任何项目或二进制文件,则可以访问硬件事件,例如失效的指令。

根据外部因素的不同,结果可能有些混合和不一致,但它与Visual Studio很好地集成在一起,您可以在每个方法/模块级别上获得详细的计数(平均值、最大值、总数)。

Intel V-tune性能分析器也在本机上公开了这些特性。我还没有使用过这个工具,但它可能是一个比VisualStudio2010公开的更灵活的API。





相关问题
Anyone feel like passing it forward?

I m the only developer in my company, and am getting along well as an autodidact, but I know I m missing out on the education one gets from working with and having code reviewed by more senior devs. ...

NSArray s, Primitive types and Boxing Oh My!

I m pretty new to the Objective-C world and I have a long history with .net/C# so naturally I m inclined to use my C# wits. Now here s the question: I feel really inclined to create some type of ...

C# Marshal / Pinvoke CBitmap?

I cannot figure out how to marshal a C++ CBitmap to a C# Bitmap or Image class. My import looks like this: [DllImport(@"test.dll", CharSet = CharSet.Unicode)] public static extern IntPtr ...

How to Use Ghostscript DLL to convert PDF to PDF/A

How to user GhostScript DLL to convert PDF to PDF/A. I know I kind of have to call the exported function of gsdll32.dll whose name is gsapi_init_with_args, but how do i pass the right arguments? BTW, ...

Linqy no matchy

Maybe it s something I m doing wrong. I m just learning Linq because I m bored. And so far so good. I made a little program and it basically just outputs all matches (foreach) into a label control. ...

热门标签