February 26, 2014
Does anyone know of a way to run a profiler for plugin code developed with RackAFX/Visual Studio Express? I'd love to be able to have some kind of profiler functionality be able to analyze what in my code is taking the most time, etc. in order to help better understand and optimize what's going on.
Searching around online however indicates that Visual Studio Express doesn't provide this functionality. However, I'm wondering if anyone has figured out a way to do something like this in their setup?
January 29, 2017
A very old trick for profiling operations uses a low level Windows function called GetTickCount(). It returns a DWORD that is the number of milliseconds that have elapsed since the computer was turned on (info here: http://msdn.microsoft.com/en-u.....8(v=vs.85).aspx)
While the absolute resolution depends on the computer, you can use this to track down how much time a given loop, function call. etc... takes especially when the operation is very time intensive. To use it:
DWORD start = GetTickCount();
--- long, time intensive loops, function calls, etc here... ---
DWORD end = GetTickCount();
DWORD processTime = end - start;
The processTime is the number of milliseconds the operation required, so it only works for really time intensive operations. You can then use the RAFX built-in function uintToString() to convert it to a string and then write it to the RAFX Status window (see other reply to your other post).
You can also use this method to gauge which parts of your code are the time-intensive ones (where you are only looking at relative values and not the absolute milliseconds) by forming several sets of start/end timing combinations.
A few years ago, I had my students do a comparison of using the sin() function versus a wavetable lookup for CPU usage. They did loops of 250000 calls to sin() or the wavetable lookup and timed these ridiculously long loops with GetTickCount(). Outcome - on today's processors with very efficient math logic units, wavetable lookups are actually no faster then the sin() function call. In some cases, they are slower (!!).
February 26, 2014
Thank you very much for your really useful suggestion on this (and sorry for the belated reply). I really appreciate it and have actually started using this.
In some related work, slightly unrelated to RackAFX, I had to do something similar but within the Mac environment. Perhaps outside the current scope of RackAFX and these Forums, but for anyone interested the corresponding function on the Mac would be mach_absolute_time() (declared in mach/mach_time.h) and you can get some details at https://developer.apple.com/library/mac/qa/qa1398/_index.html.
Most Users Ever Online: 36
Currently Browsing this Page:
Guest Posters: 1
Newest Members:Bill, hill william, NAUN_SONAR, sufy, Diane, Richard, drvenkman, venkman, Jfx, drorh
Moderators: W Pirkle: 247
Administrators: Tom: 67, JD Young: 80, Will Pirkle: 0, W Pirkle: 247