Skip to content

Commit

Permalink
Added loading from the cmd-line to profiling code.
Browse files Browse the repository at this point in the history
svn path=/src/trunk/spelt/; revision=7951
  • Loading branch information
Walter Leibbrandt committed Aug 1, 2008
1 parent 3728811 commit 4ebb79b
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions run_spelt.py
@@ -1,7 +1,7 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2007-2008 Zuza Software Foundation
# Copyright 2008 Zuza Software Foundation
#
# This file is part of Spelt
#
Expand Down Expand Up @@ -49,13 +49,13 @@ def run_spelt(dbfilename):
spelt = Spelt(dbfilename, module_path())
spelt.run()

def profile(profile_file):
def profile(profile_file, dbfilename):
import cProfile
import spelt.lsprofcalltree

logging.info('Staring profiling run')
profiler = cProfile.Profile()
profiler.runcall(run_spelt)
profiler.runcall(run_spelt, dbfilename)

k_cache_grind = spelt.lsprofcalltree.KCacheGrind(profiler)
k_cache_grind.output(profile_file)
Expand All @@ -76,12 +76,12 @@ def main(argv):

if options.profile != None:
try:
profile(open(options.profile, 'wb'))
if not args: args = ['']
profile(open(options.profile, 'wb'), args[0])
except IOError:
parser.error(_("Could not open profile file '%s'") % options.profile)
else:
if not args:
args = ['']
if not args: args = ['']
run_spelt(args[0])

if __name__ == "__main__":
Expand Down

0 comments on commit 4ebb79b

Please sign in to comment.