views:

289

answers:

1

Is there a .NET performance counter to show the rate of p/invoke calls made? I've just noticed that the application I'm debugging was making a call into native code from managed land within a tight loop. The intended implementation was for a p/invoke call to be made once and then cached. I'm wondering if I could have noticed this mistake via a CLR Interop or Remoting .NET performance counter. Any ideas?

+2  A: 

Try the ".NET CLR Interop" for "# of marshalling" performance counter.

See this article for more http://msdn.microsoft.com/en-us/library/ms998551.aspx.

Bob King
Many of the pinvoke calls don't have parameters to be marshaled; Do you know if the "# of marshalling" counter is affected then?
Jeffrey LeCours
Unfortunately, I haven't used it enough to know for sure.
Bob King