DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] examples/ioat: fix stats print
@ 2020-09-17 11:02 Kevin Laatz
  2020-09-17 11:34 ` Bruce Richardson
  2020-09-17 13:07 ` [dpdk-dev] [PATCH v2] " Kevin Laatz
  0 siblings, 2 replies; 5+ messages in thread
From: Kevin Laatz @ 2020-09-17 11:02 UTC (permalink / raw)
  To: dev; +Cc: marcinx.baran, pawelx.modrak, bruce.richardson, Kevin Laatz

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;
 
-- 
2.25.1


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

* Re: [dpdk-dev] [PATCH] examples/ioat: fix stats print
  2020-09-17 11:02 [dpdk-dev] [PATCH] examples/ioat: fix stats print Kevin Laatz
@ 2020-09-17 11:34 ` Bruce Richardson
  2020-09-17 13:07 ` [dpdk-dev] [PATCH v2] " Kevin Laatz
  1 sibling, 0 replies; 5+ messages in thread
From: Bruce Richardson @ 2020-09-17 11:34 UTC (permalink / raw)
  To: Kevin Laatz; +Cc: dev, marcinx.baran, pawelx.modrak

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

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

* [dpdk-dev] [PATCH v2] examples/ioat: fix stats print
  2020-09-17 11:02 [dpdk-dev] [PATCH] examples/ioat: fix stats print Kevin Laatz
  2020-09-17 11:34 ` Bruce Richardson
@ 2020-09-17 13:07 ` Kevin Laatz
  2020-09-17 13:21   ` Bruce Richardson
  1 sibling, 1 reply; 5+ messages in thread
From: Kevin Laatz @ 2020-09-17 13:07 UTC (permalink / raw)
  To: dev; +Cc: marcinx.baran, pawelx.modrak, bruce.richardson, Kevin Laatz

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.
In addition to this, the "\n" has been moved to the printf, rather than
having it in the last string, in case of future formatting issues due to
truncation.

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

Signed-off-by: Kevin Laatz <kevin.laatz@intel.com>

---
v2:
  - Increased string array by larger value - ie. up to 255.
  - Moved the "\n" to avoid future formatting issues from truncation.
---
 examples/ioat/ioatfwd.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/examples/ioat/ioatfwd.c b/examples/ioat/ioatfwd.c
index 43a19843ee..4e971dc054 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[255]; /* to print at the top of the output */
 	int status_strlen;
 	int ret;
 
@@ -194,7 +194,7 @@ print_stats(char *prgname)
 		"Rx Queues = %d, ", nb_queues);
 	status_strlen += snprintf(status_string + status_strlen,
 		sizeof(status_string) - status_strlen,
-		"Ring Size = %d\n", ring_size);
+		"Ring Size = %d", ring_size);
 
 	/* Allocate memory for xstats names and values */
 	ret = rte_rawdev_xstats_names_get(
@@ -251,7 +251,7 @@ print_stats(char *prgname)
 
 		memset(&delta_ts, 0, sizeof(struct total_statistics));
 
-		printf("%s", status_string);
+		printf("%s\n", status_string);
 
 		for (i = 0; i < cfg.nb_ports; i++) {
 			port_id = cfg.ports[i].rxtx_port;
-- 
2.25.1


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

* Re: [dpdk-dev] [PATCH v2] examples/ioat: fix stats print
  2020-09-17 13:07 ` [dpdk-dev] [PATCH v2] " Kevin Laatz
@ 2020-09-17 13:21   ` Bruce Richardson
  2020-10-08 12:44     ` Thomas Monjalon
  0 siblings, 1 reply; 5+ messages in thread
From: Bruce Richardson @ 2020-09-17 13:21 UTC (permalink / raw)
  To: Kevin Laatz; +Cc: dev, marcinx.baran, pawelx.modrak

On Thu, Sep 17, 2020 at 02:07:40PM +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.
> In addition to this, the "\n" has been moved to the printf, rather than
> having it in the last string, in case of future formatting issues due to
> truncation.
> 
> Bugzilla ID: 536
> Fixes: 632bcd9b5d4f ("examples/ioat: print statistics")
> 
> Signed-off-by: Kevin Laatz <kevin.laatz@intel.com>
> 
Acked-by: Bruce Richardson <bruce.richardson@intel.com>

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

* Re: [dpdk-dev] [PATCH v2] examples/ioat: fix stats print
  2020-09-17 13:21   ` Bruce Richardson
@ 2020-10-08 12:44     ` Thomas Monjalon
  0 siblings, 0 replies; 5+ messages in thread
From: Thomas Monjalon @ 2020-10-08 12:44 UTC (permalink / raw)
  To: Kevin Laatz; +Cc: dev, marcinx.baran, pawelx.modrak, Bruce Richardson, stable

17/09/2020 15:21, Bruce Richardson:
> On Thu, Sep 17, 2020 at 02:07:40PM +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.
> > In addition to this, the "\n" has been moved to the printf, rather than
> > having it in the last string, in case of future formatting issues due to
> > truncation.
> > 
> > Bugzilla ID: 536
> > Fixes: 632bcd9b5d4f ("examples/ioat: print statistics")

+Cc: stable@dpdk.org

> > Signed-off-by: Kevin Laatz <kevin.laatz@intel.com>
> > 
> Acked-by: Bruce Richardson <bruce.richardson@intel.com>

Applied, thanks



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

end of thread, other threads:[~2020-10-08 12:45 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-17 11:02 [dpdk-dev] [PATCH] examples/ioat: fix stats print Kevin Laatz
2020-09-17 11:34 ` Bruce Richardson
2020-09-17 13:07 ` [dpdk-dev] [PATCH v2] " Kevin Laatz
2020-09-17 13:21   ` Bruce Richardson
2020-10-08 12:44     ` Thomas Monjalon

DPDK patches and discussions

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://inbox.dpdk.org/dev/0 dev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 dev dev/ https://inbox.dpdk.org/dev \
		dev@dpdk.org
	public-inbox-index dev

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://inbox.dpdk.org/inbox.dpdk.dev


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git