This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [ping2][PATCH v2][BZ #12515] Improve precision of clock function
- From: Roland McGrath <roland at hack dot frob dot com>
- To: Siddhesh Poyarekar <siddhesh at redhat dot com>
- Cc: Paul Eggert <eggert at cs dot ucla dot edu>, libc-alpha at sourceware dot org
- Date: Tue, 11 Jun 2013 10:19:52 -0700 (PDT)
- Subject: Re: [ping2][PATCH v2][BZ #12515] Improve precision of clock function
- References: <20130521145611 dot GM8927 at spoyarek dot pnq dot redhat dot com> <20130521151839 dot GA18430 at domone dot kolej dot mff dot cuni dot cz> <20130521153442 dot GO8927 at spoyarek dot pnq dot redhat dot com> <519B9A09 dot 6030305 at cs dot ucla dot edu> <20130521161441 dot GQ8927 at spoyarek dot pnq dot redhat dot com> <20130603092604 dot GL2145 at spoyarek dot pnq dot redhat dot com> <20130610083821 dot GD1570 at spoyarek dot pnq dot redhat dot com> <51B66522 dot 1060008 at cs dot ucla dot edu> <20130611135422 dot GK8010 at spoyarek dot pnq dot redhat dot com>
> + if (__clock_gettime (CLOCK_PROCESS_CPUTIME_ID, &ts) == 0)
> + return (ts.tv_sec * CLOCKS_PER_SEC
> + + ts.tv_nsec / (1000000000 / CLOCKS_PER_SEC));
> +
> + /* clock_gettime failed. This will only occur if CLOCK_PROCESS_CPUTIME_ID is
> + not supported by the kernel. Fall back to __times. */
This is fine for now. But we already assume that CLOCK_PROCESS_CPUTIME_ID
is actually supported in the kernel. So the fallback code here should be
removed at some point.
Thanks,
Roland