DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH V1 1/1] jobstats: added function abort for job
@ 2016-01-26 16:15 Marcin Kerlin
  2016-01-27 13:37 ` Panu Matilainen
  2016-01-29 15:31 ` [dpdk-dev] [PATCH v2 " Marcin Kerlin
  0 siblings, 2 replies; 8+ messages in thread
From: Marcin Kerlin @ 2016-01-26 16:15 UTC (permalink / raw)
  To: dev

This patch adds new function rte_jobstats_abort. It marks *job* as finished
and time of this work will be add to management time instead of execution time. 
This function should be used instead of rte_jobstats_finish if condition occure,
condition is defined by the application for example when receiving n>0 packets.

Signed-off-by: Marcin Kerlin <marcinx.kerlin@intel.com>
---
 lib/librte_jobstats/rte_jobstats.c           | 22 ++++++++++++++++++++++
 lib/librte_jobstats/rte_jobstats.h           | 17 +++++++++++++++++
 lib/librte_jobstats/rte_jobstats_version.map |  7 +++++++
 3 files changed, 46 insertions(+)

diff --git a/lib/librte_jobstats/rte_jobstats.c b/lib/librte_jobstats/rte_jobstats.c
index 2eaac0c..b603125 100644
--- a/lib/librte_jobstats/rte_jobstats.c
+++ b/lib/librte_jobstats/rte_jobstats.c
@@ -170,6 +170,26 @@ rte_jobstats_start(struct rte_jobstats_context *ctx, struct rte_jobstats *job)
 }
 
 int
+rte_jobstats_abort(struct rte_jobstats *job)
+{
+	struct rte_jobstats_context *ctx;
+	uint64_t now, exec_time;
+
+	/* Some sanity check. */
+	if (unlikely(job == NULL || job->context == NULL))
+		return -EINVAL;
+
+	ctx = job->context;
+	now = get_time();
+	exec_time = now - ctx->state_time;
+	ADD_TIME_MIN_MAX(ctx, management, exec_time);
+	ctx->state_time = now;
+	job->context = NULL;
+
+	return 0;
+}
+
+int
 rte_jobstats_finish(struct rte_jobstats *job, int64_t job_value)
 {
 	struct rte_jobstats_context *ctx;
@@ -191,6 +211,7 @@ rte_jobstats_finish(struct rte_jobstats *job, int64_t job_value)
 	 * executed. */
 	now = get_time();
 	exec_time = now - ctx->state_time;
+	job->last_job_time = exec_time;
 	ADD_TIME_MIN_MAX(job, exec, exec_time);
 	ADD_TIME_MIN_MAX(ctx, exec, exec_time);
 
@@ -269,5 +290,6 @@ void
 rte_jobstats_reset(struct rte_jobstats *job)
 {
 	RESET_TIME_MIN_MAX(job, exec);
+	job->last_job_time = 0;
 	job->exec_cnt = 0;
 }
diff --git a/lib/librte_jobstats/rte_jobstats.h b/lib/librte_jobstats/rte_jobstats.h
index de6a89a..9995319 100644
--- a/lib/librte_jobstats/rte_jobstats.h
+++ b/lib/librte_jobstats/rte_jobstats.h
@@ -90,6 +90,9 @@ struct rte_jobstats {
 	uint64_t exec_cnt;
 	/**< Execute count. */
 
+	uint64_t last_job_time;
+	/**< Last job time */
+
 	char name[RTE_JOBSTATS_NAMESIZE];
 	/**< Name of this job */
 
@@ -237,6 +240,20 @@ int
 rte_jobstats_start(struct rte_jobstats_context *ctx, struct rte_jobstats *job);
 
 /**
+ * Mark that *job* finished its execution, but time of this work will be skipped
+ * and added to management time.
+ *
+ * @param job
+ *  Job object.
+ *
+ * @return
+ *  0 on success
+ *  -EINVAL if job is NULL or job was not started (it have no context).
+ */
+int
+rte_jobstats_abort(struct rte_jobstats *job);
+
+/**
  * Mark that *job* finished its execution. Context in which it was executing
  * will receive stat update. After this function call *job* object is ready to
  * be executed in other context.
diff --git a/lib/librte_jobstats/rte_jobstats_version.map b/lib/librte_jobstats/rte_jobstats_version.map
index cb01bfd..0ec0650 100644
--- a/lib/librte_jobstats/rte_jobstats_version.map
+++ b/lib/librte_jobstats/rte_jobstats_version.map
@@ -17,3 +17,10 @@ DPDK_2.0 {
 
 	local: *;
 };
+
+DPDK_2.3 {
+	global:
+
+	rte_jobstats_abort;
+
+} DPDK_2.0;
\ No newline at end of file
-- 1
1.9.1

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [dpdk-dev] [PATCH V1 1/1] jobstats: added function abort for job
  2016-01-26 16:15 [dpdk-dev] [PATCH V1 1/1] jobstats: added function abort for job Marcin Kerlin
@ 2016-01-27 13:37 ` Panu Matilainen
  2016-01-27 15:57   ` Jastrzebski, MichalX K
  2016-01-29 15:31 ` [dpdk-dev] [PATCH v2 " Marcin Kerlin
  1 sibling, 1 reply; 8+ messages in thread
From: Panu Matilainen @ 2016-01-27 13:37 UTC (permalink / raw)
  To: Marcin Kerlin, dev

On 01/26/2016 06:15 PM, Marcin Kerlin wrote:
> This patch adds new function rte_jobstats_abort. It marks *job* as finished
> and time of this work will be add to management time instead of execution time.
> This function should be used instead of rte_jobstats_finish if condition occure,
> condition is defined by the application for example when receiving n>0 packets.
>
> Signed-off-by: Marcin Kerlin <marcinx.kerlin@intel.com>
> ---
>   lib/librte_jobstats/rte_jobstats.c           | 22 ++++++++++++++++++++++
>   lib/librte_jobstats/rte_jobstats.h           | 17 +++++++++++++++++
>   lib/librte_jobstats/rte_jobstats_version.map |  7 +++++++
>   3 files changed, 46 insertions(+)
>
[...]
> diff --git a/lib/librte_jobstats/rte_jobstats.h b/lib/librte_jobstats/rte_jobstats.h
> index de6a89a..9995319 100644
> --- a/lib/librte_jobstats/rte_jobstats.h
> +++ b/lib/librte_jobstats/rte_jobstats.h
> @@ -90,6 +90,9 @@ struct rte_jobstats {
>   	uint64_t exec_cnt;
>   	/**< Execute count. */
>
> +	uint64_t last_job_time;
> +	/**< Last job time */
> +
>   	char name[RTE_JOBSTATS_NAMESIZE];
>   	/**< Name of this job */
>

AFAICS this is an ABI break and as such, needs to be preannounced, see 
http://dpdk.org/doc/guides/contributing/versioning.html
For 2.3 it'd need to be a CONFIG_RTE_NEXT_ABI feature.

	- Panu -

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [dpdk-dev] [PATCH V1 1/1] jobstats: added function abort for job
  2016-01-27 13:37 ` Panu Matilainen
@ 2016-01-27 15:57   ` Jastrzebski, MichalX K
  2016-01-28  7:41     ` Panu Matilainen
  0 siblings, 1 reply; 8+ messages in thread
From: Jastrzebski, MichalX K @ 2016-01-27 15:57 UTC (permalink / raw)
  To: Panu Matilainen, Kerlin, MarcinX, dev

> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Panu Matilainen
> Sent: Wednesday, January 27, 2016 2:38 PM
> To: Kerlin, MarcinX <marcinx.kerlin@intel.com>; dev@dpdk.org
> Subject: Re: [dpdk-dev] [PATCH V1 1/1] jobstats: added function abort for job
> 
> On 01/26/2016 06:15 PM, Marcin Kerlin wrote:
> > This patch adds new function rte_jobstats_abort. It marks *job* as finished
> > and time of this work will be add to management time instead of execution
> time.
> > This function should be used instead of rte_jobstats_finish if condition
> occure,
> > condition is defined by the application for example when receiving n>0
> packets.
> >
> > Signed-off-by: Marcin Kerlin <marcinx.kerlin@intel.com>
> > ---
> >   lib/librte_jobstats/rte_jobstats.c           | 22 ++++++++++++++++++++++
> >   lib/librte_jobstats/rte_jobstats.h           | 17 +++++++++++++++++
> >   lib/librte_jobstats/rte_jobstats_version.map |  7 +++++++
> >   3 files changed, 46 insertions(+)
> >
> [...]
> > diff --git a/lib/librte_jobstats/rte_jobstats.h
> b/lib/librte_jobstats/rte_jobstats.h
> > index de6a89a..9995319 100644
> > --- a/lib/librte_jobstats/rte_jobstats.h
> > +++ b/lib/librte_jobstats/rte_jobstats.h
> > @@ -90,6 +90,9 @@ struct rte_jobstats {
> >   	uint64_t exec_cnt;
> >   	/**< Execute count. */
> >
> > +	uint64_t last_job_time;
> > +	/**< Last job time */
> > +
> >   	char name[RTE_JOBSTATS_NAMESIZE];
> >   	/**< Name of this job */
> >
> 
> AFAICS this is an ABI break and as such, needs to be preannounced, see
> http://dpdk.org/doc/guides/contributing/versioning.html
> For 2.3 it'd need to be a CONFIG_RTE_NEXT_ABI feature.
> 
> 	- Panu -

Hi Panu,
Thanks for Your notice. This last_job_time field is actually not necessary here
and will be removed from this structure.

Best regards
Michal 

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [dpdk-dev] [PATCH V1 1/1] jobstats: added function abort for job
  2016-01-27 15:57   ` Jastrzebski, MichalX K
@ 2016-01-28  7:41     ` Panu Matilainen
  0 siblings, 0 replies; 8+ messages in thread
From: Panu Matilainen @ 2016-01-28  7:41 UTC (permalink / raw)
  To: Jastrzebski, MichalX K, Kerlin, MarcinX, dev

On 01/27/2016 05:57 PM, Jastrzebski, MichalX K wrote:
>> -----Original Message-----
>> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Panu Matilainen
>> Sent: Wednesday, January 27, 2016 2:38 PM
>> To: Kerlin, MarcinX <marcinx.kerlin@intel.com>; dev@dpdk.org
>> Subject: Re: [dpdk-dev] [PATCH V1 1/1] jobstats: added function abort for job
>>
>> On 01/26/2016 06:15 PM, Marcin Kerlin wrote:
>>> This patch adds new function rte_jobstats_abort. It marks *job* as finished
>>> and time of this work will be add to management time instead of execution
>> time.
>>> This function should be used instead of rte_jobstats_finish if condition
>> occure,
>>> condition is defined by the application for example when receiving n>0
>> packets.
>>>
>>> Signed-off-by: Marcin Kerlin <marcinx.kerlin@intel.com>
>>> ---
>>>    lib/librte_jobstats/rte_jobstats.c           | 22 ++++++++++++++++++++++
>>>    lib/librte_jobstats/rte_jobstats.h           | 17 +++++++++++++++++
>>>    lib/librte_jobstats/rte_jobstats_version.map |  7 +++++++
>>>    3 files changed, 46 insertions(+)
>>>
>> [...]
>>> diff --git a/lib/librte_jobstats/rte_jobstats.h
>> b/lib/librte_jobstats/rte_jobstats.h
>>> index de6a89a..9995319 100644
>>> --- a/lib/librte_jobstats/rte_jobstats.h
>>> +++ b/lib/librte_jobstats/rte_jobstats.h
>>> @@ -90,6 +90,9 @@ struct rte_jobstats {
>>>    	uint64_t exec_cnt;
>>>    	/**< Execute count. */
>>>
>>> +	uint64_t last_job_time;
>>> +	/**< Last job time */
>>> +
>>>    	char name[RTE_JOBSTATS_NAMESIZE];
>>>    	/**< Name of this job */
>>>
>>
>> AFAICS this is an ABI break and as such, needs to be preannounced, see
>> http://dpdk.org/doc/guides/contributing/versioning.html
>> For 2.3 it'd need to be a CONFIG_RTE_NEXT_ABI feature.
>>
>> 	- Panu -
>
> Hi Panu,
> Thanks for Your notice. This last_job_time field is actually not necessary here
> and will be removed from this structure.

Right, makes sense. You can always add it later on when there's a more 
pressing need to break the ABI.

	- Panu -

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [dpdk-dev] [PATCH v2 1/1] jobstats: added function abort for job
  2016-01-26 16:15 [dpdk-dev] [PATCH V1 1/1] jobstats: added function abort for job Marcin Kerlin
  2016-01-27 13:37 ` Panu Matilainen
@ 2016-01-29 15:31 ` Marcin Kerlin
  2016-02-12 16:04   ` [dpdk-dev] [PATCH v3 " Marcin Kerlin
  1 sibling, 1 reply; 8+ messages in thread
From: Marcin Kerlin @ 2016-01-29 15:31 UTC (permalink / raw)
  To: dev

This patch adds new function rte_jobstats_abort. It marks *job* as finished
and time of this work will be add to management time instead of execution time.
This function should be used instead of rte_jobstats_finish if condition occurs,
condition is defined by the application for example when receiving n>0 packets.

v2:
* removed redundant field

Signed-off-by: Marcin Kerlin <marcinx.kerlin@intel.com>
---
 lib/librte_jobstats/rte_jobstats.c           | 20 ++++++++++++++++++++
 lib/librte_jobstats/rte_jobstats.h           | 14 ++++++++++++++
 lib/librte_jobstats/rte_jobstats_version.map |  7 +++++++
 3 files changed, 41 insertions(+)

diff --git a/lib/librte_jobstats/rte_jobstats.c b/lib/librte_jobstats/rte_jobstats.c
index 2eaac0c..2b42050 100644
--- a/lib/librte_jobstats/rte_jobstats.c
+++ b/lib/librte_jobstats/rte_jobstats.c
@@ -170,6 +170,26 @@ rte_jobstats_start(struct rte_jobstats_context *ctx, struct rte_jobstats *job)
 }
 
 int
+rte_jobstats_abort(struct rte_jobstats *job)
+{
+	struct rte_jobstats_context *ctx;
+	uint64_t now, exec_time;
+
+	/* Some sanity check. */
+	if (unlikely(job == NULL || job->context == NULL))
+		return -EINVAL;
+
+	ctx = job->context;
+	now = get_time();
+	exec_time = now - ctx->state_time;
+	ADD_TIME_MIN_MAX(ctx, management, exec_time);
+	ctx->state_time = now;
+	job->context = NULL;
+
+	return 0;
+}
+
+int
 rte_jobstats_finish(struct rte_jobstats *job, int64_t job_value)
 {
 	struct rte_jobstats_context *ctx;
diff --git a/lib/librte_jobstats/rte_jobstats.h b/lib/librte_jobstats/rte_jobstats.h
index de6a89a..c2b285f 100644
--- a/lib/librte_jobstats/rte_jobstats.h
+++ b/lib/librte_jobstats/rte_jobstats.h
@@ -237,6 +237,20 @@ int
 rte_jobstats_start(struct rte_jobstats_context *ctx, struct rte_jobstats *job);
 
 /**
+ * Mark that *job* finished its execution, but time of this work will be skipped
+ * and added to management time.
+ *
+ * @param job
+ *  Job object.
+ *
+ * @return
+ *  0 on success
+ *  -EINVAL if job is NULL or job was not started (it have no context).
+ */
+int
+rte_jobstats_abort(struct rte_jobstats *job);
+
+/**
  * Mark that *job* finished its execution. Context in which it was executing
  * will receive stat update. After this function call *job* object is ready to
  * be executed in other context.
diff --git a/lib/librte_jobstats/rte_jobstats_version.map b/lib/librte_jobstats/rte_jobstats_version.map
index cb01bfd..e3b21ca 100644
--- a/lib/librte_jobstats/rte_jobstats_version.map
+++ b/lib/librte_jobstats/rte_jobstats_version.map
@@ -17,3 +17,10 @@ DPDK_2.0 {
 
 	local: *;
 };
+
+DPDK_2.3 {
+	global:
+
+	rte_jobstats_abort;
+
+} DPDK_2.0;
-- 
1.9.1

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [dpdk-dev] [PATCH v3 1/1] jobstats: added function abort for job
  2016-01-29 15:31 ` [dpdk-dev] [PATCH v2 " Marcin Kerlin
@ 2016-02-12 16:04   ` Marcin Kerlin
  2016-02-16 13:19     ` Zhang, Roy Fan
  0 siblings, 1 reply; 8+ messages in thread
From: Marcin Kerlin @ 2016-02-12 16:04 UTC (permalink / raw)
  To: dev

This patch adds new function rte_jobstats_abort. It marks *job* as finished and
time of this work will be add to management time instead of execution time. This
function should be used instead of rte_jobstats_finish if condition occurs,
condition is defined by the application for example when receiving n>0 packets.
Example of usage is added to the example l2fwd-jobstats. At maximum load do-while
loop inside Idle job will be execute once because one or more jobs waiting to be
executed, so this time should not be include as the execution time by calling 
rte_jobstats_abort().

v2:
* removed redundant field
v3:
* added an example of using

Signed-off-by: Marcin Kerlin <marcinx.kerlin@intel.com>
---
 examples/l2fwd-jobstats/main.c               |  9 ++++++++-
 lib/librte_jobstats/rte_jobstats.c           | 20 ++++++++++++++++++++
 lib/librte_jobstats/rte_jobstats.h           | 14 ++++++++++++++
 lib/librte_jobstats/rte_jobstats_version.map |  7 +++++++
 4 files changed, 49 insertions(+), 1 deletion(-)

diff --git a/examples/l2fwd-jobstats/main.c b/examples/l2fwd-jobstats/main.c
index 7b59f4e..bd64e74 100644
--- a/examples/l2fwd-jobstats/main.c
+++ b/examples/l2fwd-jobstats/main.c
@@ -577,10 +577,13 @@ l2fwd_main_loop(void)
 			 */
 			rte_jobstats_start(&qconf->jobs_context, &qconf->idle_job);
 
+			uint64_t repeats = 0;
+
 			do {
 				uint8_t i;
 				uint64_t now = rte_get_timer_cycles();
 
+				repeats++;
 				need_manage = qconf->flush_timer.expire < now;
 				/* Check if we was esked to give a stats. */
 				stats_read_pending =
@@ -591,7 +594,11 @@ l2fwd_main_loop(void)
 					need_manage = qconf->rx_timers[i].expire < now;
 
 			} while (!need_manage);
-			rte_jobstats_finish(&qconf->idle_job, qconf->idle_job.target);
+
+			if (likely(repeats != 1))
+				rte_jobstats_finish(&qconf->idle_job, qconf->idle_job.target);
+			else
+				rte_jobstats_abort(&qconf->idle_job);
 
 			rte_timer_manage();
 			rte_jobstats_context_finish(&qconf->jobs_context);
diff --git a/lib/librte_jobstats/rte_jobstats.c b/lib/librte_jobstats/rte_jobstats.c
index 2eaac0c..2b42050 100644
--- a/lib/librte_jobstats/rte_jobstats.c
+++ b/lib/librte_jobstats/rte_jobstats.c
@@ -170,6 +170,26 @@ rte_jobstats_start(struct rte_jobstats_context *ctx, struct rte_jobstats *job)
 }
 
 int
+rte_jobstats_abort(struct rte_jobstats *job)
+{
+	struct rte_jobstats_context *ctx;
+	uint64_t now, exec_time;
+
+	/* Some sanity check. */
+	if (unlikely(job == NULL || job->context == NULL))
+		return -EINVAL;
+
+	ctx = job->context;
+	now = get_time();
+	exec_time = now - ctx->state_time;
+	ADD_TIME_MIN_MAX(ctx, management, exec_time);
+	ctx->state_time = now;
+	job->context = NULL;
+
+	return 0;
+}
+
+int
 rte_jobstats_finish(struct rte_jobstats *job, int64_t job_value)
 {
 	struct rte_jobstats_context *ctx;
diff --git a/lib/librte_jobstats/rte_jobstats.h b/lib/librte_jobstats/rte_jobstats.h
index de6a89a..c2b285f 100644
--- a/lib/librte_jobstats/rte_jobstats.h
+++ b/lib/librte_jobstats/rte_jobstats.h
@@ -237,6 +237,20 @@ int
 rte_jobstats_start(struct rte_jobstats_context *ctx, struct rte_jobstats *job);
 
 /**
+ * Mark that *job* finished its execution, but time of this work will be skipped
+ * and added to management time.
+ *
+ * @param job
+ *  Job object.
+ *
+ * @return
+ *  0 on success
+ *  -EINVAL if job is NULL or job was not started (it have no context).
+ */
+int
+rte_jobstats_abort(struct rte_jobstats *job);
+
+/**
  * Mark that *job* finished its execution. Context in which it was executing
  * will receive stat update. After this function call *job* object is ready to
  * be executed in other context.
diff --git a/lib/librte_jobstats/rte_jobstats_version.map b/lib/librte_jobstats/rte_jobstats_version.map
index cb01bfd..e3b21ca 100644
--- a/lib/librte_jobstats/rte_jobstats_version.map
+++ b/lib/librte_jobstats/rte_jobstats_version.map
@@ -17,3 +17,10 @@ DPDK_2.0 {
 
 	local: *;
 };
+
+DPDK_2.3 {
+	global:
+
+	rte_jobstats_abort;
+
+} DPDK_2.0;
-- 
1.9.1

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [dpdk-dev] [PATCH v3 1/1] jobstats: added function abort for job
  2016-02-12 16:04   ` [dpdk-dev] [PATCH v3 " Marcin Kerlin
@ 2016-02-16 13:19     ` Zhang, Roy Fan
  2016-02-29 10:21       ` Thomas Monjalon
  0 siblings, 1 reply; 8+ messages in thread
From: Zhang, Roy Fan @ 2016-02-16 13:19 UTC (permalink / raw)
  To: Marcin Kerlin; +Cc: dev



On 12/02/2016 16:04, Marcin Kerlin wrote:
> This patch adds new function rte_jobstats_abort. It marks *job* as finished and
> time of this work will be add to management time instead of execution time. This
> function should be used instead of rte_jobstats_finish if condition occurs,
> condition is defined by the application for example when receiving n>0 packets.
> Example of usage is added to the example l2fwd-jobstats. At maximum load do-while
> loop inside Idle job will be execute once because one or more jobs waiting to be
> executed, so this time should not be include as the execution time by calling
> rte_jobstats_abort().
>
> v2:
> * removed redundant field
> v3:
> * added an example of using
>
> Signed-off-by: Marcin Kerlin <marcinx.kerlin@intel.com>
> ---
>   examples/l2fwd-jobstats/main.c               |  9 ++++++++-
>   lib/librte_jobstats/rte_jobstats.c           | 20 ++++++++++++++++++++
>   lib/librte_jobstats/rte_jobstats.h           | 14 ++++++++++++++
>   lib/librte_jobstats/rte_jobstats_version.map |  7 +++++++
>   4 files changed, 49 insertions(+), 1 deletion(-)
>
> diff --git a/examples/l2fwd-jobstats/main.c b/examples/l2fwd-jobstats/main.c
> index 7b59f4e..bd64e74 100644
> --- a/examples/l2fwd-jobstats/main.c
> +++ b/examples/l2fwd-jobstats/main.c
> @@ -577,10 +577,13 @@ l2fwd_main_loop(void)
>   			 */
>   			rte_jobstats_start(&qconf->jobs_context, &qconf->idle_job);
>   
> +			uint64_t repeats = 0;
> +
>   			do {
>   				uint8_t i;
>   				uint64_t now = rte_get_timer_cycles();
>   
> +				repeats++;
>   				need_manage = qconf->flush_timer.expire < now;
>   				/* Check if we was esked to give a stats. */
>   				stats_read_pending =
> @@ -591,7 +594,11 @@ l2fwd_main_loop(void)
>   					need_manage = qconf->rx_timers[i].expire < now;
>   
>   			} while (!need_manage);
> -			rte_jobstats_finish(&qconf->idle_job, qconf->idle_job.target);
> +
> +			if (likely(repeats != 1))
> +				rte_jobstats_finish(&qconf->idle_job, qconf->idle_job.target);
> +			else
> +				rte_jobstats_abort(&qconf->idle_job);
>   
>   			rte_timer_manage();
>   			rte_jobstats_context_finish(&qconf->jobs_context);
> diff --git a/lib/librte_jobstats/rte_jobstats.c b/lib/librte_jobstats/rte_jobstats.c
> index 2eaac0c..2b42050 100644
> --- a/lib/librte_jobstats/rte_jobstats.c
> +++ b/lib/librte_jobstats/rte_jobstats.c
> @@ -170,6 +170,26 @@ rte_jobstats_start(struct rte_jobstats_context *ctx, struct rte_jobstats *job)
>   }
>   
>   int
> +rte_jobstats_abort(struct rte_jobstats *job)
> +{
> +	struct rte_jobstats_context *ctx;
> +	uint64_t now, exec_time;
> +
> +	/* Some sanity check. */
> +	if (unlikely(job == NULL || job->context == NULL))
> +		return -EINVAL;
> +
> +	ctx = job->context;
> +	now = get_time();
> +	exec_time = now - ctx->state_time;
> +	ADD_TIME_MIN_MAX(ctx, management, exec_time);
> +	ctx->state_time = now;
> +	job->context = NULL;
> +
> +	return 0;
> +}
> +
> +int
>   rte_jobstats_finish(struct rte_jobstats *job, int64_t job_value)
>   {
>   	struct rte_jobstats_context *ctx;
> diff --git a/lib/librte_jobstats/rte_jobstats.h b/lib/librte_jobstats/rte_jobstats.h
> index de6a89a..c2b285f 100644
> --- a/lib/librte_jobstats/rte_jobstats.h
> +++ b/lib/librte_jobstats/rte_jobstats.h
> @@ -237,6 +237,20 @@ int
>   rte_jobstats_start(struct rte_jobstats_context *ctx, struct rte_jobstats *job);
>   
>   /**
> + * Mark that *job* finished its execution, but time of this work will be skipped
> + * and added to management time.
> + *
> + * @param job
> + *  Job object.
> + *
> + * @return
> + *  0 on success
> + *  -EINVAL if job is NULL or job was not started (it have no context).
> + */
> +int
> +rte_jobstats_abort(struct rte_jobstats *job);
> +
> +/**
>    * Mark that *job* finished its execution. Context in which it was executing
>    * will receive stat update. After this function call *job* object is ready to
>    * be executed in other context.
> diff --git a/lib/librte_jobstats/rte_jobstats_version.map b/lib/librte_jobstats/rte_jobstats_version.map
> index cb01bfd..e3b21ca 100644
> --- a/lib/librte_jobstats/rte_jobstats_version.map
> +++ b/lib/librte_jobstats/rte_jobstats_version.map
> @@ -17,3 +17,10 @@ DPDK_2.0 {
>   
>   	local: *;
>   };
> +
> +DPDK_2.3 {
> +	global:
> +
> +	rte_jobstats_abort;
> +
> +} DPDK_2.0;

Acked-by : Fan Zhang<roy.fan.zhang@intel.com>

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [dpdk-dev] [PATCH v3 1/1] jobstats: added function abort for job
  2016-02-16 13:19     ` Zhang, Roy Fan
@ 2016-02-29 10:21       ` Thomas Monjalon
  0 siblings, 0 replies; 8+ messages in thread
From: Thomas Monjalon @ 2016-02-29 10:21 UTC (permalink / raw)
  To: Marcin Kerlin; +Cc: dev

2016-02-16 13:19, Zhang, Roy Fan:
> 
> On 12/02/2016 16:04, Marcin Kerlin wrote:
> > This patch adds new function rte_jobstats_abort. It marks *job* as finished and
> > time of this work will be add to management time instead of execution time. This
> > function should be used instead of rte_jobstats_finish if condition occurs,
> > condition is defined by the application for example when receiving n>0 packets.
> > Example of usage is added to the example l2fwd-jobstats. At maximum load do-while
> > loop inside Idle job will be execute once because one or more jobs waiting to be
> > executed, so this time should not be include as the execution time by calling
> > rte_jobstats_abort().
> >
> > v2:
> > * removed redundant field
> > v3:
> > * added an example of using
> >
> > Signed-off-by: Marcin Kerlin <marcinx.kerlin@intel.com>
[...]
> > --- a/lib/librte_jobstats/rte_jobstats_version.map
> > +++ b/lib/librte_jobstats/rte_jobstats_version.map
> > @@ -17,3 +17,10 @@ DPDK_2.0 {
> >   
> >   	local: *;
> >   };
> > +
> > +DPDK_2.3 {

updated to 16.04

> > +	global:
> > +
> > +	rte_jobstats_abort;
> > +
> > +} DPDK_2.0;
> 
> Acked-by : Fan Zhang<roy.fan.zhang@intel.com>

Applied, thanks

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2016-02-29 10:23 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-01-26 16:15 [dpdk-dev] [PATCH V1 1/1] jobstats: added function abort for job Marcin Kerlin
2016-01-27 13:37 ` Panu Matilainen
2016-01-27 15:57   ` Jastrzebski, MichalX K
2016-01-28  7:41     ` Panu Matilainen
2016-01-29 15:31 ` [dpdk-dev] [PATCH v2 " Marcin Kerlin
2016-02-12 16:04   ` [dpdk-dev] [PATCH v3 " Marcin Kerlin
2016-02-16 13:19     ` Zhang, Roy Fan
2016-02-29 10:21       ` Thomas Monjalon

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).