X-Git-Url: http://git.droids-corp.org/?a=blobdiff_plain;f=examples%2Fl3fwd-power%2Fmain.c;h=fd8d9528faa6339329d1e3e38dc20a9aaadb51fe;hb=faa4ee75364dcb5343790d5fcf850cebdf7353f6;hp=99c1208ce14cbc524bc8477ce0fc11349c9859ee;hpb=292472ba0be75da85dec045a608e8dd162094141;p=dpdk.git diff --git a/examples/l3fwd-power/main.c b/examples/l3fwd-power/main.c index 99c1208ce1..fd8d9528fa 100644 --- a/examples/l3fwd-power/main.c +++ b/examples/l3fwd-power/main.c @@ -184,8 +184,8 @@ enum busy_rate { * reference CYCLES to be used to * measure core busyness based on poll count */ -#define MIN_CYCLES 1500000ULL -#define MAX_CYCLES 2500000ULL +#define MIN_CYCLES 1500000ULL +#define MAX_CYCLES 22000000ULL /* (500ms) */ #define TELEMETRY_INTERVALS_PER_SEC 2 @@ -1034,7 +1034,7 @@ main_telemetry_loop(__attribute__((unused)) void *dummy) br = FULL; } else if (diff_tsc > MIN_CYCLES && diff_tsc < MAX_CYCLES) { - br = PARTIAL; + br = (diff_tsc * 100) / MAX_CYCLES; } else { br = ZERO; } @@ -2100,9 +2100,16 @@ update_telemetry(__attribute__((unused)) struct rte_timer *tim, rte_spinlock_unlock(&stats[lcore_id].telemetry_lock); } - values[0] = round(app_eps/count); - values[1] = round(app_fps/count); - values[2] = round(app_br/count); + if (count > 0) { + values[0] = app_eps/count; + values[1] = app_fps/count; + values[2] = app_br/count; + } else { + values[0] = 0; + values[1] = 0; + values[2] = 0; + } + ret = rte_metrics_update_values(RTE_METRICS_GLOBAL, telstats_index, values, RTE_DIM(values)); if (ret < 0) @@ -2378,13 +2385,9 @@ main(int argc, char **argv) /* init RX queues */ for(queue = 0; queue < qconf->n_rx_queue; ++queue) { struct rte_eth_rxconf rxq_conf; - struct rte_eth_dev *dev; - struct rte_eth_conf *conf; portid = qconf->rx_queue_list[queue].port_id; queueid = qconf->rx_queue_list[queue].queue_id; - dev = &rte_eth_devices[portid]; - conf = &dev->data->dev_conf; if (numa_on) socketid = \ @@ -2397,7 +2400,7 @@ main(int argc, char **argv) rte_eth_dev_info_get(portid, &dev_info); rxq_conf = dev_info.default_rxconf; - rxq_conf.offloads = conf->rxmode.offloads; + rxq_conf.offloads = port_conf.rxmode.offloads; ret = rte_eth_rx_queue_setup(portid, queueid, nb_rxd, socketid, &rxq_conf, pktmbuf_pool[socketid]);