viff
changeset 1429:b2b8e4a74cd6
runtime: print statistics with --statistics option.
| author | Martin Geisler <mg@cs.au.dk> |
|---|---|
| date | Sun Jan 24 17:29:26 2010 +0100 (6 weeks ago) |
| parents | e120e8967257 |
| children | 4efa3caf521e |
| files | viff/runtime.py |
line diff
1.1 --- a/viff/runtime.py Thu Jan 21 11:31:36 2010 +0100 1.2 +++ b/viff/runtime.py Sun Jan 24 17:29:26 2010 +0100 1.3 @@ -525,6 +525,8 @@ 1.4 help="Collect and print profiling information.") 1.5 group.add_option("--track-memory", action="store_true", 1.6 help="Track memory usage over time.") 1.7 + group.add_option("--statistics", action="store_true", 1.8 + help="Print statistics on shutdown.") 1.9 group.add_option("--no-socket-retry", action="store_true", 1.10 default=False, help="Fail rather than keep retrying " 1.11 "to connect if port is already in use.") 1.12 @@ -542,7 +544,8 @@ 1.13 ssl=have_openssl, 1.14 deferred_debug=False, 1.15 profile=False, 1.16 - track_memory=False) 1.17 + track_memory=False, 1.18 + statistics=False) 1.19 1.20 def __init__(self, player, threshold, options=None): 1.21 """Initialize runtime. 1.22 @@ -1026,6 +1029,10 @@ 1.23 runtime = runtime_class(players[id], threshold, options) 1.24 factory = ShareExchangerFactory(runtime, players, result) 1.25 1.26 + if options and options.statistics: 1.27 + reactor.addSystemEventTrigger("after", "shutdown", 1.28 + runtime.print_transferred_data) 1.29 + 1.30 if options and options.ssl: 1.31 print "Using SSL" 1.32 from twisted.internet.ssl import ContextFactory
