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
 	timer->start = currticks();
69
 	timer->start = currticks();
70
 	if ( timer->timeout < MIN_TIMEOUT )
70
 	if ( timer->timeout < MIN_TIMEOUT )
71
 		timer->timeout = MIN_TIMEOUT;
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
  */
82
  */
82
 void stop_timer ( struct retry_timer *timer ) {
83
 void stop_timer ( struct retry_timer *timer ) {
83
 	unsigned long old_timeout = timer->timeout;
84
 	unsigned long old_timeout = timer->timeout;
85
+	unsigned long now = currticks();
84
 	unsigned long runtime;
86
 	unsigned long runtime;
85
 
87
 
86
 	/* If timer was already stopped, do nothing */
88
 	/* If timer was already stopped, do nothing */
87
 	if ( ! timer->start )
89
 	if ( ! timer->start )
88
 		return;
90
 		return;
89
 
91
 
90
-	DBG2 ( "Timer %p stopped\n", timer );
91
 	list_del ( &timer->list );
92
 	list_del ( &timer->list );
92
-	runtime = currticks() - timer->start;
93
+	runtime = ( now - timer->start );
93
 	timer->start = 0;
94
 	timer->start = 0;
95
+	DBG ( "Timer %p stopped at time %ld (ran for %ld)\n",
96
+	      timer, now, runtime );
94
 
97
 
95
 	/* Update timer.  Variables are:
98
 	/* Update timer.  Variables are:
96
 	 *
99
 	 *
113
 		timer->timeout -= ( timer->timeout >> 3 );
116
 		timer->timeout -= ( timer->timeout >> 3 );
114
 		timer->timeout += ( runtime >> 1 );
117
 		timer->timeout += ( runtime >> 1 );
115
 		if ( timer->timeout != old_timeout ) {
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
 	int fail;
131
 	int fail;
129
 
132
 
130
 	/* Stop timer without performing RTT calculations */
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
 	list_del ( &timer->list );
136
 	list_del ( &timer->list );
133
 	timer->start = 0;
137
 	timer->start = 0;
134
 	timer->count++;
138
 	timer->count++;
137
 	timer->timeout <<= 1;
141
 	timer->timeout <<= 1;
138
 	if ( ( fail = ( timer->timeout > MAX_TIMEOUT ) ) )
142
 	if ( ( fail = ( timer->timeout > MAX_TIMEOUT ) ) )
139
 		timer->timeout = MAX_TIMEOUT;
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
 	/* Call expiry callback */
147
 	/* Call expiry callback */
144
 	timer->expired ( timer, fail );	
148
 	timer->expired ( timer, fail );	

Loading…
Cancel
Save