This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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)


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]