Previous Thread
Next Thread
Print Thread
#111011 - 10/09/17 09:46 PM Compile stats  
Joined: Feb 2014
Posts: 109
Golden Child Offline
Senior Member
Golden Child  Offline
Senior Member

Joined: Feb 2014
Posts: 109
So it's fun to know how long and how many resources a compile takes:

I'm using ubuntu 17.04.

you can use the shell's built in time command

time make -j4

and that will put out something like:

time make -j4
GCC 6.3.0 detected
Compiling src/emu/natkeyboard.cpp...
Archiving libemu.a...
Linking mame64...

real 0m20.428s
user 0m18.012s
sys 0m2.448s

but how much memory does it take?

let's use /usr/bin/time

/usr/bin/time make -j4
GCC 6.3.0 detected
Compiling src/emu/natkeyboard.cpp...
Archiving libemu.a...
Linking mame64...
18.06user 2.48system 0:27.43elapsed 74%CPU (0avgtext+0avgdata 1705048maxresident)k
104176inputs+560208outputs (1146major+1002703minor)pagefaults 0swaps

and if you want a verbose output use

/usr/bin/time --verbose make -j4

and for a full make of mame 0190 on a Intel Core i3-3220 CPU @ 3.30GHz × 4 takes about 55 minutes.

/usr/bin/time --verbose make -j4
GCC 6.3.0 detected
...
Compiling src/mame/mame.cpp...
Compiling generated/version.cpp...
Building driver list...
34618 driver(s) found
Compiling generated/mame/mame/drivlist.cpp...
Linking mame64...
Command being timed: "make -j4"
User time (seconds): 11907.65
System time (seconds): 557.14
Percent of CPU this job got: 376%
Elapsed (wall clock) time (h:mm:ss or m:ss): 55:08.90
Average shared text size (kbytes): 0
Average unshared data size (kbytes): 0
Average stack size (kbytes): 0
Average total size (kbytes): 0
Maximum resident set size (kbytes): 2241060
Average resident set size (kbytes): 0
Major (requiring I/O) page faults: 1547
Minor (reclaiming a frame) page faults: 221300921
Voluntary context switches: 385912
Involuntary context switches: 1218757
Swaps: 0
File system inputs: 472136
File system outputs: 5079616
Socket messages sent: 0
Socket messages received: 0
Signals delivered: 0
Page size (bytes): 4096
Exit status: 0

#111012 - 10/10/17 01:40 AM Re: Compile stats [Re: Golden Child]  
Joined: Feb 2004
Posts: 1,872
Vas Crabb Offline
Very Senior Member
Vas Crabb  Offline
Very Senior Member

Joined: Feb 2004
Posts: 1,872
Sydney, Australia
luaengine.cpp is the killer - why not profile that? wink

#111021 - 10/10/17 01:00 PM Re: Compile stats [Re: Vas Crabb]  
Joined: Feb 2014
Posts: 109
Golden Child Offline
Senior Member
Golden Child  Offline
Senior Member

Joined: Feb 2014
Posts: 109
How do I profile luaengine.cpp?



full compile latest git pull on an Intel Core i5 CPU 750 @ 2.67GHz x 4 cores takes 43 minutes

make clean
/usr/bin/time --verbose make -j4
GCC 6.3.0 detected
...
Building driver list...
34621 driver(s) found
Compiling generated/mame/mame/drivlist.cpp...
Linking mame64...
Command being timed: "make -j4"
User time (seconds): 8749.88
System time (seconds): 509.38
Percent of CPU this job got: 358%
Elapsed (wall clock) time (h:mm:ss or m:ss): 42:59.68
Average shared text size (kbytes): 0
Average unshared data size (kbytes): 0
Average stack size (kbytes): 0
Average total size (kbytes): 0
Maximum resident set size (kbytes): 2235824
Average resident set size (kbytes): 0
Major (requiring I/O) page faults: 7201
Minor (reclaiming a frame) page faults: 221822793
Voluntary context switches: 401964
Involuntary context switches: 1496542
Swaps: 0
File system inputs: 1993784
File system outputs: 5175168
Socket messages sent: 0
Socket messages received: 0
Signals delivered: 0
Page size (bytes): 4096
Exit status: 0

cat /proc/cpuinfo
processor : 0
vendor_id : GenuineIntel
cpu family : 6
model : 30
model name : Intel(R) Core(TM) i5 CPU 750 @ 2.67GHz
stepping : 5
microcode : 0x7
cpu MHz : 2799.000
cache size : 8192 KB
physical id : 0
siblings : 4
core id : 0
cpu cores : 4
apicid : 0
initial apicid : 0
fpu : yes
fpu_exception : yes
cpuid level : 11
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx rdtscp lm constant_tsc arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc aperfmperf pni dtes64 monitor ds_cpl vmx smx est tm2 ssse3 cx16 xtpr pdcm sse4_1 sse4_2 popcnt lahf_lm tpr_shadow vnmi flexpriority ept vpid dtherm ida
bugs :
bogomips : 5320.30
clflush size : 64
cache_alignment : 64
address sizes : 36 bits physical, 48 bits virtual
power management:

#111225 - 11/03/17 12:37 AM Re: Compile stats [Re: Golden Child]  
Joined: Feb 2014
Posts: 109
Golden Child Offline
Senior Member
Golden Child  Offline
Senior Member

Joined: Feb 2014
Posts: 109
For fun, I dug out my old Toshiba Laptop with a 32 bit processor to see how mame would do a full compile with Ubuntu 16.04 LTS.

Genuine Intel® CPU U2500 @ 1.20GHz × 2
32 bit
2.0 GiB
Ubuntu 16.04 LTS
compiling mame191

I fell asleep waiting and the computer went to sleep due to inactivity, but it said about 5 hours of elapsed time. I would guess somewhere around 3 hours since 21997 cpu seconds/ 2 cores/ 3600 seconds per hour = 3.05 hours.

Code
/usr/bin/time make -j3
GCC 5.4.0 detected
...
Compiling src/mame/mame.cpp...
Compiling generated/version.cpp...
Building driver list...
34653 driver(s) found
Compiling generated/mame/mame/drivlist.cpp...
Linking mame...
21997.50user 1333.74system 5:04:54elapsed 127%CPU (0avgtext+0avgdata 1276864maxresident)k
3508360inputs+4227088outputs (8822major+151301401minor)pagefaults 0swaps



My cool discovery of the day is the -verbose option where it will tell you all about the compiler settings used to build mame.
Code
./mame pacman -rompath ../../mameroms/ -video opengl -verbose
Available videodrivers: x11 mir wayland dummy 
Current Videodriver: x11
	Display #0
		Renderdrivers:
			    opengl (0x0)
			 opengles2 (0x0)
			  software (0x0)
Available audio drivers: 
	pulseaudio          
	alsa                
	sndio               
	dsp                 
	disk                
	dummy               
Build version:      0.191 (unknown)
Build architecure:  
Build defines 1:    SDLMAME_UNIX=1 SDLMAME_X11=1 SDLMAME_LINUX=1 
Build defines 1:    LSB_FIRST=1 
SDL/OpenGL defines: SDL_COMPILEDVERSION=2004 USE_OPENGL=1 
Compiler defines A: __GNUC__=5 __GNUC_MINOR__=4 __GNUC_PATCHLEVEL__=0 __VERSION__="5.4.0 20160609" 
Compiler defines B: __unix__=1 __i386__=1 
Compiler defines C: __USE_FORTIFY_LEVEL=0 
Enter init_monitors
Adding monitor screen0 (1280 x 800)
Leave init_monitors
Enter sdlwindow_init
Using SDL multi-window OpenGL driver (SDL 2.0+)
... <snip>

GL texture: copy 1, shader 0, dynamic 1, 288x224 288x224 [PALETTE16, Equal: 0, Palette: 1,
            scale 1x1, border 0, pitch 384,288/2048], bytes/pix 4
GL texture: copy 1, shader 0, dynamic 1, 288x224 288x224 [PALETTE16, Equal: 0, Palette: 1,
            scale 1x1, border 0, pitch 384,288/2048], bytes/pix 4
Average speed: 100.00% (7 seconds)
sdl_kill: closing audio
Enter sdlwindow_exit
Leave sdlwindow_exit

#111344 - 11/23/17 05:18 PM Re: Compile stats [Re: Vas Crabb]  
Joined: Feb 2014
Posts: 109
Golden Child Offline
Senior Member
Golden Child  Offline
Senior Member

Joined: Feb 2014
Posts: 109
Originally Posted by Vas Crabb
luaengine.cpp is the killer - why not profile that? wink


Ok, if I make any change to luaengine.cpp (even just typing a space character) or enabling SOL_CHECK_ARGUMENTS for example:

Code
#define SOL_CHECK_ARGUMENTS
#include "sol2/sol.hpp"

Let's see how long it takes to re-compile and link,
Code
time make -j5
GCC 7 detected
Compiling src/frontend/mame/luaengine.cpp...
Compiling src/frontend/mame/clifront.cpp...
Compiling src/frontend/mame/mame.cpp...
Compiling src/frontend/mame/ui/datmenu.cpp...
Compiling src/frontend/mame/ui/mainmenu.cpp...
Compiling src/frontend/mame/ui/pluginopt.cpp...
Compiling src/frontend/mame/ui/selgame.cpp...
Compiling src/frontend/mame/ui/selmenu.cpp...
Compiling src/frontend/mame/ui/selsoft.cpp...
Compiling src/frontend/mame/ui/ui.cpp...
Archiving libfrontend.a...
Linking mame64...

real	2m2.940s
user	2m21.165s
sys	0m6.695s


Code
cat /proc/cpuinfo
processor	: 0
vendor_id	: GenuineIntel
cpu family	: 6
model		: 58
model name	: Intel(R) Core(TM) i3-3220 CPU @ 3.30GHz
stepping	: 9
microcode	: 0x1c
cpu MHz		: 3292.334


Moderated by  R. Belmont 

Who's Online Now
2 registered members (phulshof, r09), 12 guests, and 3 spiders.
Key: Admin, Global Mod, Mod
Shout Box
Forum Statistics
Forums9
Topics8,453
Posts109,705
Members4,766
Most Online225
May 26th, 2014
Powered by UBB.threads™ PHP Forum Software 7.6.0
Page Time: 0.023s Queries: 15 (0.007s) Memory: 4.9633 MB (Peak: 5.1485 MB) Zlib enabled. Server Time: 2017-12-12 10:22:26 UTC