examples/ip_pipeline: CPU utilization measurement and display
PATCH v2 1/1 examples/ip_pipeline: CPU utilization measurement and display
This patch adds CPU utilization measurement and idle cycle rate computation to packet framework. The measurement is done by measuring the cycles spent while a thread pulls zero packet from RX queue. These cycles are treated as idle cycles (or headroom). A CLI command is added to display idle cycle rate of specific thread. The CLI command format is shown as following:
t <thread_id> headroom
--- examples/ip_pipeline/app.h | 8 +++ examples/ip_pipeline/init.c | 8 ++- examples/ip_pipeline/thread.c | 66 ++++++++++++++++++++++- examples/ip_pipeline/thread.h | 14 +++++ examples/ip_pipeline/thread_fe.c | 113 +++++++++++++++++++++++++++++++++++++++ examples/ip_pipeline/thread_fe.h | 6 +++ 6 files changed, 211 insertions(+), 4 deletions(-)
examples/ip_pipeline/app.h +8 -0
@@ -263,6 +263,10 @@ struct app_thread_data {struct rte_ring *msgq_in;struct rte_ring *msgq_out; + +uint64_t headroom_time; +uint64_t headroom_cycles; +double headroom_ratio; };struct app_eal_params {
@@ -421,6 +425,10 @@ struct app_eal_params {#define APP_MAX_CMDS 64#endif +#ifndef APP_THREAD_HEADROOM_STATS_COLLECT +#define APP_THREAD_HEADROOM_STATS_COLLECT 1 +#endif +struct app_params {/* Config */ char app_name[APP_APPNAME_SIZE ];
examples/ip_pipeline/init.c +6 -2
@@ -1343,8 +1343,8 @@ app_init_pipelines(struct app_params *app) data->ptype = ptype; - data->timer_period = (rte_get_tsc_hz () * params->timer_period) - /1000 ; + data->timer_period = (rte_get_tsc_hz () * + params->timer_period) /100 ; } }
@@ -1379,6 +1379,10 @@ app_init_threads(struct app_params *app) t->timer_period = (rte_get_tsc_hz () *APP_THREAD_TIMER_PERIOD ) /1000 ; t->thread_req_deadline = time + t->timer_period; + t->headroom_cycles =0 ; + t->headroom_time =rte_get_tsc_cycles (); + t->headroom_ratio =0.0 ; + t->msgq_in = app_thread_msgq_in_get(app, params->socket_id, params->core_id,
examples/ip_pipeline/thread.c +64 -2
108 lines not on this page · raw message
examples/ip_pipeline/thread.h +14 -0
@@ -40,6 +40,7 @@enum thread_msg_req_type {THREAD_MSG_REQ_PIPELINE_ENABLE =0 ,THREAD_MSG_REQ_PIPELINE_DISABLE , +THREAD_MSG_REQ_HEADROOM_READ ,THREAD_MSG_REQS };
@@ -81,4 +82,17 @@ struct thread_pipeline_disable_msg_rsp { int status; }; +/* +* THREAD HEADROOM +*/ +struct thread_headroom_read_msg_req { +enum thread_msg_req_type type; +}; + +struct thread_headroom_read_msg_rsp { +int status; + +double headroom_ratio; +}; +#endif /* THREAD_H_ */
examples/ip_pipeline/thread_fe.c +113 -0
128 lines not on this page · raw message
examples/ip_pipeline/thread_fe.h +6 -0
@@ -92,4 +92,10 @@ app_pipeline_disable(struct app_params *app,uint32_t hyper_th_id, uint32_t pipeline_id); +int +app_thread_headroom (struct app_params *app, +uint32_t core_id, +uint32_t socket_id, +uint32_t hyper_th_id); +#endif /* THREAD_FE_H_ */
Signature · 1 line
2.5.0
Thomas Monjalon
Applied2016-02-22 14:07, Fan Zhang:
Quoted 11 lines
This patch adds CPU utilization measurement and idle cycle rate computation to packet framework. The measurement is done by measuring the cycles spent while a thread pulls zero packet from RX queue. These cycles are treated as idle cycles (or headroom). A CLI command is added to display idle cycle rate of specific thread. The CLI command format is shown as following:
t <
thread_id> headroomSigned-off-by Fan Zhang <[email protected]>
Applied, thanks
2016-03-07 12:31, Thomas Monjalon:
Quoted 8 lines
2016-02-22 14:07, Fan Zhang:
Quoted 7 lines
This patch adds CPU utilization measurement and idle cycle rate computation to packet framework. The measurement is done by measuring the cycles spent while a thread pulls zero packet from RX queue. These cycles are treated as idle cycles (or headroom). A CLI command is added to display idle cycle rate of specific thread. The CLI command format is shown as following:
Quoted 6 lines
Quoted 4 lines
t <
thread_id> headroomSigned-off-by Fan Zhang <[email protected]>Applied, thanks
Question: Would you be helped by librte_jobstats?
Quoted 20 lines
-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of Thomas Monjalon
Sent: Monday, March 7, 2016 11:34 AM
To: Zhang, Roy Fan <[email protected]>
Cc: [email protected]; Wodkowski, PawelX <[email protected]>
Subject: Re: [dpdk-dev] [PATCH v2] examples/ip_pipeline: CPU utilization measurement and display2016-03-07 12:31, Thomas Monjalon:
Quoted 3 lines
2016-02-22 14:07, Fan Zhang:
Quoted 2 lines
This patch adds CPU utilization measurement and idle cycle rate computation to packet framework. The measurement is done by
measuring
Quoted 5 lines
Quoted 5 lines
the cycles spent while a thread pulls zero packet from RX queue. These cycles are treated as idle cycles (or headroom). A CLI command is added to display idle cycle rate of specific thread. The CLI command format is shown as following:
Quoted 8 lines
Quoted 6 lines
Quoted 4 lines
t <
thread_id> headroomSigned-off-by Fan Zhang <[email protected]>Applied, thanks
Question: Would you be helped by
librte_jobstats?
All we needed for now is retrieving the current TSC value. We might consider using librte_jobstats for the next release.
Tested-ny: Qun Wan <[email protected]>
pipeline> t s1c1 headroom
57.085%
-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of Fan Zhang
Sent: Monday, February 22, 2016 10:07 PM
To: [email protected]
Subject: [dpdk-dev] [PATCH v2] examples/ip_pipeline: CPU utilization measurement and display
This patch adds CPU utilization measurement and idle cycle rate computation to packet framework. The measurement is done by measuring the cycles spent while a thread pulls zero packet from RX queue. These cycles are treated as idle cycles (or headroom). A CLI command is added to display idle cycle rate of specific thread. The CLI command format is shown as following:
t <thread_id> headroom
--- examples/ip_pipeline/app.h | 8 +++ examples/ip_pipeline/init.c | 8 ++- examples/ip_pipeline/thread.c | 66 ++++++++++++++++++++++- examples/ip_pipeline/thread.h | 14 +++++ examples/ip_pipeline/thread_fe.c | 113 +++++++++++++++++++++++++++++++++++++++ examples/ip_pipeline/thread_fe.h | 6 +++ 6 files changed, 211 insertions(+), 4 deletions(-)
examples/ip_pipeline/app.h +8 -0
@@ -263,6 +263,10 @@ struct app_thread_data {struct rte_ring *msgq_in;struct rte_ring *msgq_out; + +uint64_t headroom_time; +uint64_t headroom_cycles; +double headroom_ratio; };struct app_eal_params {
@@ -421,6 +425,10 @@ struct app_eal_params {#define APP_MAX_CMDS 64#endif +#ifndef APP_THREAD_HEADROOM_STATS_COLLECT +#define APP_THREAD_HEADROOM_STATS_COLLECT 1 +#endif +struct app_params {/* Config */ char app_name[APP_APPNAME_SIZE ];
examples/ip_pipeline/init.c +6 -2
@@ -1343,8 +1343,8 @@ app_init_pipelines(struct app_params *app) data->ptype = ptype; - data->timer_period = (rte_get_tsc_hz () * params->timer_period) - /1000 ; + data->timer_period = (rte_get_tsc_hz () * + params->timer_period) /100 ; } }
@@ -1379,6 +1379,10 @@ app_init_threads(struct app_params *app) t->timer_period = (rte_get_tsc_hz () *APP_THREAD_TIMER_PERIOD ) /1000 ; t->thread_req_deadline = time + t->timer_period; + t->headroom_cycles =0 ; + t->headroom_time =rte_get_tsc_cycles (); + t->headroom_ratio =0.0 ; + t->msgq_in = app_thread_msgq_in_get(app, params->socket_id, params->core_id,
examples/ip_pipeline/thread.c +62 -2
106 lines not on this page · raw message
examples/ip_pipeline/thread.h +14 -0
@@ -40,6 +40,7 @@enum thread_msg_req_type {THREAD_MSG_REQ_PIPELINE_ENABLE =0 ,THREAD_MSG_REQ_PIPELINE_DISABLE , +THREAD_MSG_REQ_HEADROOM_READ ,THREAD_MSG_REQS };
@@ -81,4 +82,17 @@ struct thread_pipeline_disable_msg_rsp { int status; }; +/* +* THREAD HEADROOM +*/ +struct thread_headroom_read_msg_req { +enum thread_msg_req_type type; +}; + +struct thread_headroom_read_msg_rsp { +int status; + +double headroom_ratio; +}; +#endif /* THREAD_H_ */
examples/ip_pipeline/thread_fe.c +112 -0
127 lines not on this page · raw message
examples/ip_pipeline/thread_fe.h +6 -0
@@ -92,4 +92,10 @@ app_pipeline_disable(struct app_params *app,uint32_t hyper_th_id, uint32_t pipeline_id); +int +app_thread_headroom (struct app_params *app, +uint32_t core_id, +uint32_t socket_id, +uint32_t hyper_th_id); +#endif /* THREAD_FE_H_ */
--
2.5.0