diff options
Diffstat (limited to 'sysdeps/unix/sysv/linux/i386/get_clockfreq.c')
-rw-r--r-- | sysdeps/unix/sysv/linux/i386/get_clockfreq.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/sysdeps/unix/sysv/linux/i386/get_clockfreq.c b/sysdeps/unix/sysv/linux/i386/get_clockfreq.c index 28f56c8fc3..65b7bb2116 100644 --- a/sysdeps/unix/sysv/linux/i386/get_clockfreq.c +++ b/sysdeps/unix/sysv/linux/i386/get_clockfreq.c @@ -29,9 +29,13 @@ __get_clockfreq (void) least one line like cpu MHz : 497.840237 We search for this line and convert the number in an integer. */ - unsigned long long int result = 0ull; + static unsigned long long int result; int fd; + /* If this function was called before, we know the result. */ + if (result != 0) + return result; + fd = open ("/proc/cpuinfo", O_RDONLY); if (__builtin_expect (fd != -1, 1)) { |