Browse Source

fix plotting crash

Jens Keim 5 years ago
parent
commit
fff2bccfd1
2 changed files with 18 additions and 16 deletions
  1. 1 1
      code/CLI.py
  2. 17 15
      code/Core/Statistics.py

+ 1 - 1
code/CLI.py

@@ -65,7 +65,7 @@ class CLI(object):
         parser.add_argument('-t', '--extraTests',
                             help='perform extra tests on the input pcap file, including calculating IP entropy'
                                  'in interval-wise, TCP checksum, and checking payload availability.',
-                            action='store_true')
+                            action='store_true', default=False)
         parser.add_argument('-S', '--rngSeed', action='append', help='sets rng seed for testing or benchmarking',
                             nargs='+', default=[])
         parser.add_argument('-T', '--time', help='measures packet generation time', action='store_true', default=False)

+ 17 - 15
code/Core/Statistics.py

@@ -1751,21 +1751,23 @@ class Statistics:
                                                                 "Duration",
                                                                 "_plot-Histogram Communication Duration per Connection" + "." + file_format)
         print(".", end="", flush=True)
-        plot_out_degree = plot_degree("out", '.' + file_format)
-        print(".", end="", flush=True)
-        plot_in_degree = plot_degree("in", '.' + file_format)
-        print(".", end="", flush=True)
-        plot_overall_degree = plot_degree("overall", '.' + file_format)
-        print(".", end="", flush=True)
-        plot_packets_per_connection_out = plot_packets_per_connection('.' + file_format)
-        print(".", end="", flush=True)
-        plot_avg_pkts_per_comm_interval_out = plot_avg_pkts_per_comm_interval('.' + file_format)
-        print(".", end="", flush=True)
-        plot_avg_time_between_comm_interval_out = plot_avg_time_between_comm_interval('.' + file_format)
-        print(".", end="", flush=True)
-        plot_avg_comm_interval_time_out = plot_avg_comm_interval_time("." + file_format)
-        print(".", end="", flush=True)
-        plot_total_comm_duration_out = plot_total_comm_duration("." + file_format)
+        if entropy:
+            plot_out_degree = plot_degree("out", '.' + file_format)
+            print(".", end="", flush=True)
+            plot_in_degree = plot_degree("in", '.' + file_format)
+            print(".", end="", flush=True)
+            plot_overall_degree = plot_degree("overall", '.' + file_format)
+            print(".", end="", flush=True)
+            plot_packets_per_connection_out = plot_packets_per_connection('.' + file_format)
+            print(".", end="", flush=True)
+            plot_avg_pkts_per_comm_interval_out = plot_avg_pkts_per_comm_interval('.' + file_format)
+            print(".", end="", flush=True)
+            plot_avg_time_between_comm_interval_out = plot_avg_time_between_comm_interval('.' + file_format)
+            print(".", end="", flush=True)
+            plot_avg_comm_interval_time_out = plot_avg_comm_interval_time("." + file_format)
+            print(".", end="", flush=True)
+            plot_total_comm_duration_out = plot_total_comm_duration("." + file_format)
+            print(".", end="", flush=True)
         print(" done.")
 
         # Time consuming plot