Skip to content

Instantly share code, notes, and snippets.

@Miss-Inputs
Last active November 18, 2020 00:55
Show Gist options
  • Save Miss-Inputs/95f83946c5170d0c8f2359e74c9d3dab to your computer and use it in GitHub Desktop.
Save Miss-Inputs/95f83946c5170d0c8f2359e74c9d3dab to your computer and use it in GitHub Desktop.
MAME benchmarker
#!/usr/bin/env python3
import csv
import re
import statistics
import subprocess
import sys
import xml.etree.ElementTree as ElementTree
systems = {
'1945k III Hardware': '1945kiii',
'Acclaim PSX': 'jdredd',
'Arcadia System': 'ar_rdwr', #May take a while to get from boot screen; all games on this hardware do
'Aristocrat MK4': '3bagflvt',
'Aristocrat MK5': 'chickna5',
'Arkanoid Hardware': 'arkanoid',
'Armed Formation Hardware': 'armedf',
'Art & Magic Hardware': 'cheesech',
'Asteroids Hardware': 'asteroid',
'Astrocade': 'robby',
'Atari 8-bit computers': 'xegs', #Includes builtin Missile Command
'Atari CoJag': 'area51',
'Atari Denver': 'sf2049', #Voodoo 3
'Atari Flagstaff': 'sfrush',
'Atari G1': 'hydra',
'Atari G42': 'guardian',
'Atari GT': 'primrage', #This has unemulated protection, but it seems to work okay at least for this purpose; tmek20 is the only set in atarigt.cpp that doesn't have MACHINE_UNEMULATED_PROTECTION but it does have https://mametesters.org/view.php?id=7146 which is a bit worse
'Atari GX2': 'motofren',
'Atari Phoenix': 'wg3dh',
'Atari System 1': 'indytemp',
'Atari System 2': '720',
'Atari System 4': 'airrace', #Actually, this doesn't really work at all, but it's a prototype so it never did so to speak
'Atari Vegas': 'gauntleg', #Voodoo 2
'ATILLA Video System': 'policetr10',
'Atlus PSX': 'hvnsgate',
'Atomiswave': 'dolphin', #Also in naomi.cpp, although might be different than normal Naomi
'Backfire! Hardware': 'backfire',
'Badlands Hardware': 'badlands',
'Bally/Sente SAC-1': 'nstocker',
'Battle Rangers Hardware': 'battlera',
'Battletoads Hardware': 'btoads',
'Beathead Hardware': 'beathead',
'Bell-Fruit/ATD RasterSpeed': 'rotr',
'Bemani DJ Main': 'bm1stmix',
'Billiard Academy Real Break Hardware': 'realbrk',
'Bishi Bashi Champ Hardware': 'bishi',
'Brezzasoft Crystal System': 'topbladv',
'BurgerTime Hardware': 'btime',
'Capcom ZN1': 'sfex',
'Capcom ZN2': 'techromn',
'Cave 68K Hardware': 'donpachi',
'Cave CV1000B': 'mushitam',
'Cave CV1000D': 'akatana',
'Caveman Ninja Hardware': 'cninja',
'Cedar Magnet System': 'mag_exzi',
'Centipede Hardware': 'centiped',
'Century CVS System': 'radarzon',
'Cinematronics Vector Hardware': 'armora',
'Cisco Heat Hardware': 'bigrun', #Cisco Heat itself is marked as imperfect so it won't be used
'Commando Hardware': 'commando',
'Cool Pool Hardware': 'coolpool',
'CPS-1': 'sf2',
'CPS-2': 'mvsc',
'CPS-3': 'jojobane',
'Craft (Atmega88 demoscene prod)': 'craft',
'Crazy Climber Hardware': 'cclimber',
'Cubo CD32': 'cndypuzl',
'Data East 16-bit Hardware': 'baddudes',
'Data East 32-bit Hardware': 'dragngun',
'Data East 8-bit Hardware': 'lastmisn',
'Data East MLC System': 'avengrgs',
'Deco 156': 'hvysmsh',
'Deco Casette': 'cbtime',
'Deco Simple 156': 'joemacr',
'dgPIX VRender0': 'kdynastg', #Sound is not emulated yet
'Don Don Lover Hardware': 'mmpanic',
'Donkey Kong Hardware': 'dkong',
'Enerdyne Technologies Trivia Hardware': 'promutrv',
'Entex Select-a-Game': 'sag_bb4',
'Eolith 16-bit Hardware': 'klondkp',
'Eolith Ghost': 'bballoon',
'Eolith Gradation 2D System': 'ironfort',
'Eolith Vega': 'crazywar',
'Erotictac Hardware': 'ertictac',
'ESD 16-bit Hardware': 'jumppop',
'Exidy 440': 'chiller',
'Exidy Max-a-Flex': 'mf_bdash',
'Exidy Universal Game Board v1': 'circus',
'Exidy Universal Game Board v2': 'hardhat',
'Exterminator Hardware': 'exterm',
'FACE Linda': 'mcatadv',
'Famiclone VTxx plug & plays': 'vgpocket',
'F-E1-32': 'mosaicf2',
'Final Crash Hardware': 'sf2mdt',
'Fun World Series 7000': 'lluck3x3',
'Fuuki FG-2': 'pbancho',
'Fuuki FG-3': 'asurabld',
'Gaelco 3D Hardware': 'surfplnt',
'Gaelco CG-1V-GAE1': 'aligator',
'Gaelco Hardware': 'biomtoy',
'Galactic Storm Hardware': 'galastrm',
'Galaga Hardware': 'galaga',
'Galaxian Hardware': 'galaxian',
'Game Plan Hardware': 'challeng',
'Game & Watch': 'gnw_fire',
'Gaplus Hardware': 'gaplus',
'Gauntlet Hardware': 'gauntlet',
'Gottlieb Hardware': 'krull',
'Greyhound Electronics Hardware': 'bigjoke',
'Ground Effects Hardware': 'groundfx',
'G-Stream G2020 Hardware': 'gstream',
'GTI Club Hardware': 'slrasslt', #GTI Club itself is not used as it takes too long to start up
'Gun Buster Hardware': 'gunbustr',
'Hang-On Hardware': 'hangon',
"Hard Drivin' Hardware": 'harddriv',
'Home Data Hardware': 'battlcry',
'Hyper Neo Geo 64': 'xrally', #Doesn't work properly
'IBM PC-XT': 'tetriskr',
'IGS011 Blitter Based Hardware': 'drgnwrld',
'Incredible Technologies 32-bit Blitter Hardware': 'bloodstm',
'Incredible Technologies 8-bit Blitter Hardware': 'ninclown',
'Incredible Technologies Eagle': 'carnking',
'Irem M107': 'airass',
'Irem M10': 'ipminvad',
'Irem M11': 'skychut',
'Irem M15': 'spacbeam',
'Irem M27': 'redalert',
'Irem M52': 'mpatrol',
'Irem M62': 'kungfum',
'Irem M63': 'wilytowr',
'Irem M72': 'rtype',
'Irem M77': 'kikcubic',
'Irem M90': 'bbmanw',
'Irem M92': 'bmaster',
'Jackie Chan Hardware': 'jchan2',
'Jaleco Mega System 1': 'avspirit',
'Jaleco Mega System 32': 'gratia',
'Kaneko 16-bit Hardware': 'bonkadv',
'Kaneko EXPRO-02': 'missw96',
'Kaneko Super Nova System': 'cyvern',
'Killer Instinct Hardware': 'kinst',
'Konami Bemani Twinkle': 'bmiidx4',
'Konami GQ': 'cryptklr',
'Konami GV': 'simpbowl',
'Konami GX': 'fantjour',
'Konami Hornet': 'gradius4',
'Konami M2': 'polystar',
'Konami System 573': 'hyperbbc', #DDR takes like several minutes to boot up
'Konami Twin 16': 'vulcan',
'Konami Ultra Sports': 'fiveside',
'Konami ZR107': 'jetwave',
'Last Fighting Hardware': 'lastfght',
'Leland Hardware': 'offroad',
'Lethal Enforcers Hardware': 'lethalen',
'Lethal Justice Hardware': 'lethalj',
'Liberation Hardware': 'liberate',
'Limenko Power System 2': 'dynabomb',
'Macross Plus Hardware': 'macrossp',
'Master System': 'sms', #Doesn't need a cart, plays inbuilt Alex Kidd in Miracle World without one
'Mattel Juice Box': 'juicebox', #Doesn't need a movie card inserted, as without one it just plays demo movies anyway
'Meadows S2650 Hardware': 'deadeye',
'Mega Drive Bootleg': 'aladmdb',
'Megadrive-on-a-chip Plug & Plays': 'rad_gen1',
'Mega-Play': 'mp_sonic',
'Mega-Tech': 'mt_sonic',
'Metro Hardware': 'balcube',
'Microprose 3D Hardware': 'botss',
'Midway 8080 Black & White Hardware': 'invaders',
'Midway Atlantis': 'mwskins',
'Midway MCR-1': 'kick',
'Midway MCR-2': 'tron',
'Midway MCR-3': 'spyhunt',
'Midway MCR-68k': 'blasted',
'Midway Seattle': 'carnevil',
'Midway T-Unit': 'mk',
'Midway V-Unit': 'crusnusa',
'Midway Wolf Unit': 'rmpgwt',
'Midway X-Unit': 'revx',
'Midway Y-Unit': 'narc',
'Midway Zeus': 'invasnab',
'Mitchell Hardware': 'pang',
'Namco Anniversary': '20pacgal',
'Namco System 11': 'tekken',
'Namco System 12': 'ehrgeiz',
'Namco System 16 Universal': 'liblrabl',
'Namco System 1': 'pacmania',
'Namco System 21 (C67 DSP)': 'starblad',
'Namco System 21 (Drivers Eyes)': 'driveyes',
'Namco System 21': 'winrun',
'Namco System 22': 'timecris',
'Namco System 23': 'timecrs2', #Doesn't work properly
'Namco System 2': 'luckywld',
'Namco System 86': 'rthunder',
'Namco System FL': 'finalapr',
'Namco System NA-1': 'tinklpit',
'Namco System NA-2': 'emeralda',
'Namco System NB-1': 'ptblank',
'Namco System NB-2': 'outfxies',
'Namco System ND-1': 'ncv1',
'Naomi': 'crzytaxi',
'Naomi GD-ROM': 'confmiss',
'Nemesis Hardware': 'nemesis',
'Neo-Geo': 'mslugx',
'Newer Seta Hardware': 'penbros',
'Newer Toaplan Hardware': 'kbash',
'Nintendo 8080 Hardware': 'sheriff',
'NMK 16-bit Hardware': 'bjtwin',
'Out Run Hardware': 'outrun',
'Pac-Man Hardware': 'pacman',
'Parodius Hardware': 'parodius',
'PCI PC': 'pcipc', #By popular request
'Philips CD-i based hardware': 'quizard',
'Photon IK-3': 'black',
'Photon System': 'phtetris',
'PlayChoice-10': 'pc_smb',
'Playmark Hardware': 'excelsr',
'PolyGame Master 2': 'ddpdojt',
'PolyGame Master': 'ddp3',
'Pong Hardware': 'rebound', #Romless, and also netlist so will be quite demanding
'PS Arcade 95': 'beastrzr',
'Psikyo Hardware': 'btlkroad',
'Psikyo PS3': 'soldivid',
'Psikyo PS4': 'loderndf',
'Psikyo PS5': 'tgm2p',
'Qix Hardware': 'qix',
'Quiz Do Re Mi Fa Grand Prix Hardware': 'qdrmfgp',
'Raiden 2 Hardware': 'raiden2',
'Raiden Hardware': 'raiden',
'Rally-X Hardware': 'rallyx',
'R-Zone': 'rzbatfor',
'Scramble Hardware': 'cavelon',
'See See Find Out Hardware': 'ppcar',
'Sega G-80 Raster': '005',
'Sega G-80 Vector': 'spacfury',
'Sega Model 1': 'vr',
'Sega Model 2': 'daytona',
'Sega Model 3': 'bass', #Step 1.0
'Sega Multi 32': 'orunners',
'Sega SG-1000': 'chboxing',
'Sega ST-V': 'diehard',
'Sega System 1': '4dwarrio',
'Sega System 16A': 'alexkidd',
'Sega System 16B': 'aliensyn',
'Sega System 18': 'mwalk',
'Sega System 24': 'hotrod',
'Sega System 2': 'choplift',
'Sega System 32': 'radm',
'Sega System C2': 'puyopuy2',
'Sega System E': 'tetrisse',
'Sega System H1': 'coolridr',
'Sega X-Board': 'abcop',
'Sega Y-Board': 'rchase',
'Seibu SPI': 'rdft',
'Semicom 68020 Hardware': 'dreamwld',
'Seta Aleck64': 'starsldr',
'Seta Hardware': 'msgundam',
'Seta ST-0016 Based Hardware': 'nratechu',
'Sigma B-98': 'pepsiman',
'Slap Shot Hardware': 'opwolf3',
'SNES Bootleg': 'ffight2b',
'SNK 68K Hardware': 'pow',
'SNK Alpha 68K Hardware': 'paddlema',
'SNK Hardware': 'ikari',
'Snow Bros Hardware': 'cookbib2',
'Space Invaders / Qix Silver Anniversary Edition Hardware': 'invqix',
'SSV': 'cairblad',
'Status Trivia Hardware': 'hangman',
'SunPlus plug & plays': 'vii',
'Sunset Riders Hardware': 'ssriders',
'Super Casette Vision': 'scv', #Displays test pattern with balloons flying around with no cart
'Super Chase Hardware': 'superchs',
'Super Pac-Man Hardware': 'mappy',
'Taito Air System': 'topland',
'Taito B System': 'pbobble',
'Taito F1 System': 'cameltry',
'Taito F2 System': 'liquidk',
'Taito F3 System': 'puchicar',
'Taito FX-1A': 'mgcldtex', #10 second delay on startup
'Taito FX-1B': 'raystorm', #10 second delay on startup
'Taito G-NET': 'chaoshea', #Delay before starting up (seems to be on all games on this system)
'Taito H System': 'syvalion',
'Taito JC': 'dendego', #Be sure to enable "disable RAM check" dipswitch, but it still checks some other stuff anyway
'Taito L System': 'horshoes',
'Taito Power-JC': 'optiger', #No sound; have to jiggle the backup RAM by playing with the test switch (7) and resetting
'Taito SJ': 'alpine',
'Taito X System': 'ballbros',
'Taito Z System': 'racingb',
'Tecmo TPS': 'flamegun',
'The NewZealand Story Hardware': 'tnzs',
'TIA-MC1': 'kot',
'Toaplan Hardware': 'zerowing',
'Top Speed Hardware': 'topspeed',
'Tournament Table Hardware': 'tourtabl',
'Tumble Pop Bootleg Hardware': 'metlsavr',
'TV test pattern generator': 'tp1985', #Romless and netlist
'TX-1 Hardware': 'tx1',
'Under Fire Hardware': 'undrfire',
'Unico Hardware': 'burglarx',
'Vamp x1/2 Hardware': 'toyland',
'Vectrex': 'vectrex', #No cart needed, boots Mine Storm without one
'VIC Dual': 'pulsar',
'Video System PSX': 'aerofgts',
'VS Unisystem': 'suprmrio',
'WGP Hardware': 'wgp',
'Wheels & Fire Hardware': 'wheelfir',
'Williams 6809 Hardware': 'defender',
'World Rally Hardware': 'wrally',
'XaviX plug & plays': 'namcons1',
'Yun Sung 16-bit Hardware': 'bombkick',
'Zaxxon Hardware': 'zaxxon',
}
#TODO (won't add these yet because I still need to run some benchmarks on other systems and need it to be consistent):
#Namco System 22 -> ridgerac
#Namco System Super 22 + timecris
#Snow Bros Hardware -> snowbros
#See See Find Out Hardware -> ssfindo
#Tecmo TPS -> cbaj (more 3D rendering in attract mode)
#Atari System 1 > roadblst
#Cedar Magnet System > mag_day
#CPS3 > jojoba
#Sammy Medal Game System + animalc
#Possibly Sega STV > vfkids? See if that runs at a non-trivially different speed to diehard
#Remove Entex Select-a-Game tbh
#Vamf 1/2 Hardware > vamphalf
#'Turret Tower Hardware': 'turrett', #Bah! Can't get a good accurate benchmark out of this, because it demands you press F2 every time you boot it up before the attract mode plays
#topgunnr has the same problem
#SGI Indy arguably requires a hard disk image to do anything useful; although it does run slowly even without one so maybe it runs at the same speed regardless of if it's running an OS or any software or nothing, and if that's the case it can be benchmarked without one
#See if I can find a game on Subsino Newer Tilemaps Hardware that I can actually get a good benchmark from (Water Nymph and X-Plan boot in weird ways)
#Stuff that could hang or crash MAME so won't be benchmarked:
#'Konami NWK-TR': 'thrilld', #Needs one-time setup (press F2 to clear backup RAM) first #I've had that crash on me before, don't like that
#Should be careful of https://mametesters.org/view.php?id=6828 (Cave CV1000B/CV1000D, Sega System H1), would OSDPROCESSORS normally be 1 on single-core systems?
#Worry about https://mametesters.org/view.php?id=5859 too (Seta Aleck64) but it seems it hasn't happened to me yet
#Would use ldrun to benchmark Irem M62 but it goes boom on the netbook (actual powerful systems run it fine) so that's odd I guess
#Other stuff that doesn't work, but I want to benchmark it and hence this is mostly just a reminder to myself to watch this space, but isn't included for now:
#AUSCOM System 1 (eggsplc): Prints debug spam to console, don't think it'll crash and in all fairness it's marked as working, but I'm not sure I trust it; the other games are non-working and also have the weird controls and console spam
#Sega System SP (tetgiant): Locks up after a few seconds, but doesn't hang MAME itself, just the game
#Atari Media GX (a51site4): Doesn't respond to pressing start, known to be hella slow... I just wanna know if it'll be stable, should try running it with -str 299 at some point
#Namco System 10: Can't get any of that to boot, although to be fair they are all MACHINE_NOT_WORKING
#Naomi 2: Unlike regular Naomi, doesn't seem to boot at all, also marked non-working
#Midway Zeus II: MACHINE_NOT_WORKING
#Atari PSX: Doesn't boot
#Taito O System: Parent Jack seems to be in kind of a weird state and I'm not sure it's suitable
#Variants where I'm not sure it'd be worth the time to benchmark them as well:
#Konami 573 Analog: DDR
#Konami 573 Digital: DDR 3rd Mix and beyond, Disney's Rave, Solo 2000
#Sega Model 2A (vcop2, srallyc)
#Sega Model 2B (pltkids, indy500, schamp)
#Sega Model 2C (stcc, hotd)
#Sega Model 3 Step 1.5 (scud)
#Sega Model 3 Step 2.0 (harley)
#Sega Model 3 Step 2.1 (daytona2)
#Naomi F355 Challenge
#Naomi House of the Dead 2 (does this really count as its own thing?)
#Konami Bubble System (Nemesis Hardware but takes 100 seconds to boot up)
#TODO: System drivers (NES, N64, etc) (what's a better name for that):
#Might be good idea to just use software list rather than pointing to a full path
#Has arcade equivalent:
#Astrocade: astrocde Has inbuilt Gunfight game but it has a menu before it displays anything interesting, so that might not work for a benchmark
#Atari 2600: a2600 Cart slot mandatory
#CD-i: cdimono1 CD player menu with no disc
#Dreamcast: dc CD player/save management/etc menu with no disc
#Mega Drive: megadrij Cart slot mandatory
#N64: n64 Cart slot mandatory
#NES: nes Cart slot mandatory
#PC Engine: pce Cart slot mandatory
#PS1: psu CD player menu with no disc
#Saturn: saturn Displays CD player menu with no disc
#Sega SG-1000: sg1000 Cart slot mandatory
#SNES: snes Cart slot mandatory
#Amstrad GX4000: gx4000 Cart slot mandatory
#APF-MP1000: apfm1000 Has inbuilt Rocket Patrol game but it has a menu before it displays anything interesting, so that might not work for a benchmark
#Arcadia 2001: arcadia Cart slot mandatory
#Atari 5200: a5200 Black screen with no cart
#Atari 7800: a7800 Displays garbage with no cart
#Bandai Super Vision 8000: sv8000 Cart slot mandatory
#BBC Bridge Companion: bbcbc Displays warning message with no cart (I like how it says "No." like that LMAO)
#Casio PV-1000: pv1000 Cart slot mandatory
#Channel F: channelf Displays "G?" message with no cart
#ColecoVision: coleco Black screen with no cart
#Entex Adventure Vision: advision Cart slot mandatory
#Epoch Game Pocket Computer: gamepock Displays little spiral demo with no cart
#Gamate: gamate Blank green screen with no cart
#Game Boy: gbcolor Boots to logo with no cart
#Game.com: gamecom Boots to PDA menu with no cart
#Game Gear: gamegear Cart slot mandatory
#GBA: gba Boots to logo with no cart
#Intellivision: intvoice Displays blank pink screen with no cart
#Lynx: lynx Cart slot mandatory
#Mega Duck: megaduck Displays blank green screen with no cart
#Memorex VIS: vis Displays warning message with no disc
#Neo Geo CD: neocdz Displays CD player menu with no disc
#Neo Geo Pocket: ngpc Displays blank white screen with no cart
#Nichibutsu My Vision: myvision Black screen with no cart
#VC 4000: vc4000 Displays "00 00" with no cart
#V.Smile: vsmile Loops intro animation with no cart
#Watara Supervision: svision Cart slot mandatory
#WonderSwan: wscolor Cart slot mandatory
#Computers: Could run without software, but maybe it's better for benchmarking to run them with software (to make sure they're using all their power)
#Apple II: apple2e
#Apple III: apple3
#Coleco Adam: adam
#Commodore VIC-20: vic1001
#FM-7: fm77av
#IBM PCjr: ibmpcjr
#MSX2: fsa1wsx
#MSX1: svi378
#Sharp X1: x1turbo40
#Sord M5: m5
#Squale: squale
#Tandy CoCo: coco3
#Tomy Tutor: tutor
#VZ-200: vz200
#ZX Spectrum: spec128
#Less working but worth a try:
#Hartung Game Master: gmaster Cart slot mandatory
#Pokemon Mini: pokemini Displays warning screen with no cart
#Super Acan: supracan Displays blank green screen with no cart
#Uzebox: uzebox Cart slot mandatory
#Virtual Boy: vboy Cart slot mandatory
#Casio PV-2000: pv2000
#Commodore 64: c64
#Mattel Aquarius: aquarius
#NEC PC-88: pc8801
#Sharp X68000: x68000
bench_output_matcher = re.compile(r'Average speed: ([\d.]+)% \(\d+ seconds\)$')
def bench(driver, time, additional_args=None):
#-videodriver dummy prevents windowed mode from actually creating a window and annoyingly stealing focus, or fullscreen mode from actually going fullscreen and locking redraw of other windows and hiding taskbars
#-noplugin discord is to prevent my friends from wondering why I'm playing a whole bunch of games for a few seconds and then quitting
args = ['mame', driver, '-bench', str(time), '-videodriver', 'dummy', '-noplugin', 'discord,discord-mod']
if additional_args:
#This can be useful for providing software lists / image paths etc
args += list(additional_args)
proc = subprocess.run(args, stdout=subprocess.PIPE, stderr=subprocess.DEVNULL, universal_newlines=True)
if proc.returncode:
print('Uh oh it broke', driver, time, proc.stdout, file=sys.stderr)
return None
stdout = proc.stdout
#Average speed: xxxx.x% (time - 1 seconds)
#Can't use .match as it will break any time MAME outputs stuff to stdout during running
match = bench_output_matcher.search(stdout)
if not match:
print('Uh oh fuck', driver, time, stdout, file=sys.stderr)
return None
return float(match[1])
def get_mame_xml(driver):
proc = subprocess.run(['mame', '-listxml', driver], stdout=subprocess.PIPE, stderr=subprocess.DEVNULL, check=True)
return ElementTree.fromstring(proc.stdout).find('machine')
def test_driver(csvwriter, system, driver, bench_time, bench_count, additional_args=None):
xml = get_mame_xml(driver)
row = {}
row['System'] = system
row['Source file'] = xml.attrib.get('sourcefile')
input_element = xml.find('input')
row['Is arcade'] = int(input_element.attrib.get('coins', '0')) > 0 if input_element is not None else False
row['Machine name'] = driver
row['Machine fullname'] = xml.findtext('description')
status = xml.find('driver')
row['Machine overall status'] = status.attrib.get('status') if status is not None else 'None'
row['Machine emulation status'] = status.attrib.get('emulation') if status is not None else 'None'
samples = []
for _ in range(bench_count):
speed = bench(driver, bench_time, additional_args)
if speed is not None:
samples.append(speed)
row['Min speed'] = min(samples)
row['Average speed'] = statistics.mean(samples)
row['Max speed'] = max(samples)
csvwriter.writerow(row)
sys.stdout.flush()
def main():
bench_time = int(sys.argv[1]) if len(sys.argv) > 1 else 299
bench_count = int(sys.argv[2]) if len(sys.argv) > 2 else 3 #Get bench_count number of samples
#https://mametesters.org/view.php?id=5831 Hmm, this doesn't seem so resolved to me... so bench_time must not be over 299
#It's here: https://github.com/mamedev/mame/blob/master/src/frontend/mame/ui/ui.cpp#L295
#So if I'm reading that correctly... if it's >= 60 * 5, it won't skip the game info screen, and so it'll get stuck there. -bench doesn't set -skip_gameinfo by default, but even if we added that argument, it would still get stuck on the "This machine has issues" screen
#Bench time must also be at least 2 (https://github.com/mamedev/mame/blob/master/src/emu/video.cpp#L705)
if bench_time < 2 or bench_time > 299:
print('No')
sys.exit(1)
print('Total machines to be benchmarked:', len(systems), file=sys.stderr)
fieldnames = ['System', 'Source file', 'Is arcade', 'Machine name', 'Machine fullname', 'Machine overall status', 'Machine emulation status', 'Min speed', 'Average speed', 'Max speed']
csvwriter = csv.DictWriter(sys.stdout, fieldnames=fieldnames)
csvwriter.writeheader()
for system, driver in systems.items():
test_driver(csvwriter, system, driver, bench_time, bench_count)
if __name__ == '__main__':
#print(' '.join(systems.values()))
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment