Vega strike Python Modules doc  0.5.1
Documentation of the " Modules " folder of Vega strike
 All Data Structures Namespaces Files Functions Variables
pstats Namespace Reference

Data Structures

class  Stats
 
class  TupleComp
 
class  ProfileBrowser
 

Functions

def func_strip_path
 
def func_get_function_name
 
def func_std_string
 
def add_func_stats
 
def add_callers
 
def count_calls
 
def f8
 

Variables

list __all__ = ["Stats"]
 
list initprofile = sys.argv[1]
 

Detailed Description

Class for printing reports on profiled python code.

Function Documentation

def pstats.add_callers (   target,
  source 
)
Combine two caller lists in a single list.

Definition at line 468 of file pstats.py.

469 def add_callers(target, source):
470  """Combine two caller lists in a single list."""
471  new_callers = {}
472  for func in target.keys():
473  new_callers[func] = target[func]
474  for func in source.keys():
475  if new_callers.has_key(func):
476  new_callers[func] = source[func] + new_callers[func]
477  else:
478  new_callers[func] = source[func]
479  return new_callers
def pstats.add_func_stats (   target,
  source 
)
Add together all the stats for two profile entries.

Definition at line 461 of file pstats.py.

References add_callers().

462 def add_func_stats(target, source):
463  """Add together all the stats for two profile entries."""
464  cc, nc, tt, ct, callers = source
465  t_cc, t_nc, t_tt, t_ct, t_callers = target
466  return (cc+t_cc, nc+t_nc, tt+t_tt, ct+t_ct,
467  add_callers(t_callers, callers))
def pstats.count_calls (   callers)
Sum the caller statistics to get total number of calls received.

Definition at line 480 of file pstats.py.

481 def count_calls(callers):
482  """Sum the caller statistics to get total number of calls received."""
483  nc = 0
484  for func in callers.keys():
485  nc += callers[func]
486  return nc
487 
488 #**************************************************************************
489 # The following functions support printing of reports
490 #**************************************************************************
def pstats.f8 (   x)

Definition at line 491 of file pstats.py.

492 def f8(x):
493  return "%8.3f" % x
494 
495 #**************************************************************************
496 # Statistics browser added by ESR, April 2001
497 #**************************************************************************
def pstats.func_get_function_name (   func)

Definition at line 449 of file pstats.py.

450 def func_get_function_name(func):
451  return func[2]
def pstats.func_std_string (   func_name)

Definition at line 452 of file pstats.py.

453 def func_std_string(func_name): # match what old profile produced
454  return "%s:%d(%s)" % func_name
455 
456 #**************************************************************************
457 # The following functions combine statists for pairs functions.
458 # The bulk of the processing involves correctly handling "call" lists,
459 # such as callers and callees.
460 #**************************************************************************
def pstats.func_strip_path (   func_name)

Definition at line 445 of file pstats.py.

446 def func_strip_path(func_name):
447  file, line, name = func_name
448  return os.path.basename(file), line, name

Variable Documentation

list __all__ = ["Stats"]

Definition at line 40 of file pstats.py.

initprofile = sys.argv[1]

Definition at line 632 of file pstats.py.