14 December 2013, 20:56 | #1 |
Registered User
Join Date: Aug 2004
Location:
Posts: 3,349
|
Profiling WinUAE with Visual Studio 2013
I've been playing/experimenting with the profiling facility in Visual Studio 2013.
In my Windows 7 VirtualBox VM I couldn't get the sampling method to work; no samples are captured. Am I doing something wrong or is VirtualBox incompatible with Visual Studio sampling? [With sampling, Visual Studio would periodically check which function is being run. Over time it builds up a statistical picture of the functions which use most CPU time.] The instrumentation profiling method did work. With that method, a special version of the executable is built, which allows all function calls (and the time taken for each) to be recorded and analysed. However that logging adds a significant amount of overhead to the program. On starting the instrumented winuae.exe, it takes ages (like about 10 minutes) until the settings window appears. While that isn't a big issue for the normal winuae.exe, maybe this has shown up something which could improve startup time slightly. The profiling results showed a huge number of calls to free() in this code path: default_prefs() ⇒ inputdevice_default_prefs() ⇒ inputdevice_default_kb_all() ⇒ set_kbr_default() ⇒ clear_id() ⇒ xfree() Take a look at clear_id(): Code:
static void clear_id (struct uae_input_device *id) { #ifndef _DEBUG int i, j; for (i = 0; i < MAX_INPUT_DEVICE_EVENTS; i++) { for (j = 0; j < MAX_INPUT_SUB_EVENT_ALL; j++) xfree (id->custom[i][j]); } #endif TCHAR *cn = id->configname; TCHAR *n = id->name; memset (id, 0, sizeof (struct uae_input_device)); id->configname = cn; id->name = n; } Code:
for (i = 0; i < MAX_INPUT_DEVICE_EVENTS; i++) { clear_id (kbr); kbr->extra[i] = -1; } |
15 December 2013, 16:39 | #2 |
WinUAE developer
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 49
Posts: 26,573
|
AFAIK there is option to disable part of c-library allocation function tracing which is the horribly slow part.
I am not going to add extra "if (address) free(address)" because first function of free() is NULL check! |
15 December 2013, 19:42 | #3 |
Registered User
Join Date: Aug 2004
Location:
Posts: 3,349
|
clear_id() basically does this:
- free all memory entries in the custom[][] array - zero out the entire uae_input_device structure, except for configname and name fields. In set_kbr_default() there is this though: Code:
for (i = 0; i < MAX_INPUT_DEVICE_EVENTS; i++) { clear_id (kbr); kbr->extra[i] = -1; } So, would it make sense to move clear_id(kbr) out of the loop, doing this instead: Code:
clear_id (kbr); for (i = 0; i < MAX_INPUT_DEVICE_EVENTS; i++) { kbr->extra[i] = -1; } Last edited by mark_k; 15 December 2013 at 21:31. |
14 January 2014, 20:26 | #4 |
Registered User
Join Date: Aug 2004
Location:
Posts: 3,349
|
I found a blog post from the Visual Studio Profile Team which mentions using profiling in virtual environments. Looks like Visual Studio specifically supports VMWare, Hyper-V and Virtual PC. So it is possible to use the sampling profiling method, just not in VirtualBox.
So was the issue I noted in set_kbr_default() a bug? |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Visual FX for imagefx | amiga | request.Apps | 3 | 14 October 2020 21:02 |
Experimental/testing builds of WinUAE 2.7.0 with VS 2013 | mark_k | support.WinUAE | 18 | 09 September 2014 22:26 |
Deluxe Galaga on Amiga Forever 2013/WinUAE problem | letsplayac | support.Games | 3 | 29 August 2013 20:22 |
Deli's guide to capture WinUAE output with Camtasia Studio | NewDeli | support.WinUAE | 91 | 13 November 2009 10:54 |
amiga visual editor | thinlega | request.Apps | 1 | 22 January 2003 15:48 |
|
|