add tmr_status()
This commit is contained in:
parent
097b9eb53a
commit
ce0dbba58e
2 changed files with 33 additions and 20 deletions
|
@ -25,6 +25,7 @@ void tmr_poll(struct list *tmrl);
|
||||||
uint64_t tmr_jiffies(void);
|
uint64_t tmr_jiffies(void);
|
||||||
uint64_t tmr_next_timeout(struct list *tmrl);
|
uint64_t tmr_next_timeout(struct list *tmrl);
|
||||||
void tmr_debug(void);
|
void tmr_debug(void);
|
||||||
|
int tmr_status(struct re_printf *pf, void *unused);
|
||||||
|
|
||||||
void tmr_init(struct tmr *tmr);
|
void tmr_init(struct tmr *tmr);
|
||||||
void tmr_start(struct tmr *tmr, uint64_t delay, tmr_h *th, void *arg);
|
void tmr_start(struct tmr *tmr, uint64_t delay, tmr_h *th, void *arg);
|
||||||
|
|
|
@ -172,31 +172,43 @@ uint64_t tmr_next_timeout(struct list *tmrl)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int tmr_status(struct re_printf *pf, void *unused)
|
||||||
|
{
|
||||||
|
struct list *tmrl = tmrl_get();
|
||||||
|
struct le *le;
|
||||||
|
uint32_t n;
|
||||||
|
int err;
|
||||||
|
|
||||||
|
(void)unused;
|
||||||
|
|
||||||
|
n = list_count(tmrl);
|
||||||
|
if (!n)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
err = re_hprintf(pf, "Timers (%u):\n", n);
|
||||||
|
|
||||||
|
for (le = tmrl->head; le; le = le->next) {
|
||||||
|
const struct tmr *tmr = le->data;
|
||||||
|
|
||||||
|
err |= re_hprintf(pf, " %p: th=%p expire=%llums\n",
|
||||||
|
tmr, tmr->th,
|
||||||
|
(unsigned long long)tmr_get_expire(tmr));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (n > 100)
|
||||||
|
err |= re_hprintf(pf, " (Dumped Timers: %u)\n", n);
|
||||||
|
|
||||||
|
return err;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Print timer debug info to stderr
|
* Print timer debug info to stderr
|
||||||
*/
|
*/
|
||||||
void tmr_debug(void)
|
void tmr_debug(void)
|
||||||
{
|
{
|
||||||
struct list *tmrl = tmrl_get();
|
if (!list_isempty(tmrl_get()))
|
||||||
struct le *le;
|
(void)re_fprintf(stderr, "%H", tmr_status, NULL);
|
||||||
uint32_t n;
|
|
||||||
|
|
||||||
n = list_count(tmrl);
|
|
||||||
if (!n)
|
|
||||||
return;
|
|
||||||
|
|
||||||
(void)re_fprintf(stderr, "Timers (%u):\n", n);
|
|
||||||
|
|
||||||
for (le = tmrl->head; le; le = le->next) {
|
|
||||||
const struct tmr *tmr = le->data;
|
|
||||||
|
|
||||||
(void)re_fprintf(stderr, " %p: th=%p expire=%llums\n",
|
|
||||||
tmr, tmr->th,
|
|
||||||
(unsigned long long)tmr_get_expire(tmr));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (n > 100)
|
|
||||||
(void)re_fprintf(stderr, " (Dumped Timers: %u)\n", n);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue