examples/ioat: fix stats print

Message ID 20200917110221.205960-1-kevin.laatz@intel.com (mailing list archive)
State Superseded, archived
Headers
Series examples/ioat: fix stats print |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/iol-testing success Testing PASS
ci/travis-robot success Travis build: passed
ci/Intel-compilation success Compilation OK

Commit Message

Kevin Laatz Sept. 17, 2020, 11:02 a.m. UTC
  Currently some of the status string at the top of the stats output is being
cut off. To fix this, the status string array size has been increased.

Bugzilla ID: 536
Fixes: 632bcd9b5d4f ("examples/ioat: print statistics")

Signed-off-by: Kevin Laatz <kevin.laatz@intel.com>
---
 examples/ioat/ioatfwd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
  

Comments

Bruce Richardson Sept. 17, 2020, 11:34 a.m. UTC | #1
On Thu, Sep 17, 2020 at 12:02:21PM +0100, Kevin Laatz wrote:
> Currently some of the status string at the top of the stats output is being
> cut off. To fix this, the status string array size has been increased.
> 
> Bugzilla ID: 536
> Fixes: 632bcd9b5d4f ("examples/ioat: print statistics")
> 
> Signed-off-by: Kevin Laatz <kevin.laatz@intel.com>
> ---
>  examples/ioat/ioatfwd.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/examples/ioat/ioatfwd.c b/examples/ioat/ioatfwd.c
> index 43a19843ee..8a8c81edfb 100644
> --- a/examples/ioat/ioatfwd.c
> +++ b/examples/ioat/ioatfwd.c
> @@ -168,7 +168,7 @@ print_stats(char *prgname)
>  	struct rte_rawdev_xstats_name *names_xstats;
>  	uint64_t *xstats;
>  	unsigned int *ids_xstats, nb_xstats;
> -	char status_string[120]; /* to print at the top of the output */
> +	char status_string[140]; /* to print at the top of the output */
>  	int status_strlen;
>  	int ret;
>
This seems a rather small increment - normally if a string is too small I'd
bump it up by a serious amount. 255 might be a good value here.

Also, to avoid the display looking strange in case of future truncation
(which is not very likely with a size of 255 if you increment to that), the
final '\n' should be included in the printf rather than in the string
to be printed.

Regards,
/Bruce
  

Patch

diff --git a/examples/ioat/ioatfwd.c b/examples/ioat/ioatfwd.c
index 43a19843ee..8a8c81edfb 100644
--- a/examples/ioat/ioatfwd.c
+++ b/examples/ioat/ioatfwd.c
@@ -168,7 +168,7 @@  print_stats(char *prgname)
 	struct rte_rawdev_xstats_name *names_xstats;
 	uint64_t *xstats;
 	unsigned int *ids_xstats, nb_xstats;
-	char status_string[120]; /* to print at the top of the output */
+	char status_string[140]; /* to print at the top of the output */
 	int status_strlen;
 	int ret;