Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder1.enfer-du-nord.net!cs.uu.nl!news.stack.nl!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.027 X-Spam-Evidence: '*H*': 0.95; '*S*': 0.00; 'automate': 0.05; 'subject:code': 0.07; 'def': 0.13; 'why.': 0.15; 'profiling,': 0.16; 'then?': 0.16; 'arguments': 0.18; 'possibly': 0.19; 'options.': 0.21; 'statement': 0.23; 'pieces': 0.23; 'received:74.125.82.174': 0.24; 'code': 0.25; '(and': 0.28; 'script': 0.28; 'pass': 0.29; "skip:' 10": 0.29; 'message- id:@gmail.com': 0.33; 'header:User-Agent:1': 0.33; 'to:addr :python-list': 0.34; 'received:74.125.82': 0.35; 'something': 0.35; 'but': 0.37; 'run': 0.37; 'passed': 0.37; 'received:74.125': 0.37; 'received:google.com': 0.37; 'received:10.0.0': 0.38; 'some': 0.38; 'called': 0.40; 'to:addr:python.org': 0.40; 'kind': 0.61; 'results': 0.63; 'here': 0.65; 'it)': 0.67 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=message-id:date:from:user-agent:mime-version:to:subject :content-type:content-transfer-encoding; bh=hqGjKjm09+eHAUBkwx/C/c0OQY/1aQUuUnkIcgIpTJI=; b=BUP/acACRce7EukJLN1ehgyTo7o/VSZ45/mN7JnZu0RcZ8S1ybRiRuU1Dm0tJQSPuN y1VvHqcjKKmW2nz7K/bfsMbVHz8qQum16RvI91MdpOi37fkMCb90wfwrkjD5ZxHH7KCt mjtM+mMnIaAP1gZBCLpFoXjbJ3b4aVKLjwB9U= Date: Tue, 20 Dec 2011 10:40:08 +0000 From: Andrea Crotti User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:8.0) Gecko/20111108 Thunderbird/8.0 MIME-Version: 1.0 To: python-list@python.org Subject: profiling code Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 16 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1324377616 news.xs4all.nl 6886 [2001:888:2000:d::a6]:53380 X-Complaints-To: abuse@xs4all.nl Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:17569 I would like to automate some kind of performance profiling, to see if the application (and possibly pieces of it) becomes slower/faster and why. So I did something like this, where the statement passed also called parse_arguments, which is nice because I can run the other script with the normal options. But how do I pass arguments to the performance analyser script then? def profile_startup(): # just run something from inside here code = compile('Develer(parse_arguments()).full_run(test_only=True)', 'dev_main', 'exec') results = 'profiled.prof' runctx(code, globals(), {}, filename=results)