2012-04-26 12 views
41

रूपरेखा मैं python -m cProfile -s calls myscript.pyक्रमबद्ध cProfile उत्पादन जब Python स्क्रिप्ट

python -m cProfile -s percall myscript.py काम नहीं करता है का उपयोग कर रहा हूँ।

पायथन दस्तावेज कहता है "मान्य प्रकार मानों के लिए आंकड़े दस्तावेज देखें।": http://docs.python.org/library/profile.html#module-cProfile, जो मुझे नहीं मिल रहा है।

उत्तर

49

-s केवल का उपयोग करता the keys found under sort_stats.

'calls' (call count) 
'cumulative' (cumulative time) 
'cumtime' (cumulative time) 
'file' (file name) 
'filename' (file name) 
'module' (file name) 
'ncalls' (call count) 
'pcalls' (primitive call count) 
'line' (line number) 
'name' (function name) 
'nfl' (name/file/line) 
'stdname' (standard name) 
'time' (internal time) 
'tottime' (internal time) 
+7

बस, यह स्पष्ट करने के लिए ऊपर मेरे जैसे noobs, आप का उपयोग नहीं करते उद्धरण तो एक उदाहरण :) विधि में बिताए समय से तरीकों को सॉर्ट करने के लिए है "अजगर -एम cProfile -s tottime myscript.py " –

+3

उद्धरण (कम से कम बाश में) का उपयोग करने में कुछ भी गलत नहीं है, है ना? उद्धरण bash कमांड preprocessing द्वारा खाया जाता है .. –

संबंधित मुद्दे