Browse Source

Added times to start/stop log messages

tags/v0.9.3
Michael Brown 18 years ago
parent
commit
1a11cc5c5b
1 changed files with 12 additions and 8 deletions
  1. 12
    8
      src/net/retry.c

+ 12
- 8
src/net/retry.c View File

@@ -69,7 +69,8 @@ void start_timer ( struct retry_timer *timer ) {
69 69
 	timer->start = currticks();
70 70
 	if ( timer->timeout < MIN_TIMEOUT )
71 71
 		timer->timeout = MIN_TIMEOUT;
72
-	DBG2 ( "Timer %p started\n", timer );
72
+	DBG ( "Timer %p started at time %ld (expires at %ld)\n",
73
+	      timer, timer->start, ( timer->start + timer->timeout ) );
73 74
 }
74 75
 
75 76
 /**
@@ -81,16 +82,18 @@ void start_timer ( struct retry_timer *timer ) {
81 82
  */
82 83
 void stop_timer ( struct retry_timer *timer ) {
83 84
 	unsigned long old_timeout = timer->timeout;
85
+	unsigned long now = currticks();
84 86
 	unsigned long runtime;
85 87
 
86 88
 	/* If timer was already stopped, do nothing */
87 89
 	if ( ! timer->start )
88 90
 		return;
89 91
 
90
-	DBG2 ( "Timer %p stopped\n", timer );
91 92
 	list_del ( &timer->list );
92
-	runtime = currticks() - timer->start;
93
+	runtime = ( now - timer->start );
93 94
 	timer->start = 0;
95
+	DBG ( "Timer %p stopped at time %ld (ran for %ld)\n",
96
+	      timer, now, runtime );
94 97
 
95 98
 	/* Update timer.  Variables are:
96 99
 	 *
@@ -113,8 +116,8 @@ void stop_timer ( struct retry_timer *timer ) {
113 116
 		timer->timeout -= ( timer->timeout >> 3 );
114 117
 		timer->timeout += ( runtime >> 1 );
115 118
 		if ( timer->timeout != old_timeout ) {
116
-			DBG ( "Timer %p updated to %ldms\n", timer,
117
-			      ( ( 1000 * timer->timeout ) / TICKS_PER_SEC ) );
119
+			DBG ( "Timer %p timeout updated to %ld\n",
120
+			      timer, timer->timeout );
118 121
 		}
119 122
 	}
120 123
 }
@@ -128,7 +131,8 @@ static void timer_expired ( struct retry_timer *timer ) {
128 131
 	int fail;
129 132
 
130 133
 	/* Stop timer without performing RTT calculations */
131
-	DBG2 ( "Timer %p stopped on expiry\n", timer );
134
+	DBG ( "Timer %p stopped at time %ld on expiry\n",
135
+	      timer, currticks() );
132 136
 	list_del ( &timer->list );
133 137
 	timer->start = 0;
134 138
 	timer->count++;
@@ -137,8 +141,8 @@ static void timer_expired ( struct retry_timer *timer ) {
137 141
 	timer->timeout <<= 1;
138 142
 	if ( ( fail = ( timer->timeout > MAX_TIMEOUT ) ) )
139 143
 		timer->timeout = MAX_TIMEOUT;
140
-	DBG ( "Timer %p backed off to %ldms\n", timer,
141
-	      ( ( 1000 * timer->timeout ) / TICKS_PER_SEC ) );
144
+	DBG ( "Timer %p timeout backed off to %ld\n",
145
+	      timer, timer->timeout );
142 146
 
143 147
 	/* Call expiry callback */
144 148
 	timer->expired ( timer, fail );	

Loading…
Cancel
Save