[svn-commits] seanbright: tools/trunk r5042 - /tools/trunk/dahdi_test.c

SVN commits to the Digium repositories svn-commits at lists.digium.com
Fri Oct 3 14:03:39 CDT 2008


Author: seanbright
Date: Fri Oct  3 14:03:38 2008
New Revision: 5042

URL: http://svn.digium.com/view/dahdi?view=rev&rev=5042
Log:
Whitespace and formatting only.

Modified:
    tools/trunk/dahdi_test.c

Modified: tools/trunk/dahdi_test.c
URL: http://svn.digium.com/view/dahdi/tools/trunk/dahdi_test.c?view=diff&rev=5042&r1=5041&r2=5042
==============================================================================
--- tools/trunk/dahdi_test.c (original)
+++ tools/trunk/dahdi_test.c Fri Oct  3 14:03:38 2008
@@ -54,7 +54,7 @@
 		"  -c COUNT    Run just COUNT cycles (otherwise: forever).\n"
 		"  -v          More verbose output.\n"
 		"  -h          This help text.\n"
-	,c);
+	, c);
 }
 
 int main(int argc, char *argv[])
@@ -62,10 +62,10 @@
 	int fd;
 	int res;
 	int c;
-	int count=0;
+	int count = 0;
 	int seconds = 0;
 	int curarg = 1;
-	int verbose=0;
+	int verbose = 0;
 	char buf[8192];
 	float score;
 	float ms;
@@ -76,7 +76,7 @@
 		exit(1);
 	}
 	
-	while((c = getopt(argc, argv, "c:hv")) != -1) {
+	while ((c = getopt(argc, argv, "c:hv")) != -1) {
 		switch(c) {
 		case 'c':
 			seconds = atoi(optarg);
@@ -94,7 +94,7 @@
 			break;
 		}
 	}
-	while(curarg < argc) {
+	while (curarg < argc) {
 		if (!strcasecmp(argv[curarg], "-v"))
 			verbose++;
 		if (!strcasecmp(argv[curarg], "-c") && argc > curarg)
@@ -106,13 +106,13 @@
 	signal(SIGINT, hup_handler);
 	signal(SIGALRM, hup_handler);
 	/* Flush input buffer */
-	for (count = 0;count < 4; count++)
+	for (count = 0; count < 4; count++)
 		res = read(fd, buf, sizeof(buf));
 	count = 0;
 	ms = 0; /* Makes the compiler happy */
 	if (seconds > 0)
 		alarm(seconds + 1); /* This will give 'seconds' cycles */
-	for(;;) {
+	for (;;) {
 		if (count == 0)
 			ms = 0;
 		gettimeofday(&start, NULL);
@@ -126,14 +126,13 @@
 		ms += (now.tv_sec - start.tv_sec) * 8000;
 		ms += (now.tv_usec - start.tv_usec) / 125.0;
 		if (count >= SIZE) {
-			double percent;
-
-			percent = 100.0 * (count - ms) / count;
-			if (verbose)
+			double percent = 100.0 * (count - ms) / count;
+			if (verbose) {
 				printf("\n%d samples in %0.3f system clock sample intervals (%.3f%%)", 
 						count, ms, 100 - percent);
-			else if (pass > 0 && (pass % 8) == 0)
+			} else if (pass > 0 && (pass % 8) == 0) {
 				printf("\n");
+			}
 			score = 100.0 - fabs(percent);
 			if (score > best)
 				best = score;




More information about the svn-commits mailing list