File: profile_server.py

package info (click to toggle)
pyke 1.1.1-3
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 4,456 kB
  • sloc: python: 12,872; sh: 441; xml: 203; sql: 39; makefile: 39
file content (16 lines) | stat: -rw-r--r-- 442 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
# profile_server.py

import cProfile
import simple_server

def run(port=8080, logging=False, trace_sql=False, db_engine='sqlite3'):
    cProfile.runctx(
        'simple_server.run(port=%d, logging=%s, trace_sql=%s, db_engine=%r)'
            % (port, logging, trace_sql, db_engine),
        globals(), locals(), 'profile.out')

def stats():
    import pstats
    p = pstats.Stats('profile.out')
    p.sort_stats('time')
    p.print_stats(20)