Example #1
0
def main():
    gephi = GephiOutput()
    gephi.output_file = 'large.gdf'

    with PyCallGraph(output=gephi):
        from urllib2 import urlopen
        from xml.dom.minidom import parseString
        parseString(urlopen('http://w3.org/').read())
Example #2
0
def main():
    gephi = GephiOutput()
    gephi.output_file = 'basic.gdf'

    with PyCallGraph(output=gephi):
        person = Person()
        for a in xrange(10):
            person.add_banana(Banana())
        person.eat_bananas()
Example #3
0
def main():
    gephi = GephiOutput()
    gephi.output_file = 'basic.gdf'

    with PyCallGraph(output=gephi):
        person = Person()
        for a in xrange(10):
            person.add_banana(Banana())
        person.eat_bananas()
Example #4
0
def main():
	from pycallgraph import PyCallGraph
	from pycallgraph.output import GephiOutput	##GraphvizOutput
	graphviz = GephiOutput()			##GraphvizOutput()
	graphviz.output_file = 'pycallgraph.gdf'

	#C:\MY\GITHUB\vk_downloader\vk_downloader.py message ""  "WHO" 0 --MACHINE --DOWNLOAD_MP3=True
	#C:\MY\VK_DOWLOAD\Python27\App\python.exe C:\MY\GITHUB\vk_downloader\y_profiler.py message ""  "WHO" 0 --MACHINE==True --DOWNLOAD_MP3=True
	with PyCallGraph(output=graphviz):
		run_vk()

	# sort by time desc
	import sys
	fname = graphviz.output_file	#sys.argv[1]
	with open(fname,'r') as f:
		lines = f.read().split('\nedgedef>')[0].splitlines()[1:]
		arlines = map( lambda s: s.split(','), lines )
		#print map( lambda s: s[2], arlines )
		arlines = sorted( arlines, cmp = lambda x,y: cmp( float(y[4]), float(x[4]) ) )
	with open(fname+'.out','w') as f:
		f.write( '\n'.join( map(lambda s: '%.4f\t%s\t%s' %(float(s[4]),s[3],s[0]), arlines ) ) )
Example #5
0
def main():
    from pycallgraph import PyCallGraph
    from pycallgraph.output import GephiOutput  ##GraphvizOutput
    graphviz = GephiOutput()  ##GraphvizOutput()
    graphviz.output_file = 'pycallgraph.gdf'

    #C:\MY\GITHUB\vk_downloader\vk_downloader.py message ""  "WHO" 0 --MACHINE --DOWNLOAD_MP3=True
    #C:\MY\VK_DOWLOAD\Python27\App\python.exe C:\MY\GITHUB\vk_downloader\y_profiler.py message ""  "WHO" 0 --MACHINE==True --DOWNLOAD_MP3=True
    with PyCallGraph(output=graphviz):
        run_vk()

    # sort by time desc
    import sys
    fname = graphviz.output_file  #sys.argv[1]
    with open(fname, 'r') as f:
        lines = f.read().split('\nedgedef>')[0].splitlines()[1:]
        arlines = map(lambda s: s.split(','), lines)
        #print map( lambda s: s[2], arlines )
        arlines = sorted(arlines,
                         cmp=lambda x, y: cmp(float(y[4]), float(x[4])))
    with open(fname + '.out', 'w') as f:
        f.write('\n'.join(
            map(lambda s: '%.4f\t%s\t%s' % (float(s[4]), s[3], s[0]),
                arlines)))
Example #6
0
from pycallgraph import PyCallGraph
from pycallgraph.output import GephiOutput

with PyCallGraph(output=GephiOutput()):
    execfile('test_state.py')
Example #7
0
import pytest

import pycallgraph
from pycallgraph import PyCallGraphException
from pycallgraph.output import GephiOutput, GraphvizOutput


@pycallgraph.decorators.trace(output=GraphvizOutput())
def print_something():
    print("hello")


@pycallgraph.decorators.trace(output=GephiOutput())
def print_foo():
    print("foo")


@pycallgraph.decorators.trace()
def print_bar():
    print("bar")


def test_trace_decorator_graphviz_output():
    print_something()


def test_trace_decorator_gephi_output():
    print_foo()


def test_trace_decorator_parameter():