[go: up one dir, main page]

File: profile_startup.py

package info (click to toggle)
txtorcon 18.3.0-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 1,672 kB
  • sloc: python: 17,521; makefile: 227
file content (21 lines) | stat: -rw-r--r-- 502 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#!/usr/bin/env python

from time import time
import cProfile
import txtorcon

proto = txtorcon.TorControlProtocol()
state = txtorcon.TorState(proto)

data = open('consensus', 'r').read()
routers = 5494  # number of routers in above file
iters = 5

start = time()
if False:
    cProfile.run('state._update_network_status(data)')
else:
    for x in range(iters):
        state._update_network_status(data)
diff = time() - start
print("%fs: %f microdescriptors/second" % (diff, (routers * iters) / diff))