ソースを参照

Report memory usage for the simulation

Ian Goldberg 4 年 前
コミット
558d70362d
1 ファイル変更7 行追加0 行削除
  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)