<commit_before>#!/usr/bin/python

import os, sys, time, getopt

lib_path = os.path.abspath('testutils')
sys.path.append(lib_path)

from TestUtilsL47 import XenaScriptTools

svrs = []
clis = []
ports= []

def helptext():
   print
   print "Usage: %s [options] IPaddr svr_port1 cli_port1 [svr_port2 cli_port2]*\n" % (sys.argv[0])
   print "Ramps conns up and down according to load profile, and sends payload" 
   print "Default is 1M connections, load profile (ms) \"0 5000 5000 5000\", utilization 1000000 (== 100%)"
   print
   print "Options"
   print " -s scenario  raw mode test scenario: DOWNLOAD/BOTH"
   print " -d           enable debug (default is 0)"
   print " -p           enable proxy (default is 0)"
   print " -proxy       same as -p"
   print " -e N         allocate N PE's per port (default is 1)"
   print " -n conns     specify the number of requested connections"
   print " -u util      specify payload utilization in ppm (100% == 1000000)"
   print " --pkteng=N   same as -e"
   print " -w N         sets the TCP window"
   print " -m MSS       sets the MSS value - default is 1460"
   return


def getrtxstat(xm, ports):
   s_dupack=0
   s_ooseg=0
   s_rtxevt=0
   s_rtxseg=0
   s_rto=0
   s_syn=0
   s_fin=0
   for p in ports:
      res = xm.Send(p + " P4G_TCP_RETRANSMIT_COUNTERS [1] ?").split()
      s_dupack = s_dupack + int(res[5]) 
      s_ooseg  = s_ooseg  + int(res[6]) 
      s_rtxevt = s_rtxevt + int(res[7]) 
      s_rtxseg = s_rtxseg + int(res[8]) 
      s_rto    = s_rto    + int(res[9]) 
      s_syn    = s_syn    + int(res[10]) 
      s_fin    = s_fin    + int(res[11]) 

   print "RTX Stats: rx-dupack: %d  r-ooseg: %d  fast-rtx-events: %d  fast-rtx-seg: %d  rto-rtx: %d  syn-rtx: %d  fin-rtx: %d" % \
     (s_dupack, s_ooseg, s_rtxevt, s_rtxseg, s_rto, s_syn, s_fin)

   return 
   
    
def main():

   c_debug = 0
   c_proxy = 0
   c_pe    = 1
   c_lp    = "0 5000 5000 5000"
   c_conns = 1000000
   c_util  = 948400
#   c_util  = 1000000
   c_tcp_wnd  = 65535
   c_tcp_mss  = 1460
   c_scenario = "BOTH"

   try:
      opts, args = getopt.getopt(sys.argv[1:], "hdpe:l:n:u:w:s:m:", ["proxy", "pkteng=", "loadprofile=", "scenario=", "mss="])
   except getopt.GetoptError:
      helptext()
      return

   for opt, arg in opts:
       if opt == '-h':
          helptext()
          return
       elif opt in ("-p", "--proxy"):
          c_proxy=1
       elif opt in ("-d"):
          c_debug=1<commit_msg>Payload.py: Chenged default utilization to 100%<commit_after>#!/usr/bin/python

import os, sys, time, getopt

lib_path = os.path.abspath('testutils')
sys.path.append(lib_path)

from TestUtilsL47 import XenaScriptTools

svrs = []
clis = []
ports= []

def helptext():
   print
   print "Usage: %s [options] IPaddr svr_port1 cli_port1 [svr_port2 cli_port2]*\n" % (sys.argv[0])
   print "Ramps conns up and down according to load profile, and sends payload" 
   print "Default is 1M connections, load profile (ms) \"0 5000 5000 5000\", utilization 1000000 (== 100%)"
   print
   print "Options"
   print " -s scenario  raw mode test scenario: DOWNLOAD/BOTH"
   print " -d           enable debug (default is 0)"
   print " -p           enable proxy (default is 0)"
   print " -proxy       same as -p"
   print " -e N         allocate N PE's per port (default is 1)"
   print " -n conns     specify the number of requested connections"
   print " -u util      specify payload utilization in ppm (100% == 1000000)"
   print " --pkteng=N   same as -e"
   print " -w N         sets the TCP window"
   print " -m MSS       sets the MSS value - default is 1460"
   return


def getrtxstat(xm, ports):
   s_dupack=0
   s_ooseg=0
   s_rtxevt=0
   s_rtxseg=0
   s_rto=0
   s_syn=0
   s_fin=0
   for p in ports:
      res = xm.Send(p + " P4G_TCP_RETRANSMIT_COUNTERS [1] ?").split()
      s_dupack = s_dupack + int(res[5]) 
      s_ooseg  = s_ooseg  + int(res[6]) 
      s_rtxevt = s_rtxevt + int(res[7]) 
      s_rtxseg = s_rtxseg + int(res[8]) 
      s_rto    = s_rto    + int(res[9]) 
      s_syn    = s_syn    + int(res[10]) 
      s_fin    = s_fin    + int(res[11]) 

   print "RTX Stats: rx-dupack: %d  r-ooseg: %d  fast-rtx-events: %d  fast-rtx-seg: %d  rto-rtx: %d  syn-rtx: %d  fin-rtx: %d" % \
     (s_dupack, s_ooseg, s_rtxevt, s_rtxseg, s_rto, s_syn, s_fin)

   return 
   
    
def main():

   c_debug = 0
   c_proxy = 0
   c_pe    = 1
   c_lp    = "0 5000 5000 5000"
   c_conns = 1000000
   c_util  = 1000000
   c_tcp_wnd  = 65535
   c_tcp_mss  = 1460
   c_scenario = "BOTH"

   try:
      opts, args = getopt.getopt(sys.argv[1:], "hdpe:l:n:u:w:s:m:", ["proxy", "pkteng=", "loadprofile=", "scenario=", "mss="])
   except getopt.GetoptError:
      helptext()
      return

   for opt, arg in opts:
       if opt == '-h':
          helptext()
          return
       elif opt in ("-p", "--proxy"):
          c_proxy=1
       elif opt in ("-d"):
          c_debug=1
{'fraction_non_alphanumeric': 0.12818422661503973, 'fraction_numerical': 0.04585286325657224, 'mean_word_length': 2.320703653585927, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7358897', 'n_tokens_mistral': 2128, 'n_tokens_neox': 1947, 'n_words': 532}