stat_data = open(stat, 'r').readline().split()
stats_dict['last_sched_cpu'] = stat_data[-14]
-
+ stats_dict['priority'] = stat_data[17] if stat_data[43] == '0' else 'RT'
+
return stats_dict
task_paths = ["{0}/{1}".format(process_dir, task) for task in os.listdir(process_dir)]
- header = [ 'Task Name', 'PID', 'Allowed CPU', 'Last Sched CPU', 'Asked Ctx Switch', 'Forced Ctx Switch']
+ header = [ 'Task Name', 'PID', 'Priority', 'Allowed CPU', 'Last Sched CPU', 'Asked Ctx Switch', 'Forced Ctx Switch']
for x in header:
print('{:^20}'.format(x)),
print("")
# name
print("{:<20}".format(task['name'])),
print("{:^20}".format(task['pid'])),
+ print("{:^20}".format(task['priority'])),
print("{:^20}".format(task['cpus_allowed_list'])),
print("{:^20}".format(task['last_sched_cpu'])),
print("{:^20}".format(task['voluntary_ctxt_switches'])),
OPT_ARP_REF_PER,
OPT_NO_OFED_CHECK,
OPT_NO_SCAPY_SERVER,
- OPT_ACTIVE_FLOW
+ OPT_ACTIVE_FLOW,
+ OPT_RT
};
/* these are the argument types:
{ OPT_ARP_REF_PER, "--arp-refresh-period", SO_REQ_SEP },
{ OPT_NO_OFED_CHECK, "--no-ofed-check", SO_NONE },
{ OPT_NO_SCAPY_SERVER, "--no-scapy-server", SO_NONE },
+ { OPT_RT, "--rt", SO_NONE },
SO_END_OF_OPTIONS
};
printf(" --no-ofed-check : Disable the check of OFED version \n");
printf(" --no-scapy-server : Disable Scapy server implicit start at stateless \n");
printf(" --no-watchdog : Disable watchdog \n");
+ printf(" --rt : Run TRex DP/RX cores in realtime priority \n");
printf(" -p : Send all flow packets from the same interface (choosed randomly between client ad server ports) without changing their src/dst IP \n");
printf(" -pm : Platform factor. If you have splitter in the setup, you can multiply the total results by this factor \n");
printf(" e.g --pm 2.0 will multiply all the results bps in this factor \n");
po->preview.set_ipv6_mode_enable(true);
break;
+ case OPT_RT:
+ po->preview.set_rt_prio_mode(true);
+ break;
case OPT_LEARN :
po->m_learn_mode = CParserOption::LEARN_MODE_IP_OPTION;
int CGlobalTRex::run_in_rx_core(void){
+ CPreviewMode *lp = &CGlobalInfo::m_options.preview;
+
rte_thread_setname(pthread_self(), "TRex RX");
-
+
+ /* set RT mode if set */
+ if (lp->get_rt_prio_mode()) {
+ struct sched_param param;
+ param.sched_priority = sched_get_priority_max(SCHED_FIFO);
+ if (pthread_setschedparam(pthread_self(), SCHED_FIFO, ¶m) != 0) {
+ perror("setting RT priroity mode on RX core failed with error");
+ exit(EXIT_FAILURE);
+ }
+ }
+
if (get_is_stateless()) {
m_sl_rx_running = true;
m_rx_sl.start();
int CGlobalTRex::run_in_core(virtual_thread_id_t virt_core_id){
std::stringstream ss;
-
+ CPreviewMode *lp = &CGlobalInfo::m_options.preview;
+
ss << "Trex DP core " << int(virt_core_id);
rte_thread_setname(pthread_self(), ss.str().c_str());
+
+ /* set RT mode if set */
+ if (lp->get_rt_prio_mode()) {
+ struct sched_param param;
+ param.sched_priority = sched_get_priority_max(SCHED_FIFO);
+ if (pthread_setschedparam(pthread_self(), SCHED_FIFO, ¶m) != 0) {
+ perror("setting RT priroity mode on DP core failed with error");
+ exit(EXIT_FAILURE);
+ }
+ }
- CPreviewMode *lp=&CGlobalInfo::m_options.preview;
+
if ( lp->getSingleCore() &&
(virt_core_id==2 ) &&
(lp-> getCores() ==1) ){