comparison mercurial/dispatch.py @ 5997:637d4c089834

profile: expand PID in output file name
author Bryan O'Sullivan <bos@serpentine.com>
date Fri, 01 Feb 2008 13:31:46 -0800
parents b913d3aacddc
children 6480af8fd53c
comparison
equal deleted inserted replaced
5996:3f9ce63da18c 5997:637d4c089834
377 377
378 def profiled(ui, func, options={}): 378 def profiled(ui, func, options={}):
379 def profile_fp(): 379 def profile_fp():
380 outfile = ui.config('profile', 'output', untrusted=True) 380 outfile = ui.config('profile', 'output', untrusted=True)
381 if outfile: 381 if outfile:
382 return open(outfile, 'w') 382 pid = str(os.getpid())
383 return open(outfile.replace('%p', pid), 'w')
383 else: 384 else:
384 return sys.stderr 385 return sys.stderr
385 386
386 if options.get('profile') or ui.config('profile', 'enable') == 'hotshot': 387 if options.get('profile') or ui.config('profile', 'enable') == 'hotshot':
387 import hotshot, hotshot.stats 388 import hotshot, hotshot.stats