Skip to content

Instantly share code, notes, and snippets.

@firesofmay
Created January 6, 2012 22:29
Show Gist options
  • Save firesofmay/1572718 to your computer and use it in GitHub Desktop.
Save firesofmay/1572718 to your computer and use it in GitHub Desktop.
#Py code
import cProfile
import urllib2
def main():
urllib2.urlopen('http://majorgeeks.com/page.php?id=1')
if __name__ == '__main__':
cProfile.run('main()')
main()
#Output
411 function calls (408 primitive calls) in 20.559 seconds
Ordered by: standard name
ncalls tottime percall cumtime percall filename:lineno(function)
1 0.000 0.000 20.559 20.559 <pyshell#4>:3(main)
1 0.000 0.000 20.559 20.559 <string>:1(<module>)
1 0.000 0.000 0.000 0.000 <string>:8(__new__)
9 0.000 0.000 0.000 0.000 httplib.py:220(addheader)
1 0.000 0.000 0.001 0.001 httplib.py:234(readheaders)
1 0.000 0.000 0.000 0.000 httplib.py:335(__init__)
1 0.000 0.000 0.268 0.268 httplib.py:363(_read_status)
1 0.000 0.000 0.269 0.269 httplib.py:400(begin)
1 0.000 0.000 0.000 0.000 httplib.py:486(_check_close)
1 0.000 0.000 0.000 0.000 httplib.py:516(close)
1 0.000 0.000 0.000 0.000 httplib.py:680(__init__)
1 0.000 0.000 0.000 0.000 httplib.py:710(_set_hostport)
1 0.000 0.000 0.000 0.000 httplib.py:727(set_debuglevel)
1 0.000 0.000 20.289 20.289 httplib.py:751(connect)
1 0.000 0.000 0.000 0.000 httplib.py:759(close)
1 0.000 0.000 20.289 20.289 httplib.py:769(send)
5 0.000 0.000 0.000 0.000 httplib.py:789(_output)
1 0.000 0.000 20.289 20.289 httplib.py:796(_send_output)
1 0.000 0.000 0.000 0.000 httplib.py:817(putrequest)
4 0.000 0.000 0.000 0.000 httplib.py:927(putheader)
1 0.000 0.000 20.289 20.289 httplib.py:938(endheaders)
1 0.000 0.000 20.289 20.289 httplib.py:953(request)
1 0.000 0.000 20.289 20.289 httplib.py:974(_send_request)
1 0.000 0.000 0.269 0.269 httplib.py:991(getresponse)
1 0.000 0.000 0.001 0.001 mimetools.py:24(__init__)
1 0.000 0.000 0.000 0.000 mimetools.py:33(parsetype)
1 0.000 0.000 0.000 0.000 mimetools.py:50(parseplist)
9 0.000 0.000 0.000 0.000 rfc822.py:197(isheader)
10 0.000 0.000 0.000 0.000 rfc822.py:209(islast)
10 0.000 0.000 0.000 0.000 rfc822.py:219(iscomment)
6 0.000 0.000 0.000 0.000 rfc822.py:285(getheader)
1 0.000 0.000 0.001 0.001 rfc822.py:88(__init__)
1 0.000 0.000 0.000 0.000 socket.py:185(__init__)
1 0.000 0.000 0.000 0.000 socket.py:192(close)
1 0.000 0.000 0.000 0.000 socket.py:212(makefile)
2 0.000 0.000 0.270 0.135 socket.py:223(meth)
2 0.000 0.000 0.000 0.000 socket.py:246(__init__)
3/1 0.000 0.000 0.000 0.000 socket.py:276(close)
2/1 0.000 0.000 0.000 0.000 socket.py:285(__del__)
2 0.000 0.000 0.000 0.000 socket.py:292(flush)
11 0.000 0.000 0.268 0.024 socket.py:406(readline)
1 0.000 0.000 20.289 20.289 socket.py:537(create_connection)
1 0.000 0.000 0.000 0.000 urllib.py:1001(__init__)
1 0.000 0.000 0.000 0.000 urllib.py:1007(info)
1 0.000 0.000 0.000 0.000 urllib.py:1053(unwrap)
1 0.000 0.000 0.000 0.000 urllib.py:1062(splittype)
1 0.000 0.000 0.000 0.000 urllib.py:1076(splithost)
1 0.000 0.000 0.000 0.000 urllib.py:1164(splittag)
1 0.000 0.000 0.000 0.000 urllib.py:1201(unquote)
1 0.000 0.000 0.000 0.000 urllib.py:947(__init__)
1 0.000 0.000 0.000 0.000 urllib2.py:1097(do_request_)
1 0.000 0.000 20.558 20.558 urllib2.py:1126(do_open)
1 0.000 0.000 0.000 0.000 urllib2.py:1144(<genexpr>)
4 0.000 0.000 0.000 0.000 urllib2.py:1155(<genexpr>)
1 0.000 0.000 20.558 20.558 urllib2.py:1200(http_open)
1 0.000 0.000 20.558 20.558 urllib2.py:122(urlopen)
1 0.000 0.000 0.000 0.000 urllib2.py:171(request_host)
1 0.000 0.000 0.000 0.000 urllib2.py:189(__init__)
1 0.000 0.000 0.000 0.000 urllib2.py:221(get_method)
2 0.000 0.000 0.000 0.000 urllib2.py:232(has_data)
2 0.000 0.000 0.000 0.000 urllib2.py:238(get_full_url)
2 0.000 0.000 0.000 0.000 urllib2.py:244(get_type)
2 0.000 0.000 0.000 0.000 urllib2.py:251(get_host)
1 0.000 0.000 0.000 0.000 urllib2.py:258(get_selector)
1 0.000 0.000 0.000 0.000 urllib2.py:270(has_proxy)
2 0.000 0.000 0.000 0.000 urllib2.py:283(add_unredirected_header)
2 0.000 0.000 0.000 0.000 urllib2.py:287(has_header)
2 0.000 0.000 20.558 10.279 urllib2.py:364(_call_chain)
1 0.000 0.000 20.558 20.558 urllib2.py:376(open)
1 0.000 0.000 20.558 20.558 urllib2.py:404(_open)
1 0.000 0.000 0.000 0.000 urllib2.py:506(http_response)
1 0.000 0.000 0.000 0.000 urlparse.py:129(urlparse)
1 0.000 0.000 0.000 0.000 urlparse.py:160(urlsplit)
1 20.019 20.019 20.019 20.019 {_socket.getaddrinfo}
1 0.000 0.000 0.000 0.000 {built-in method __new__ of type object at 0x84e840}
1 0.000 0.000 0.000 0.000 {built-in method fromkeys}
13 0.000 0.000 0.000 0.000 {cStringIO.StringIO}
11 0.000 0.000 0.000 0.000 {getattr}
6 0.000 0.000 0.000 0.000 {hasattr}
2 0.000 0.000 0.000 0.000 {isinstance}
22 0.000 0.000 0.000 0.000 {len}
14 0.000 0.000 0.000 0.000 {method 'append' of 'list' objects}
3 0.000 0.000 0.000 0.000 {method 'capitalize' of 'str' objects}
1 0.270 0.270 0.270 0.270 {method 'connect' of '_socket.socket' objects}
1 0.000 0.000 0.000 0.000 {method 'disable' of '_lsprof.Profiler' objects}
10 0.000 0.000 0.000 0.000 {method 'endswith' of 'str' objects}
1 0.000 0.000 0.000 0.000 {method 'extend' of 'list' objects}
10 0.000 0.000 0.000 0.000 {method 'find' of 'str' objects}
20 0.000 0.000 0.000 0.000 {method 'get' of 'dict' objects}
1 0.000 0.000 0.000 0.000 {method 'getvalue' of 'cStringIO.StringO' objects}
3 0.000 0.000 0.000 0.000 {method 'group' of '_sre.SRE_Match' objects}
3 0.000 0.000 0.000 0.000 {method 'items' of 'dict' objects}
1 0.000 0.000 0.000 0.000 {method 'iteritems' of 'dict' objects}
7 0.000 0.000 0.000 0.000 {method 'join' of 'str' objects}
24 0.000 0.000 0.000 0.000 {method 'lower' of 'str' objects}
3 0.000 0.000 0.000 0.000 {method 'match' of '_sre.SRE_Pattern' objects}
10 0.000 0.000 0.000 0.000 {method 'read' of 'cStringIO.StringO' objects}
10 0.000 0.000 0.000 0.000 {method 'readline' of 'cStringIO.StringO' objects}
1 0.268 0.268 0.268 0.268 {method 'recv' of '_socket.socket' objects}
2 0.000 0.000 0.000 0.000 {method 'rfind' of 'str' objects}
22 0.000 0.000 0.000 0.000 {method 'seek' of 'cStringIO.StringO' objects}
1 0.000 0.000 0.000 0.000 {method 'sendall' of '_socket.socket' objects}
3 0.000 0.000 0.000 0.000 {method 'split' of 'str' objects}
4 0.000 0.000 0.000 0.000 {method 'startswith' of 'str' objects}
13 0.000 0.000 0.000 0.000 {method 'strip' of 'str' objects}
1 0.000 0.000 0.000 0.000 {method 'sub' of '_sre.SRE_Pattern' objects}
11 0.000 0.000 0.000 0.000 {method 'tell' of 'cStringIO.StringO' objects}
3 0.000 0.000 0.000 0.000 {method 'title' of 'str' objects}
1 0.000 0.000 0.000 0.000 {method 'update' of 'dict' objects}
12 0.000 0.000 0.000 0.000 {method 'write' of 'cStringIO.StringO' objects}
1 0.000 0.000 0.000 0.000 {range}
12 0.000 0.000 0.000 0.000 {setattr}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment