Tools: Allow using threaded renderer in perf.py

This commit is contained in:
Vicki Pfau 2020-01-02 18:38:11 -08:00
parent 3552750768
commit ccdbcf6f0b
2 changed files with 14 additions and 3 deletions

View File

@ -116,6 +116,7 @@ Misc:
- Debugger: Print break-/watchpoint ID when breaking in CLI - Debugger: Print break-/watchpoint ID when breaking in CLI
- SDL: Use controller GUID instead of name - SDL: Use controller GUID instead of name
- SM83: Rename LR35902 to SM83 - SM83: Rename LR35902 to SM83
- Tools: Allow using threaded renderer in perf.py
0.8 beta 1: (2019-10-20) 0.8 beta 1: (2019-10-20)
- Initial beta for 0.8 - Initial beta for 0.8

View File

@ -28,8 +28,10 @@ class PerfTest(object):
def run(self, cwd): def run(self, cwd):
args = [os.path.join(os.getcwd(), self.EXECUTABLE), '-P'] args = [os.path.join(os.getcwd(), self.EXECUTABLE), '-P']
args.extend(self.get_args()) args.extend(self.get_args())
if self.renderer != 'software': if not self.renderer:
args.append('-N') args.append('-N')
elif self.renderer == 'threaded-software':
args.append('-T')
args.append(self.rom) args.append(self.rom)
env = {} env = {}
if 'LD_LIBRARY_PATH' in os.environ: if 'LD_LIBRARY_PATH' in os.environ:
@ -91,8 +93,10 @@ class PerfServer(object):
server_command.extend(['--', '-PD', '0']) server_command.extend(['--', '-PD', '0'])
if hasattr(test, "frames"): if hasattr(test, "frames"):
server_command.extend(['-F', str(test.frames)]) server_command.extend(['-F', str(test.frames)])
if test.renderer != "software": if not test.renderer:
server_command.append('-N') server_command.append('-N')
elif test.renderer == 'threaded-software':
server_command.append('-T')
subprocess.check_call(server_command) subprocess.check_call(server_command)
time.sleep(4) time.sleep(4)
self.socket = socket.create_connection(self.address, timeout=1000) self.socket = socket.create_connection(self.address, timeout=1000)
@ -170,13 +174,19 @@ if __name__ == '__main__':
parser.add_argument('-w', '--wall-time', type=float, default=0, metavar='TIME', help='wall-clock time') parser.add_argument('-w', '--wall-time', type=float, default=0, metavar='TIME', help='wall-clock time')
parser.add_argument('-g', '--game-frames', type=int, default=0, metavar='FRAMES', help='game-clock frames') parser.add_argument('-g', '--game-frames', type=int, default=0, metavar='FRAMES', help='game-clock frames')
parser.add_argument('-N', '--disable-renderer', action='store_const', const=True, help='disable video rendering') parser.add_argument('-N', '--disable-renderer', action='store_const', const=True, help='disable video rendering')
parser.add_argument('-T', '--threaded-renderer', action='store_const', const=True, help='threaded video rendering')
parser.add_argument('-s', '--server', metavar='ADDRESS', help='run on server') parser.add_argument('-s', '--server', metavar='ADDRESS', help='run on server')
parser.add_argument('-S', '--server-command', metavar='COMMAND', help='command to launch server') parser.add_argument('-S', '--server-command', metavar='COMMAND', help='command to launch server')
parser.add_argument('-o', '--out', metavar='FILE', help='output file path') parser.add_argument('-o', '--out', metavar='FILE', help='output file path')
parser.add_argument('directory', help='directory containing ROM files') parser.add_argument('directory', help='directory containing ROM files')
args = parser.parse_args() args = parser.parse_args()
s = Suite(args.directory, wall=args.wall_time, game=args.game_frames, renderer=None if args.disable_renderer else 'software') renderer = 'software'
if args.disable_renderer:
renderer = None
elif args.threaded_renderer:
renderer = 'threaded-software'
s = Suite(args.directory, wall=args.wall_time, game=args.game_frames, renderer=renderer)
if args.server: if args.server:
if args.server_command: if args.server_command:
server = PerfServer(args.server, args.server_command) server = PerfServer(args.server, args.server_command)