Browse Source

Reset stats after churning clients and relays

because a stopping and starting relays will immediately send messages to
the DirAuths, but we don't want to count that against the next epoch's
stats.
Ian Goldberg 4 years ago
parent
commit
b84bc72893
1 changed files with 6 additions and 6 deletions
  1. 6 6
      simulator.py

+ 6 - 6
simulator.py

@@ -218,11 +218,6 @@ class Simulator:
         for c in allcircs:
             c.close()
 
-        # Reset stats
-        for d in self.dirauths: d.perfstats.reset()
-        for r in self.relays: r.perfstats.reset()
-        for c in self.clients: c.perfstats.reset()
-
         # Churn relays
 
         # Stop some of the (non-fallback) relays
@@ -287,12 +282,17 @@ class Simulator:
                 for i in range(clients_new):
                     self.clients.append(client.Client(self.dirauthaddrs))
 
+        # Reset stats
+        for d in self.dirauths: d.perfstats.reset()
+        for r in self.relays: r.perfstats.reset()
+        for c in self.clients: c.perfstats.reset()
+
         # Tick the epoch
         network.thenetwork.nextepoch()
 
 
 if __name__ == '__main__':
-    # Args: womode snipauthmode networkscale numepochs randseed
+    # Args: womode snipauthmode networkscale numepochs randseed logdir
     if len(sys.argv) != 7:
         sys.stderr.write("Usage: womode snipauthmode networkscale numepochs randseed logdir\n")
         sys.exit(1)