-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
30 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() |