[pypy-svn] r57749 - in pypy/dist/pypy/lang/gameboy/profiling/evaluation: . logs

cami at codespeak.net cami at codespeak.net
Tue Sep 2 11:58:21 CEST 2008


Author: cami
Date: Tue Sep  2 11:58:20 2008
New Revision: 57749

Added:
   pypy/dist/pypy/lang/gameboy/profiling/evaluation/logs/
   pypy/dist/pypy/lang/gameboy/profiling/evaluation/logs/kirbysDreamland.txt
   pypy/dist/pypy/lang/gameboy/profiling/evaluation/logs/megaman.txt
   pypy/dist/pypy/lang/gameboy/profiling/evaluation/logs/rom9.txt
   pypy/dist/pypy/lang/gameboy/profiling/evaluation/logs/superMario.txt
   pypy/dist/pypy/lang/gameboy/profiling/evaluation/parseTests.py
   pypy/dist/pypy/lang/gameboy/profiling/evaluation/run.sh   (contents, props changed)
Log:
added loggin part to the evaluation
evaluation should be able to create histogram of the executed op codes
fo find a working set of opCodes which should run fast


Added: pypy/dist/pypy/lang/gameboy/profiling/evaluation/logs/kirbysDreamland.txt
==============================================================================

Added: pypy/dist/pypy/lang/gameboy/profiling/evaluation/logs/megaman.txt
==============================================================================

Added: pypy/dist/pypy/lang/gameboy/profiling/evaluation/logs/rom9.txt
==============================================================================

Added: pypy/dist/pypy/lang/gameboy/profiling/evaluation/logs/superMario.txt
==============================================================================

Added: pypy/dist/pypy/lang/gameboy/profiling/evaluation/parseTests.py
==============================================================================
--- (empty file)
+++ pypy/dist/pypy/lang/gameboy/profiling/evaluation/parseTests.py	Tue Sep  2 11:58:20 2008
@@ -0,0 +1,47 @@
+#!/bin/python
+
+def add_rank(file):
+	lines = open(file).readlines()
+	lastRank = -1;
+	for line in lines[4:]:
+		pos = line.find(":")
+		try:
+			lastRank = int(line[:pos])
+			add_rank_opcodes(lastRank, line[pos+2:])
+		except :
+			add_rank_fetch_opcodes(lastRank, line[pos+2:])
+		
+			
+	
+def add_rank_opcodes(rank, opcodes):
+	opcodes = opcodes.strip().split(" ")
+	for opcode in opcodes:
+		op_codes[int(opcode, 16)] += rank
+	
+def add_rank_fetch_opcodes(rank, opcodes):
+	opcodes = opcodes.strip().split(" ")
+	for opcode in opcodes:
+		fetch_op_codes[int(opcode, 16)] += rank
+
+
+def print_sorted(table):
+	dict = {}
+	for i in range(0xFF):
+		dict[table[i]] = i 
+	keys = dict.keys()
+	keys.sort()
+	for key in keys:
+		if key != 0:
+			print "0x%2x: %5i" % (dict[key], key)
+	
+# --------------------------------------
+files = ["superMario.txt", "rom9.txt", "megaman.txt", "kirbysDreamland.txt"]
+
+op_codes = [0] * 0xFF
+fetch_op_codes = [0] * 0xFF
+
+for file in files:
+	add_rank(file)
+	
+print_sorted(op_codes)
+	
\ No newline at end of file

Added: pypy/dist/pypy/lang/gameboy/profiling/evaluation/run.sh
==============================================================================
--- (empty file)
+++ pypy/dist/pypy/lang/gameboy/profiling/evaluation/run.sh	Tue Sep  2 11:58:20 2008
@@ -0,0 +1,13 @@
+#!/bin/bash
+rm -rf *.txt
+
+romPath=~/Ausbildung/08_UNIBE_FS/bachelor/docs/roms
+executable=/pypy-dist/pypy/lang/gameboy/gameboyTest.py
+
+python2.5 $executable $romPath/Megaman.gb         >> logs/megaman.txt 
+python2.5 $executable $romPath/KirbysDreamLand.gb >> logs/kirbysDreamland.txt
+python2.5 $executable $romPath/SuperMarioLand.gb  >> logs/superMario.txt
+python2.5 $executable              			      >> logs/rom9.txt
+
+
+python parseTests.py
\ No newline at end of file



More information about the Pypy-commit mailing list