netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ipvs -- print statistics in decimal.
@ 2003-09-15 21:41 Stephen Hemminger
  2003-09-15 22:59 ` Roberto Nibali
  0 siblings, 1 reply; 2+ messages in thread
From: Stephen Hemminger @ 2003-09-15 21:41 UTC (permalink / raw)
  To: David S. Miller; +Cc: lvs-users, netdev

Most of of us read decimal better than hex ;-)

Assumes earlier seq_file patch.
diff -Nru a/net/ipv4/ipvs/ip_vs_ctl.c b/net/ipv4/ipvs/ip_vs_ctl.c
--- a/net/ipv4/ipvs/ip_vs_ctl.c	Mon Sep 15 14:31:43 2003
+++ b/net/ipv4/ipvs/ip_vs_ctl.c	Mon Sep 15 14:31:43 2003
@@ -1716,22 +1716,22 @@
 #ifdef CONFIG_PROC_FS
 static int ip_vs_stats_show(struct seq_file *seq, void *v)
 {
+	static const char hfmt[]
+		= "%10s %10s %10s %20s %20s\n";
 
-/*               01234567 01234567 01234567 0123456701234567 0123456701234567 */
-	seq_puts(seq,
-		 "   Total Incoming Outgoing         Incoming         Outgoing\n");
-	seq_printf(seq, 	   
-		   "   Conns  Packets  Packets            Bytes            Bytes\n");
+	seq_printf(seq, hfmt, "Total", "Incoming", "Outgoing", 
+		   "Incoming" ,"Outgoing");
+	seq_printf(seq, hfmt, "Conns", "Packets","Packets","Bytes","Bytes");
 
 	spin_lock_bh(&ip_vs_stats.lock);
-	seq_printf(seq, "%8X %8X %8X %16LX %16LX\n\n", ip_vs_stats.conns,
+	seq_printf(seq, "%10u %10u %10u %20llu %20llu\n\n", 
+		   ip_vs_stats.conns,
 		   ip_vs_stats.inpkts, ip_vs_stats.outpkts,
 		   ip_vs_stats.inbytes, ip_vs_stats.outbytes);
 
-/*                 01234567 01234567 01234567 0123456701234567 0123456701234567 */
-	seq_puts(seq,
-		   " Conns/s   Pkts/s   Pkts/s          Bytes/s          Bytes/s\n");
-	seq_printf(seq,"%8X %8X %8X %16X %16X\n",
+	seq_printf(seq, hfmt, "Conns/s", "Pkts/s","Pkts/s", 
+		   "Bytes/s","Bytes/s");
+	seq_printf(seq,"%10u %10u %10u %20u %20u\n",
 			ip_vs_stats.cps,
 			ip_vs_stats.inpps,
 			ip_vs_stats.outpps,

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

* Re: [PATCH] ipvs -- print statistics in decimal.
  2003-09-15 21:41 [PATCH] ipvs -- print statistics in decimal Stephen Hemminger
@ 2003-09-15 22:59 ` Roberto Nibali
  0 siblings, 0 replies; 2+ messages in thread
From: Roberto Nibali @ 2003-09-15 22:59 UTC (permalink / raw)
  To: LinuxVirtualServer.org users mailing list.
  Cc: David S. Miller, netdev, Wensong Zhang

Stephen Hemminger wrote:
> Most of of us read decimal better than hex ;-)

While I agree with your comment this will seriously break existing user 
space applications, such as for example ipvsadm.

> Assumes earlier seq_file patch.
> diff -Nru a/net/ipv4/ipvs/ip_vs_ctl.c b/net/ipv4/ipvs/ip_vs_ctl.c
> --- a/net/ipv4/ipvs/ip_vs_ctl.c	Mon Sep 15 14:31:43 2003
> +++ b/net/ipv4/ipvs/ip_vs_ctl.c	Mon Sep 15 14:31:43 2003
> @@ -1716,22 +1716,22 @@
>  #ifdef CONFIG_PROC_FS
>  static int ip_vs_stats_show(struct seq_file *seq, void *v)
>  {
> +	static const char hfmt[]
> +		= "%10s %10s %10s %20s %20s\n";
>  
> -/*               01234567 01234567 01234567 0123456701234567 0123456701234567 */
> -	seq_puts(seq,
> -		 "   Total Incoming Outgoing         Incoming         Outgoing\n");
> -	seq_printf(seq, 	   
> -		   "   Conns  Packets  Packets            Bytes            Bytes\n");
> +	seq_printf(seq, hfmt, "Total", "Incoming", "Outgoing", 
> +		   "Incoming" ,"Outgoing");
> +	seq_printf(seq, hfmt, "Conns", "Packets","Packets","Bytes","Bytes");
>  
>  	spin_lock_bh(&ip_vs_stats.lock);
> -	seq_printf(seq, "%8X %8X %8X %16LX %16LX\n\n", ip_vs_stats.conns,
> +	seq_printf(seq, "%10u %10u %10u %20llu %20llu\n\n", 
> +		   ip_vs_stats.conns,
>  		   ip_vs_stats.inpkts, ip_vs_stats.outpkts,
>  		   ip_vs_stats.inbytes, ip_vs_stats.outbytes);

You break ipvsadm.

> -/*                 01234567 01234567 01234567 0123456701234567 0123456701234567 */
> -	seq_puts(seq,
> -		   " Conns/s   Pkts/s   Pkts/s          Bytes/s          Bytes/s\n");
> -	seq_printf(seq,"%8X %8X %8X %16X %16X\n",
> +	seq_printf(seq, hfmt, "Conns/s", "Pkts/s","Pkts/s", 
> +		   "Bytes/s","Bytes/s");
> +	seq_printf(seq,"%10u %10u %10u %20u %20u\n",
>  			ip_vs_stats.cps,
>  			ip_vs_stats.inpps,
>  			ip_vs_stats.outpps,

Ditto.

Best regards,
Roberto Nibali, ratz
-- 
echo '[q]sa[ln0=aln256%Pln256/snlbx]sb3135071790101768542287578439snlbxq'|dc

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

end of thread, other threads:[~2003-09-15 22:59 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-09-15 21:41 [PATCH] ipvs -- print statistics in decimal Stephen Hemminger
2003-09-15 22:59 ` Roberto Nibali

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).