Avatar

Please consider registering
Guest

sp_LogInOut Log In sp_Registration Register

Register | Lost password?
Advanced Search

— Forum Scope —




— Match —





— Forum Options —





Minimum search word length is 3 characters - maximum search word length is 84 characters

sp_Feed sp_TopicIcon
Any way to profile plugin code developed with RackAFX/VS Express?
No permission to create posts
August 19, 2014
10:03 am
Avatar
mtpadilla
California
Member
Members
Forum Posts: 11
Member Since:
February 26, 2014
sp_UserOfflineSmall Offline

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?

Cheers,
Michael

August 26, 2014
6:34 pm
Avatar
W Pirkle
Admin
Forum Posts: 143
Member Since:
January 28, 2017
sp_UserOfflineSmall Offline

Hi Michael

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 (!!).

- Will

September 6, 2014
7:55 pm
Avatar
mtpadilla
California
Member
Members
Forum Posts: 11
Member Since:
February 26, 2014
sp_UserOfflineSmall Offline

Hi Will,

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.

Thanks again!

Michael

Forum Timezone: America/New_York

Most Users Ever Online: 36

Currently Online:
3 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

Skyler: 47

Peter: 41

Derek: 41

clau_ste: 39

Frodson: 38

Gwen: 32

EZB: 24

lppier: 23

Msaldaña: 18

Jorge: 17

Member Stats:

Guest Posters: 1

Members: 476

Moderators: 1

Admins: 4

Forum Stats:

Groups: 11

Forums: 30

Topics: 482

Posts: 1876

Newest Members:

sam, annaharris, Marie Weaver, kev, Steven, Mr Anderson, mguy, omelc

Moderators: W Pirkle: 143

Administrators: Tom: 65, JD Young: 80, Will Pirkle: 0, W Pirkle: 143