[Commit] nickle ChangeLog, 1.40, 1.41 pretty.c, 1.66, 1.67 profile.c, 1.10, 1.11

Keith Packard commit at keithp.com
Sun Apr 18 20:13:42 PDT 2004


Committed by: keithp

Update of /local/src/CVS/nickle
In directory home.keithp.com:/tmp/cvs-serv9278

Modified Files:
	ChangeLog pretty.c profile.c 
Log Message:
2004-04-18  Keith Packard  <keithp at keithp.com>

	* pretty.c: (doPrettyPrint):
	Label profile times in ms
	* profile.c: (sigprofile), (ProfileInterrupt), (do_profile):
	profile tracking code was quite busted, generating largely
	random numbers.


Index: ChangeLog
===================================================================
RCS file: /local/src/CVS/nickle/ChangeLog,v
retrieving revision 1.40
retrieving revision 1.41
diff -u -d -r1.40 -r1.41
--- a/ChangeLog	16 Apr 2004 21:41:52 -0000	1.40
+++ b/ChangeLog	19 Apr 2004 03:13:39 -0000	1.41
@@ -1,3 +1,11 @@
+2004-04-18  Keith Packard  <keithp at keithp.com>
+
+	* pretty.c: (doPrettyPrint):
+	Label profile times in ms
+	* profile.c: (sigprofile), (ProfileInterrupt), (do_profile):
+	profile tracking code was quite busted, generating largely
+	random numbers.
+
 2004-04-16  Keith Packard  <keithp at keithp.com>
 
 	* builtin-command.c: (command_name), (do_Command_new_common),

Index: pretty.c
===================================================================
RCS file: /local/src/CVS/nickle/pretty.c,v
retrieving revision 1.66
retrieving revision 1.67
diff -u -d -r1.66 -r1.67
--- a/pretty.c	11 Apr 2004 06:06:52 -0000	1.66
+++ b/pretty.c	19 Apr 2004 03:13:39 -0000	1.67
@@ -894,7 +894,7 @@
     if (!symbol)
 	return;
     if (profiling)
-	FilePuts (f, "    called       self\n");
+	FilePuts (f, "    called(ms)   self(ms)\n");
     PrettyIndent (f, 0, level, 0);
     switch (symbol->symbol.class) {
     case class_const:

Index: profile.c
===================================================================
RCS file: /local/src/CVS/nickle/profile.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- a/profile.c	27 Feb 2004 03:50:16 -0000	1.10
+++ b/profile.c	19 Apr 2004 03:13:39 -0000	1.11
@@ -10,6 +10,8 @@
 #include	<sys/time.h>
 #include	<assert.h>
 
+#define TICK_MS	10
+
 volatile static unsigned long	currentTick;
 volatile Bool			signalProfile;
 static unsigned long		previousTick;
@@ -19,19 +21,22 @@
 sigprofile (int sig)
 {
     resetSignal (SIGVTALRM, sigprofile);
-    currentTick++;
+    currentTick += TICK_MS;
     SetSignalProfile ();
 }
 
 void
 ProfileInterrupt (Value thread)
 {
-    unsigned long   ticks = currentTick - previousTick;
+    unsigned long   now;
+    unsigned long   ticks;
     InstPtr	    pc;
     ExprPtr	    stat;
     FramePtr	    frame;
     
-    previousTick = 0;
+    now = currentTick;
+    ticks = now - previousTick;
+    previousTick = now;
     if (!thread)
 	return;
     pc = thread->thread.continuation.pc;
@@ -60,10 +65,10 @@
 	
     if (True (on))
     {
-	currentTick = previousTick = 0;
+	previousTick = currentTick;
 	catchSignal (SIGVTALRM, sigprofile);
 	v.it_interval.tv_sec = 0;
-	v.it_interval.tv_usec = 10000;
+	v.it_interval.tv_usec = TICK_MS * 1000;
 	v.it_value = v.it_interval;
 	setitimer (ITIMER_VIRTUAL, &v, 0);
 	profiling = True;




More information about the Commit mailing list