profil fixes

Brian Ford ford@vss.fsi.com
Mon Apr 28 20:07:00 GMT 2003


2003-04-28  Brian Ford  <ford@vss.fsi.com>

        * profil.h (PROFADDR): Prevent overflow when text segments
	are larger than 256k.
	* profil.c (profthr_func): Raise thread priority for more accurate
	sampling.

-- 
Brian Ford
Senior Realtime Software Engineer
VITAL - Visual Simulation Systems
FlightSafety International
Phone: 314-551-8460
Fax:   314-551-8444
-------------- next part --------------
Index: profil.c
===================================================================
RCS file: /cvs/src/src/winsup/cygwin/profil.c,v
retrieving revision 1.5
diff -u -p -r1.5 profil.c
--- profil.c	11 Sep 2001 20:01:00 -0000	1.5
+++ profil.c	28 Apr 2003 19:55:55 -0000
@@ -62,6 +62,8 @@ profthr_func (LPVOID arg)
   struct profinfo *p = (struct profinfo *) arg;
   u_long pc, idx;
 
+  SetThreadPriority(p->profthr, THREAD_PRIORITY_TIME_CRITICAL);
+
   for (;;)
     {
       pc = (u_long) get_thrpc (p->targthr);
Index: profil.h
===================================================================
RCS file: /cvs/src/src/winsup/cygwin/profil.h,v
retrieving revision 1.3
diff -u -p -r1.3 profil.h
--- profil.h	11 Sep 2001 20:01:00 -0000	1.3
+++ profil.h	28 Apr 2003 19:55:56 -0000
@@ -24,7 +24,7 @@ details. */
 
 /* convert an index into an address */
 #define PROFADDR(idx, base, scale)	\
-	((base) + ((((idx) << 16) / (scale)) << 1))
+	((base) + ((((unsigned long long)(idx) << 16) / (scale)) << 1))
 
 /* convert a bin size into a scale */
 #define PROFSCALE(range, bins)		(((bins) << 16) / ((range) >> 1))


More information about the Cygwin-patches mailing list