Get stateful running statistics by client

366 views
Skip to first unread message

ayz...@gmail.com

unread,
Jun 21, 2018, 8:43:21 AM6/21/18
to TRex Traffic Generator
Hi,
What is the way to get statistics by client (API?) during stateful running traffic?
On same Trex box:
Daemon server started:
~/trex/v2.35/trex_client/stf/examples$ sudo ./trex_daemon_server start

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

Yaroslav Brustinov

unread,
Jun 24, 2018, 4:50:01 AM6/24/18
to ayz...@gmail.com, TRex Traffic Generator
Hi,

Why did you comment out "start_trex" function?
trex_daemon_server is supposed to collect statistics that was gathered from TRex instance started by "start_trex".

Thanks,
Yaroslav.






--
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.

ayz...@gmail.com

unread,
Jun 25, 2018, 9:13:51 AM6/25/18
to TRex Traffic Generator
Thanks Yaroslav.
My idea is to get run-time statistics for stateful as I do for stateless with its client.
That is why I run start in another window, and with stf_example.py I just want to get statistics for that run.
Is there a way to get run-time statistics before test stops?
Thanks

Yaroslav Brustinov

unread,
Jun 25, 2018, 10:27:21 AM6/25/18
to ayz...@gmail.com, TRex Traffic Generator
Hi,

Stateful TRex continuously sends statistics via publisher ZMQ port.
As I said, the daemon captures statistics of TRex process that it started.
You could write your own script that captures and processes that statistics.
Take a look at:

Thanks,
Yaroslav.

--
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.
Reply all
Reply to author
Forward
0 new messages