Shows how long an initd task took, for example: procd: stop /etc/init.d/dropbear running - took 0.088824 us procd: Update service dnsmasq procd: Update instance dnsmasq::dnsmasq procd: running /etc/init.d/dnsmasq running procd: start /etc/init.d/dnsmasq running procd: stop /etc/init.d/dnsmasq running - took 0.092586 us
Signed-off-by: Karl Vogel <karl.vo...@gmail.com> --- rcS.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/rcS.c b/rcS.c index dd3b76d..59c9038 100644 --- a/rcS.c +++ b/rcS.c @@ -37,6 +37,7 @@ static struct runqueue q, r; struct initd { struct ustream_fd fd; struct runqueue_process proc; + struct timeval tstart; char *file; char *param; }; @@ -70,6 +71,7 @@ static void q_initd_run(struct runqueue *q, struct runqueue_task *t) int pipefd[2]; pid_t pid; + gettimeofday(&s->tstart, NULL); DEBUG(2, "start %s %s \n", s->file, s->param); if (pipe(pipefd) == -1) { ERROR("Failed to create pipe: %m\n"); @@ -106,8 +108,11 @@ static void q_initd_run(struct runqueue *q, struct runqueue_task *t) static void q_initd_complete(struct runqueue *q, struct runqueue_task *p) { struct initd *s = container_of(p, struct initd, proc.task); + struct timeval tstop, tres; - DEBUG(2, "stop %s %s \n", s->file, s->param); + gettimeofday(&tstop, NULL); + timersub(&tstop, &s->tstart, &tres); + DEBUG(2, "stop %s %s - took %lu.%06lu us\n", s->file, s->param, tres.tv_sec, tres.tv_usec); ustream_free(&s->fd.stream); close(s->fd.fd.fd); free(s); -- 2.15.1 _______________________________________________ Lede-dev mailing list Lede-dev@lists.infradead.org http://lists.infradead.org/mailman/listinfo/lede-dev