Reputation: 17492
I was wondering if its possible to check how frequently, in terms of an accurate timespan, a certain method gets executed in C#?
For example I have a device (a microphone), and once I start the microphone, its StartCollectingSamples
event is fired which will in turn start invoking the Microphone_CollectSampleData()
method.
How can I check how frequently this event is being raised? I place a breakpoint on Microphone_CollectSampleData()
and it seems to get executed very frequently, possible 2/3 times a second, but how can I get that accurate time value?
Upvotes: 0
Views: 218
Reputation: 2123
Depending on the version of the visual studio you got, you can use the provided profiler, to analyze how many time each method is executed, how long it runs, etc. There are other, non microsoft products, which aim to do the same, such as antz profiler, but they usually cost money after a trial period.
Upvotes: 2