[pypy-svn] jitviewer default: (alex, fijal): Raise a useful error if the file is not found.
alex_gaynor
commits-noreply at bitbucket.org
Mon Mar 14 03:38:15 CET 2011
Author: Alex Gaynor <alex.gaynor at gmail.com>
Branch:
Changeset: r106:001fb4a85491
Date: 2011-03-13 22:36 -0400
http://bitbucket.org/pypy/jitviewer/changeset/001fb4a85491/
Log: (alex, fijal): Raise a useful error if the file is not found.
diff --git a/bin/jitviewer.py b/bin/jitviewer.py
--- a/bin/jitviewer.py
+++ b/bin/jitviewer.py
@@ -41,6 +41,9 @@
CUTOFF = 30
+class CannotFindFile(Exception):
+ pass
+
class Server(object):
def __init__(self, storage):
self.storage = storage
@@ -123,6 +126,13 @@
self._root_path = kwargs.pop('root_path')
flask.Flask.__init__(self, *args, **kwargs)
+class CheckingLoopStorage(LoopStorage):
+ def disassemble_code(self, fname, startlineno):
+ result = super(CheckingLoopStorage, self).disassemble_code(fname, startlineno)
+ if result is None and fname is not None:
+ raise CannotFindFile(fname)
+ return result
+
def main():
PATH = os.path.join(os.path.dirname(
os.path.dirname(_jitviewer.__file__)))
@@ -139,7 +149,7 @@
port = 5000
else:
port = int(sys.argv[2])
- storage = LoopStorage(extra_path)
+ storage = CheckingLoopStorage(extra_path)
loops = [ParserWithHtmlRepr.parse_from_input(l)
for l in extract_category(log, "jit-log-opt-")]
parse_log_counts(extract_category(log, 'jit-backend-count'), loops)
More information about the Pypy-commit
mailing list