Browse Source

Report memory usage for the simulation

Ian Goldberg 4 years ago
parent
commit
558d70362d
1 changed files with 7 additions and 0 deletions
  1. 7 0
      simulator.py

+ 7 - 0
simulator.py

@@ -4,6 +4,7 @@ import random # For simulation, not cryptography!
 import math
 import sys
 import logging
+import resource
 
 import network
 import dirauth
@@ -86,6 +87,7 @@ if __name__ == '__main__':
 
     # Uncomment to see all the debug messages
     # logging.basicConfig(level=logging.DEBUG)
+    logging.basicConfig(level=logging.INFO)
 
     # Set the Walking Onions style to use
     network.thenetwork.set_wo_style(womode, snipauthmode)
@@ -96,3 +98,8 @@ if __name__ == '__main__':
 
     # Create the simulation
     simulator = Simulator(relaytarget, clienttarget)
+
+    network.thenetwork.nextepoch()
+
+    maxmemmib = resource.getrusage(resource.RUSAGE_SELF).ru_maxrss/1024
+    logging.info("%d MiB used", maxmemmib)