Skip to content

Commit

Permalink
Really add sample
Browse files Browse the repository at this point in the history
  • Loading branch information
vr2262 committed Feb 24, 2015
1 parent 1a7fd67 commit 8bd19fc
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions benchmark/benchmark_application.sample.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/usr/bin/env python
#
# python -m cProfile -o /tmp/prof benchmark/benchmark_application_{section}.py
# python -m pstats /tmp/prof
# % sort time
# % stats 20

from argparse import ArgumentParser

import something
import db

connection = db.engine.connect()


def get_args():
parser = ArgumentParser(description='Benchmark a function.')
parser.add_argument('-n', '--num_runs', type=int, default=100,
help='The number of executions.')
return parser.parse_args()


def main():
args = get_args()
parameters = None # fill something in
for _ in range(args.num_runs):
something.do(connection, parameters)

if __name__ == '__main__':
main()

0 comments on commit 8bd19fc

Please sign in to comment.