File tree 2 files changed +23
-10
lines changed
2 files changed +23
-10
lines changed Original file line number Diff line number Diff line change @@ -25,6 +25,7 @@ void tmr_poll(struct list *tmrl);
25
25
uint64_t tmr_jiffies (void );
26
26
uint64_t tmr_next_timeout (struct list * tmrl );
27
27
void tmr_debug (void );
28
+ int tmr_status (struct re_printf * pf , void * unused );
28
29
29
30
void tmr_init (struct tmr * tmr );
30
31
void tmr_start (struct tmr * tmr , uint64_t delay , tmr_h * th , void * arg );
Original file line number Diff line number Diff line change @@ -172,31 +172,43 @@ uint64_t tmr_next_timeout(struct list *tmrl)
172
172
}
173
173
174
174
175
- /**
176
- * Print timer debug info to stderr
177
- */
178
- void tmr_debug (void )
175
+ int tmr_status (struct re_printf * pf , void * unused )
179
176
{
180
177
struct list * tmrl = tmrl_get ();
181
178
struct le * le ;
182
179
uint32_t n ;
180
+ int err ;
181
+
182
+ (void )unused ;
183
183
184
184
n = list_count (tmrl );
185
185
if (!n )
186
- return ;
186
+ return 0 ;
187
187
188
- ( void ) re_fprintf ( stderr , "Timers (%u):\n" , n );
188
+ err = re_hprintf ( pf , "Timers (%u):\n" , n );
189
189
190
190
for (le = tmrl -> head ; le ; le = le -> next ) {
191
191
const struct tmr * tmr = le -> data ;
192
192
193
- ( void ) re_fprintf ( stderr , " %p: th=%p expire=%llums\n" ,
194
- tmr , tmr -> th ,
195
- (unsigned long long )tmr_get_expire (tmr ));
193
+ err |= re_hprintf ( pf , " %p: th=%p expire=%llums\n" ,
194
+ tmr , tmr -> th ,
195
+ (unsigned long long )tmr_get_expire (tmr ));
196
196
}
197
197
198
198
if (n > 100 )
199
- (void )re_fprintf (stderr , " (Dumped Timers: %u)\n" , n );
199
+ err |= re_hprintf (pf , " (Dumped Timers: %u)\n" , n );
200
+
201
+ return err ;
202
+ }
203
+
204
+
205
+ /**
206
+ * Print timer debug info to stderr
207
+ */
208
+ void tmr_debug (void )
209
+ {
210
+ if (!list_isempty (tmrl_get ()))
211
+ (void )re_fprintf (stderr , "%H" , tmr_status , NULL );
200
212
}
201
213
202
214
You can’t perform that action at this time.
0 commit comments