问题
I have a .net video processing application, that, when given a large streaming image sequence (a video) is sometimes not delivering a real time frame rate on the output. The processing steps include executing several methods on an incoming frame. What is an effective way (maybe a ready to use library) in .net to profile method execution? (know exactly which method took how much time to see at what step we have a jams)
回答1:
Ideally, using a profiler. Try Equatec, ANTS or dotTrace.
If you just some quick and dirty output, the Stopwatch class gives you high-res timing stats. Just new one up, start and stop and check the Elapsed property.
来源:https://stackoverflow.com/questions/9692001/effective-way-of-measuring-method-execution-time