s4:rpc_server/lsa: specify \\pipe\lsass as ncacn_np_secondary_endpoint
[samba.git] / script / traffic_replay
index c864c540d1083edacad99c782d8d54c237784b54..7174d246d3b7f4c16cc2125e60788f29503ba5e9 100755 (executable)
@@ -79,8 +79,11 @@ def main():
                                        'These options alter the traffic '
                                        'generated by the model')
     model_group.add_option('-S', '--scale-traffic', type='float', default=1.0,
-                           help='Increase the number of conversations by '
-                           'this factor')
+                           help=('Increase the number of conversations by '
+                                 'this factor (or use -T)'))
+    parser.add_option('-T', '--packets-per-second', type=float,
+                      help=('attempt this many packets per second '
+                            '(alternative to -S)'))
     parser.add_option('--old-scale',
                       action="store_true",
                       help='emulate the old scale for traffic')
@@ -227,6 +230,11 @@ def main():
         logger.error("--group-memberships requires --number-of-groups")
         sys.exit(1)
 
+    if opts.scale_traffic is not None and opts.packets_per_second is not None:
+        logger.error("--scale-traffic and --packets-per-second "
+                     "are incompatible. Use one or the other.")
+        sys.exit(1)
+
     if opts.timing_data not in ('-', None):
         try:
             open(opts.timing_data, 'w').close()
@@ -272,9 +280,14 @@ def main():
         logger.info(("Using the specified model file to "
                      "generate conversations"))
 
+        if opts.scale_traffic:
+            packets_per_second = model.scale_to_packet_rate(opts.scale_traffic)
+        else:
+            packets_per_second =  opts.packets_per_second
+
         conversations = \
             model.generate_conversation_sequences(
-                opts.scale_traffic,
+                packets_per_second,
                 opts.duration,
                 opts.replay_rate,
                 opts.conversation_persistence)