This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
PATCH: PR libc/2268: Wrong frequency setting for ITIMER_PROF
- From: "H. J. Lu" <hjl at lucon dot org>
- To: GNU C Library <libc-alpha at sources dot redhat dot com>
- Cc: roland at redhat dot com
- Date: Fri, 3 Feb 2006 14:54:20 -0800
- Subject: PATCH: PR libc/2268: Wrong frequency setting for ITIMER_PROF
Hi Roland,
There are some minor issues with your change. We want SIGPROF
delivered as soon as possible. So we should keep
timer.it_value.tv_usec = 1;
Also we may want to guard against __profile_frequency.
H.J.
----
2006-02-03 H.J. Lu <hongjiu.lu@intel.com>
PR libc/2268
* sysdeps/posix/profil.c (__profil): Check __profile_frequency.
--- sysdeps/posix/profil.c.freq 2006-02-03 14:40:29.000000000 -0800
+++ sysdeps/posix/profil.c 2006-02-03 14:45:09.000000000 -0800
@@ -112,8 +112,13 @@ __profil (u_short *sample_buffer, size_t
return -1;
timer.it_value.tv_sec = 0;
- timer.it_value.tv_usec = 1000000 / __profile_frequency ();
- timer.it_interval = timer.it_value;
+ timer.it_value.tv_usec = 1;
+ timer.it_interval.tv_sec = 0;
+ int profile_frequency = __profile_frequency ();
+ if (profile_frequency > 1000000)
+ timer.it_interval.tv_usec = 1;
+ else
+ timer.it_interval.tv_usec = 1000000 / profile_frequency;
return __setitimer (ITIMER_PROF, &timer, otimer_ptr);
}
weak_alias (__profil, profil)