diff mbox

example:generator:printing verbose output

Message ID 1438084388-29456-1-git-send-email-balakrishna.garapati@linaro.org
State New
Headers show

Commit Message

Balakrishna Garapati July 28, 2015, 11:53 a.m. UTC
Signed-off-by: Balakrishna.Garapati <balakrishna.garapati@linaro.org>
---
 example/generator/odp_generator.c | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

Comments

Stuart Haslam July 28, 2015, 12:54 p.m. UTC | #1
On Tue, Jul 28, 2015 at 01:53:08PM +0200, Balakrishna.Garapati wrote:
> Signed-off-by: Balakrishna.Garapati <balakrishna.garapati@linaro.org>
> ---
>  example/generator/odp_generator.c | 13 ++++++++++++-
>  1 file changed, 12 insertions(+), 1 deletion(-)
> 
> diff --git a/example/generator/odp_generator.c b/example/generator/odp_generator.c
> index d6ec758..a33d530 100644
> --- a/example/generator/odp_generator.c
> +++ b/example/generator/odp_generator.c
> @@ -26,6 +26,7 @@
>  #define MAX_WORKERS            32		/**< max number of works */
>  #define SHM_PKT_POOL_SIZE      (512*2048)	/**< pkt pool size */
>  #define SHM_PKT_POOL_BUF_SIZE  1856		/**< pkt pool buf size */
> +#define DEFAULT_PKT_INTERVAL   1000             /**< interval btw each pkt */
>  
>  #define APPL_MODE_UDP    0			/**< UDP mode */
>  #define APPL_MODE_PING   1			/**< ping mode */
> @@ -370,6 +371,7 @@ static odp_pktio_t create_pktio(const char *dev, odp_pool_t pool)
>  static void *gen_send_thread(void *arg)
>  {
>  	int thr;
> +	uint64_t start, now, diff;
>  	odp_pktio_t pktio;
>  	thread_args_t *thr_args;
>  	odp_queue_t outq_def;
> @@ -391,6 +393,7 @@ static void *gen_send_thread(void *arg)
>  		return NULL;
>  	}
>  
> +	start = odp_time_cycles();
>  	printf("  [%02i] created mode: SEND\n", thr);
>  	for (;;) {
>  		int err;
> @@ -431,6 +434,14 @@ static void *gen_send_thread(void *arg)
>  		    >= (unsigned int)args->appl.number) {
>  			break;
>  		}
> +
> +		now = odp_time_cycles();
> +		diff = odp_time_diff_cycles(start, now);
> +		if(odp_time_cycles_to_ns(diff) > 20*ODP_TIME_SEC) {
> +			start = odp_time_cycles();
> +			printf("  [%02i] total send: %ju\n",
> +				thr, odp_atomic_load_u64(&counters.seq));
> +		}

This prints every ~20 seconds for me as expected.. though I had to
fflush(stdout) to make it visible.

I assume for you it still prints much more frequently, could you stick
the output of ./example/timer/odp_timer_test from your machine on
paste.linaro.org?

--
Stuart.
diff mbox

Patch

diff --git a/example/generator/odp_generator.c b/example/generator/odp_generator.c
index d6ec758..a33d530 100644
--- a/example/generator/odp_generator.c
+++ b/example/generator/odp_generator.c
@@ -26,6 +26,7 @@ 
 #define MAX_WORKERS            32		/**< max number of works */
 #define SHM_PKT_POOL_SIZE      (512*2048)	/**< pkt pool size */
 #define SHM_PKT_POOL_BUF_SIZE  1856		/**< pkt pool buf size */
+#define DEFAULT_PKT_INTERVAL   1000             /**< interval btw each pkt */
 
 #define APPL_MODE_UDP    0			/**< UDP mode */
 #define APPL_MODE_PING   1			/**< ping mode */
@@ -370,6 +371,7 @@  static odp_pktio_t create_pktio(const char *dev, odp_pool_t pool)
 static void *gen_send_thread(void *arg)
 {
 	int thr;
+	uint64_t start, now, diff;
 	odp_pktio_t pktio;
 	thread_args_t *thr_args;
 	odp_queue_t outq_def;
@@ -391,6 +393,7 @@  static void *gen_send_thread(void *arg)
 		return NULL;
 	}
 
+	start = odp_time_cycles();
 	printf("  [%02i] created mode: SEND\n", thr);
 	for (;;) {
 		int err;
@@ -431,6 +434,14 @@  static void *gen_send_thread(void *arg)
 		    >= (unsigned int)args->appl.number) {
 			break;
 		}
+
+		now = odp_time_cycles();
+		diff = odp_time_diff_cycles(start, now);
+		if(odp_time_cycles_to_ns(diff) > 20*ODP_TIME_SEC) {
+			start = odp_time_cycles();
+			printf("  [%02i] total send: %ju\n",
+				thr, odp_atomic_load_u64(&counters.seq));
+		}
 	}
 
 	/* receive number of reply pks until timeout */
@@ -439,7 +450,7 @@  static void *gen_send_thread(void *arg)
 			if (odp_atomic_load_u64(&counters.icmp) >=
 			    (unsigned int)args->appl.number)
 				break;
-			millisleep(1000,
+			millisleep(DEFAULT_PKT_INTERVAL,
 				   thr_args->tp,
 				   thr_args->tim,
 				   thr_args->tq,