编组性能计数器的数量
我正在尝试确定 COM 互操作是否正在成为我的软件中的瓶颈。 MSDN 上的这篇文章可帮助 http://msdn.microsoft.com/en -us/library/ms998579.aspx#scalenetchapt15_topic11。但我确实没有编组数的“正常”或“高”值的参考点来确定它是否影响性能。谁能给我一个这个性能计数器的阈值,就像 MSDN 为本文中的其他性能计数器提供的阈值一样。我知道这是一个硬件和应用程序特定的问题,但任何帮助将不胜感激。
I am trying to determine if the COM interop is becoming a bottle neck in my software. This article on MSDN helps http://msdn.microsoft.com/en-us/library/ms998579.aspx#scalenetchapt15_topic11. But I really do not have have a point of reference for a "normal" or "high" value for # of marshalling to determine if it is impacting performance. Can anyone give me a threshold for this performance counter like MSDN gives for other performance counters in the article. I know this is a hardware and application specific question but any help would be appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我认为不可能指出编组的具体阈值。它取决于应用程序。您应该做的是测量每个呼叫平均花费多长时间。编写一个测试应用程序,只需对非托管代码进行一系列调用并对其进行计时。然后使用应用程序上的“Chattiness”计数器,您应该能够估计托管代码和非托管代码之间切换的总成本。
几年前我就必须做这件事。我使用非托管 DLL 从数据块中读取值。我测量了调用次数,发现由于调用次数较多,其成本相对较高,因此我进行了一次调用来检索数据块,然后从托管代码中的数据中提取值。编码工作量更大,但速度显着提高。
I don't think it is possible to indicate a specific threshold for marshalling. It is application dependent. What you should do is measure how long each call takes on average. Write a test application that simply makes a bunch of calls to unmanaged code and time it. Then using the "Chattiness" counter on your application, you should be able to estimate the total cost of the switches between managed and unmanaged code.
I had to do this exact thing a couple of years ago. I was using an unmanaged DLL to read values from a chunk of data. I measured the calls and found it to be relatively expensive due to the high number of calls, so I made a single call to retrieve the chunk of data and then extracted the values from that data in managed code. It was more work to code but provided a fairly significant speed increase.