Jelajahi Sumber

whitespaces printed in stats now

Jiri Kuthan 23 tahun lalu
induk
melakukan
cafca31b5c
3 mengubah file dengan 12 tambahan dan 5 penghapusan
  1. 7 0
      config.h
  2. 4 4
      modules/tm/t_stats.c
  3. 1 1
      scripts/sc

+ 7 - 0
config.h

@@ -105,4 +105,11 @@
 
 /* maximum length of Contact heder field in redirection replies */
 #define MAX_REDIRECTION_LEN 512
+
+/* used by FIFO statistics in module to terminate line;
+   extra whitespaces are used to overwrite remainders of
+   previous line if longer than current one
+*/
+#define CLEANUP_EOL "      \n"
+
 #endif

+ 4 - 4
modules/tm/t_stats.c

@@ -25,7 +25,7 @@ int print_stats(  FILE *f )
 		cur_stats->transactions );
 	fprintf(f, "local: %d, ",
 		cur_stats->client_transactions );
-	fprintf(f, "waiting: %d\n",
+	fprintf(f, "waiting: %d" CLEANUP_EOL ,
 		cur_stats->waiting );
 
 	fprintf(f, "Total:\n");
@@ -33,10 +33,10 @@ int print_stats(  FILE *f )
 		acc_stats->transactions );
 	fprintf(f, " local: %d,",
 		acc_stats->client_transactions );
-	fprintf(f, " waiting: %d\n",
+	fprintf(f, " waiting: %d" CLEANUP_EOL ,
 		acc_stats->waiting );
 
-	fprintf(f, "Replied localy: %d\n",
+	fprintf(f, "Replied localy: %d" CLEANUP_EOL ,
 		acc_stats->replied_localy );
 	fprintf(f, "Completion status 6xx: %d,",
 		acc_stats->completed_6xx );
@@ -46,7 +46,7 @@ int print_stats(  FILE *f )
 		acc_stats->completed_4xx );
 	fprintf(f, " 3xx: %d,",
 		acc_stats->completed_3xx );
-	fprintf(f, "2xx: %d\n",
+	fprintf(f, "2xx: %d" CLEANUP_EOL ,
 		acc_stats->completed_2xx );
 	
 	return 1;

+ 1 - 1
scripts/sc

@@ -461,7 +461,7 @@ case $1 in
 			echo "error opening read fifo $path"
 			exit 1
 		fi
-		trap "rm $path; echo sc monitor ^C-ed; exit 1" 2
+		trap "rm $path; clear; echo sc monitor ^C-ed; exit 1" 2
 		attempt=0
 		clear
 		while [ 1 -eq 1 ]; do