PATCH: PR libc/2268: Wrong frequency setting for ITIMER_PROF
H. J. Lu
hjl@lucon.org
Fri Feb 3 22:54:00 GMT 2006
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)
More information about the Libc-alpha
mailing list