[opensuse] CLOCK_THREAD_CPUTIME_ID or glibc broken?
Hi, consider the following program: #include <iostream> extern "C" { #include <time.h> } int main() { struct timespec start, stop; clock_gettime(CLOCK_THREAD_CPUTIME_ID, &start); sleep(7); clock_gettime(CLOCK_THREAD_CPUTIME_ID, &stop); std::cout << "Runtime: " << ((stop.tv_sec - start.tv_sec) + 1e-9*(stop.tv_nsec - start.tv_nsec)) << "\n"; } On Opensuse 12.1 this prints about 14 seconds. On Ubuntu or RHEL I get something around 1e-5 as expected. Is this a bug in the glibc shipped with Opensuse 12.1? Christoph -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
El 26/02/12 17:56, Christoph Bartoschek escribió:
Hi,
consider the following program:
#include <iostream>
extern "C" { #include <time.h> }
int main() { struct timespec start, stop; clock_gettime(CLOCK_THREAD_CPUTIME_ID, &start); sleep(7); clock_gettime(CLOCK_THREAD_CPUTIME_ID, &stop); std::cout << "Runtime: " << ((stop.tv_sec - start.tv_sec) + 1e-9*(stop.tv_nsec - start.tv_nsec)) << "\n"; }
On Opensuse 12.1 this prints about 14 seconds. On Ubuntu or RHEL I get something around 1e-5 as expected.
Is this a bug in the glibc shipped with Opensuse 12.1?
Christoph
I get Runtime: 1.597e-05 in factory and Runtime: 7.00041 in 12.1 Both with kernel 3.3-rcN Aj: looks like there is something wrong in 12.1 glibc. -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
Runtime: 3.7169e-05 compiled with: c++ <file.cpp> -lrt kernel: 3.1.9-1.4-desktop standard 12.1 with updates -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
On Sunday 26 February 2012 18:23:33 Cristian Rodríguez wrote:
Runtime: 1.597e-05 in factory
and Runtime: 7.00041 in 12.1
Both with kernel 3.3-rcN
Aj: looks like there is something wrong in 12.1 glibc.
Wasn't that clock always broken in glibc? It just returns (tsc-now/tsc- start)/cpu-frequency I seem to recall a wild discussion a few years ago, between SGI devels who wrote a patch to implement those clocks, and Ulrich Drepper who refused to accept it Anders -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
On Sunday, February 26, 2012 21:56:04 Christoph Bartoschek wrote:
Hi,
consider the following program:
#include <iostream>
extern "C" { #include <time.h> }
int main() { struct timespec start, stop; clock_gettime(CLOCK_THREAD_CPUTIME_ID, &start); sleep(7); clock_gettime(CLOCK_THREAD_CPUTIME_ID, &stop); std::cout << "Runtime: " << ((stop.tv_sec - start.tv_sec) + 1e-9*(stop.tv_nsec - start.tv_nsec)) << "\n"; }
On Opensuse 12.1 this prints about 14 seconds. On Ubuntu or RHEL I get something around 1e-5 as expected.
Is this a bug in the glibc shipped with Opensuse 12.1?
Seems to be. Could you file a bugreport using http://bugzilla.novell.com and assign the bug to me (aj@suse.com)? I'll look into it and will release a new glibc for 12.1 - but first need the bugreport ;) Andreas -- Andreas Jaeger aj@{suse.com,opensuse.org} Twitter/Identica: jaegerandi SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany GF: Jeff Hawn,Jennifer Guild,Felix Imendörffer,HRB16746 (AG Nürnberg) GPG fingerprint = 93A3 365E CE47 B889 DF7F FED1 389A 563C C272 A126 -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
On Monday, February 27, 2012 09:30:37 Andreas Jaeger wrote:
On Sunday, February 26, 2012 21:56:04 Christoph Bartoschek wrote:
Hi,
consider the following program:
#include <iostream>
extern "C" { #include <time.h> }
int main() {
struct timespec start, stop; clock_gettime(CLOCK_THREAD_CPUTIME_ID, &start); sleep(7); clock_gettime(CLOCK_THREAD_CPUTIME_ID, &stop); std::cout << "Runtime: " << ((stop.tv_sec - start.tv_sec) +
1e-9*(stop.tv_nsec - start.tv_nsec)) << "\n"; }
On Opensuse 12.1 this prints about 14 seconds. On Ubuntu or RHEL I get something around 1e-5 as expected.
Is this a bug in the glibc shipped with Opensuse 12.1?
Seems to be. Could you file a bugreport using http://bugzilla.novell.com and assign the bug to me (aj@suse.com)? I'll look into it and will release a new glibc for 12.1 - but first need the bugreport ;)
Andreas
I filed a bug myself now: https://bugzilla.novell.com/show_bug.cgi?id=749126 Test package will soon be available at: http://download.opensuse.org/repositories/home:/a_jaeger:/branches:/openSUSE... Andreas -- Andreas Jaeger aj@{suse.com,opensuse.org} Twitter/Identica: jaegerandi SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany GF: Jeff Hawn,Jennifer Guild,Felix Imendörffer,HRB16746 (AG Nürnberg) GPG fingerprint = 93A3 365E CE47 B889 DF7F FED1 389A 563C C272 A126 -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
Am 27.02.2012 16:31, schrieb Andreas Jaeger:
I filed a bug myself now: https://bugzilla.novell.com/show_bug.cgi?id=749126
Test package will soon be available at: http://download.opensuse.org/repositories/home:/a_jaeger:/branches:/openSUSE...
Thanks Is the patch somewhere available? I would like to know what was wrong. Christoph -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
El 27/02/12 14:22, Christoph Bartoschek escribió:
Am 27.02.2012 16:31, schrieb Andreas Jaeger:
I filed a bug myself now: https://bugzilla.novell.com/show_bug.cgi?id=749126
Test package will soon be available at: http://download.opensuse.org/repositories/home:/a_jaeger:/branches:/openSUSE...
Thanks
Is the patch somewhere available? I would like to know what was wrong.
https://build.opensuse.org/package/view_file?file=glibc-2.15-clock_gettime.patch&package=glibc&project=home%3Aa_jaeger%3Abranches%3AopenSUSE%3A12.1%3AUpdate%3ATest&rev=e864060a763625093707e57bf70c9f15 that's it. -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
On Monday 27 February 2012 18:22:57 Christoph Bartoschek wrote:
Am 27.02.2012 16:31, schrieb Andreas Jaeger:
I filed a bug myself now: https://bugzilla.novell.com/show_bug.cgi?id=749126
Test package will soon be available at: http://download.opensuse.org/repositories/home:/a_jaeger:/branches:/openSU SE:/12.1:/Update:/Test/standard Thanks
Is the patch somewhere available? I would like to know what was wrong.
It wasn't a regression. As I said in my previous email, this was something that never worked, and the upstream glibc maintainer refused for several years to accept patches to fix it. It wasn't fixed upstream until some time last year Anders -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
participants (5)
-
Anders Johansson
-
Andreas Jaeger
-
Christoph Bartoschek
-
Cristian Rodríguez
-
madworm_de.opensuse@spitzenpfeil.org