有什么方法可以监控正在发生的 CAS stackwalk 数量吗?
我正在使用一个对时间敏感的桌面应用程序,该应用程序广泛使用 p/invoke,并且我想确保代码不会在 CAS stackwalks 上浪费大量时间。
我在我认为必要的地方使用了 SuppressUnmanagedCodeSecurity 属性,但我可能错过了一些地方。有谁知道是否有一种方法可以监控正在发生的 CAS stackwalks 的数量,并更好地查明安全需求的来源?
I'm working with a time sensitive desktop application that uses p/invoke extensively, and I want to make sure that the code is not wasting a lot of time on CAS stackwalks.
I have used the SuppressUnmanagedCodeSecurity attribute where I think it is necessary, but I might have missed a few places. Does anyone know if there is a way to monitor the number of CAS stackwalks that are occurring, and better yet pinpoint the source of the security demands?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以使用 Process Explorer 工具(来自 Sysinternals)来监视您的进程。
打开 Process Explorer,选择您的进程并右键单击以显示“属性”。然后,在 .NET 选项卡上,选择要监视的 .NET CLR 安全对象。 Process Explorer 将显示
链接时间检查
这些是此处描述的标准安全性能计数器 ->
http://msdn.microsoft.com/en-us/library/adcbwb64。 aspx
您还可以使用 Perfmon 或编写自己的代码来监视这些计数器。
据我所知,唯一真正有用的是第 1 项。您可以在调试时密切关注它,看看它是否大幅增加。如果是这样,您需要检查是什么导致了安全需求。
我不知道有任何其他工具可以告诉您何时触发 stackwalk。
You can use the Process Explorer tool (from Sysinternals) to monitor your process.
Bring up Process Explorer, select your process and right click to show "Properties". Then, on the .NET tab, select the .NET CLR Security object to monitor. Process Explorer will show counters for
Link Time Checks
These are standard security performance counters described here ->
http://msdn.microsoft.com/en-us/library/adcbwb64.aspx
You could also use Perfmon or write your own code to monitor these counters.
As far as I can tell, the only one that is really useful is item 1. You could keep an eye on that while you are debugging to see if it is increasing substantially. If so, you need to examine what is causing the security demands.
I don't know of any other tools that will tell you when a stackwalk is being triggered.