grub/grub-core/osdep/unix/cputime.c
Robbie Harwood 2cd52835fc config: Where present, ensure config-util.h precedes config.h
gnulib defines go in config-util.h, and we need to know whether to
provide duplicates in config.h or not.

Signed-off-by: Robbie Harwood <rharwood@redhat.com>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
2022-03-21 18:47:16 +01:00

23 lines
394 B
C

#include <config-util.h>
#include <config.h>
#include <sys/times.h>
#include <unistd.h>
#include <grub/emu/misc.h>
grub_uint64_t
grub_util_get_cpu_time_ms (void)
{
struct tms tm;
static long sc_clk_tck;
if (!sc_clk_tck)
{
sc_clk_tck = sysconf(_SC_CLK_TCK);
if (sc_clk_tck <= 0)
sc_clk_tck = 1000;
}
times (&tm);
return (tm.tms_utime * 1000ULL) / sc_clk_tck;
}