I run:
~/trex/v2.35$ sudo ./t-rex-64 -f cap2/my_http_simple.yaml -c 7 -m 10 -p
Then tried with modified stf_example.py:
trex@trex-1:~/trex/v2.35/trex_client/stf/examples$ cat my_stf_example.py
import argparse
import stf_path
from trex_stf_lib.trex_client import CTRexClient
from pprint import pprint
# sample TRex stateful run
# assuming server daemon is running.
def minimal_stateful_test(server):
print('Connecting to %s' % server)
trex_client = CTRexClient(server)
print('Connected, start TRex')
# trex_client.start_trex(
# c = 1,
# m = 700,
# f = 'cap2/http_simple.yaml',
# d = 30,
# l = 1000,
# )
print('Sample until end')
result = trex_client.sample_to_run_finish()
print('Test results:')
print(result)
print('TX by ports:')
tx_ptks_dict = result.get_last_value('trex-global.data', 'opackets-*')
print(' | '.join(['%s: %s' % (k.split('-')[-1], tx_ptks_dict[k]) for k in sorted(tx_ptks_dict.keys())]))
print('RX by ports:')
rx_ptks_dict = result.get_last_value('trex-global.data', 'ipackets-*')
print(' | '.join(['%s: %s' % (k.split('-')[-1], rx_ptks_dict[k]) for k in sorted(rx_ptks_dict.keys())]))
print('CPU utilization:')
print(result.get_value_list('trex-global.data.m_cpu_util'))
#Dump of *latest* result sample, uncomment to see it all
#print('Latest result dump:')
#pprint(result.get_latest_dump())
if __name__ == '__main__':
parser = argparse.ArgumentParser(description="Example for TRex Stateful, assuming server daemon is running.")
parser.add_argument('-s', '--server',
dest='server',
help='Remote trex address',
default='127.0.0.1',
type = str)
args = parser.parse_args()
minimal_stateful_test(args.server)
However it does not print updated counters, prints only last historical:
~/trex/v2.35/trex_client/stf/examples$ python3 my_stf_example.py -s 127.0.0.1
Connecting to 127.0.0.1
Connected, start TRex
Sample until end
Test results:
Is valid history? True
Done warmup? False
Expected tx rate: {'m_tx_expected_cps': 1943.2, 'm_tx_expected_bps': 537458048.0, 'm_tx_expected_pps': 71898.4}
Current tx rate: {'m_tx_pps': 43027.9, 'm_tx_cps': 1097.4, 'm_tx_bps': 313174336.0}
Minimum latency: {'min-0': 10, 'min-1': 10}
Maximum latency: {'max-1': 0, 'max-0': 0}
Average latency: {'port1': 0.0, 'port0': 0.0, 'all': 0.0}
Average window latency: {'port1': 0.0, 'port0': 0.0, 'all': 0.0}
Total drops: 588256
Drop rate: 0.0
History size so far: 1
TX by ports:
0: 846652 | 1: 1371316
RX by ports:
0: 1515024 | 1: 114688
CPU utilization:
[1.466]
Thank you
--
You received this message because you are subscribed to the Google Groups "TRex Traffic Generator" group.
To unsubscribe from this group and stop receiving emails from it, send an email to trex-tgn+unsubscribe@googlegroups.com.
To post to this group, send email to trex...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/trex-tgn/80a25712-8118-42e2-abbb-47f43e6f6ddc%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "TRex Traffic Generator" group.
To unsubscribe from this group and stop receiving emails from it, send an email to trex-tgn+unsubscribe@googlegroups.com.
To post to this group, send email to trex...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/trex-tgn/9279359c-63b4-4cc2-993a-569d41f64f94%40googlegroups.com.