diff mbox

example: classifier: resolve text alignment issues

Message ID 1438788249-8917-1-git-send-email-stuart.haslam@linaro.org
State Accepted
Commit 021867cb973eff62495196c1f7f4db70c8dc0358
Headers show

Commit Message

Stuart Haslam Aug. 5, 2015, 3:24 p.m. UTC
When the string containing the number of packets processed by one of the
queues gets for be longer than a tab the alignment is messed up and the
fields overlap with part of a previous value.

Signed-off-by: Stuart Haslam <stuart.haslam@linaro.org>
---
 example/classifier/odp_classifier.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

Comments

Balasubramanian Manoharan Aug. 5, 2015, 3:30 p.m. UTC | #1
Reviewed-by: Balasubramanian Manoharan <bala.manoharan@linaro.org>

Regards,
Bala

> On 05-Aug-2015, at 8:54 pm, Stuart Haslam <stuart.haslam@linaro.org> wrote:
> 
> When the string containing the number of packets processed by one of the
> queues gets for be longer than a tab the alignment is messed up and the
> fields overlap with part of a previous value.
> 
> Signed-off-by: Stuart Haslam <stuart.haslam@linaro.org>
> ---
> example/classifier/odp_classifier.c | 10 ++++++----
> 1 file changed, 6 insertions(+), 4 deletions(-)
> 
> diff --git a/example/classifier/odp_classifier.c b/example/classifier/odp_classifier.c
> index bed254d..ba79055 100644
> --- a/example/classifier/odp_classifier.c
> +++ b/example/classifier/odp_classifier.c
> @@ -122,7 +122,7 @@ void print_cls_statistics(appl_args_t *args)
>        printf("-");
>    printf("\n");
>    for (i = 0; i < args->policy_count; i++)
> -        printf("%s\t", args->stats[i].queue_name);
> +        printf("%-12s ", args->stats[i].queue_name);
>    printf("Total Packets");
>    printf("\n");
> 
> @@ -135,17 +135,19 @@ void print_cls_statistics(appl_args_t *args)
> 
>    for (; timeout > 0 || infinite; timeout--) {
>        for (i = 0; i < args->policy_count; i++)
> -            printf("%"PRIu64"\t",
> +            printf("%-12" PRIu64 " ",
>                   odp_atomic_load_u64(&args->stats[i]
>                           .packet_count));
> 
> -        printf("\t%"PRIu64"\t", odp_atomic_load_u64(&args->
> -                                total_packets));
> +        printf("%-" PRIu64, odp_atomic_load_u64(&args->
> +                            total_packets));
> 
>        sleep(1);
>        printf("\r");
>        fflush(stdout);
>    }
> +
> +    printf("\n");
> }
> 
> static inline
> -- 
> 2.1.1
> 
> _______________________________________________
> lng-odp mailing list
> lng-odp@lists.linaro.org
> https://lists.linaro.org/mailman/listinfo/lng-odp
Maxim Uvarov Aug. 6, 2015, 12:38 p.m. UTC | #2
Merged,
Maxim.

On 08/05/15 18:30, Bala wrote:
> Reviewed-by: Balasubramanian Manoharan <bala.manoharan@linaro.org>
>
> Regards,
> Bala
>
>> On 05-Aug-2015, at 8:54 pm, Stuart Haslam <stuart.haslam@linaro.org> wrote:
>>
>> When the string containing the number of packets processed by one of the
>> queues gets for be longer than a tab the alignment is messed up and the
>> fields overlap with part of a previous value.
>>
>> Signed-off-by: Stuart Haslam <stuart.haslam@linaro.org>
>> ---
>> example/classifier/odp_classifier.c | 10 ++++++----
>> 1 file changed, 6 insertions(+), 4 deletions(-)
>>
>> diff --git a/example/classifier/odp_classifier.c b/example/classifier/odp_classifier.c
>> index bed254d..ba79055 100644
>> --- a/example/classifier/odp_classifier.c
>> +++ b/example/classifier/odp_classifier.c
>> @@ -122,7 +122,7 @@ void print_cls_statistics(appl_args_t *args)
>>         printf("-");
>>     printf("\n");
>>     for (i = 0; i < args->policy_count; i++)
>> -        printf("%s\t", args->stats[i].queue_name);
>> +        printf("%-12s ", args->stats[i].queue_name);
>>     printf("Total Packets");
>>     printf("\n");
>>
>> @@ -135,17 +135,19 @@ void print_cls_statistics(appl_args_t *args)
>>
>>     for (; timeout > 0 || infinite; timeout--) {
>>         for (i = 0; i < args->policy_count; i++)
>> -            printf("%"PRIu64"\t",
>> +            printf("%-12" PRIu64 " ",
>>                    odp_atomic_load_u64(&args->stats[i]
>>                            .packet_count));
>>
>> -        printf("\t%"PRIu64"\t", odp_atomic_load_u64(&args->
>> -                                total_packets));
>> +        printf("%-" PRIu64, odp_atomic_load_u64(&args->
>> +                            total_packets));
>>
>>         sleep(1);
>>         printf("\r");
>>         fflush(stdout);
>>     }
>> +
>> +    printf("\n");
>> }
>>
>> static inline
>> -- 
>> 2.1.1
>>
>> _______________________________________________
>> lng-odp mailing list
>> lng-odp@lists.linaro.org
>> https://lists.linaro.org/mailman/listinfo/lng-odp
> _______________________________________________
> lng-odp mailing list
> lng-odp@lists.linaro.org
> https://lists.linaro.org/mailman/listinfo/lng-odp
diff mbox

Patch

diff --git a/example/classifier/odp_classifier.c b/example/classifier/odp_classifier.c
index bed254d..ba79055 100644
--- a/example/classifier/odp_classifier.c
+++ b/example/classifier/odp_classifier.c
@@ -122,7 +122,7 @@  void print_cls_statistics(appl_args_t *args)
 		printf("-");
 	printf("\n");
 	for (i = 0; i < args->policy_count; i++)
-		printf("%s\t", args->stats[i].queue_name);
+		printf("%-12s ", args->stats[i].queue_name);
 	printf("Total Packets");
 	printf("\n");
 
@@ -135,17 +135,19 @@  void print_cls_statistics(appl_args_t *args)
 
 	for (; timeout > 0 || infinite; timeout--) {
 		for (i = 0; i < args->policy_count; i++)
-			printf("%"PRIu64"\t",
+			printf("%-12" PRIu64 " ",
 			       odp_atomic_load_u64(&args->stats[i]
 						   .packet_count));
 
-		printf("\t%"PRIu64"\t", odp_atomic_load_u64(&args->
-							    total_packets));
+		printf("%-" PRIu64, odp_atomic_load_u64(&args->
+							total_packets));
 
 		sleep(1);
 		printf("\r");
 		fflush(stdout);
 	}
+
+	printf("\n");
 }
 
 static inline