]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Callgrind: Throttle calls CLG_(run_thread) after r6413
authorJosef Weidendorfer <Josef.Weidendorfer@gmx.de>
Sat, 23 Dec 2006 23:11:20 +0000 (23:11 +0000)
committerJosef Weidendorfer <Josef.Weidendorfer@gmx.de>
Sat, 23 Dec 2006 23:11:20 +0000 (23:11 +0000)
After the change in r6413, CLG_(run_thread) is called a
lot more often, increasing the polling overhead to check
for a callgrind command file (created by callgrind_control
for controlling a callgrind run in an interactive way).
This reduces the calls to only be done every 5000 BBs,
which gives a similar polling frequency as before.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@6414

callgrind/main.c

index b54b72cc4f0341b6d5b7655c4f008f815cbf8e3b..b18147e03696ab335499043f6d9d799efe5e7fcc 100644 (file)
@@ -1026,13 +1026,19 @@ static void clg_thread_runstate_callback ( ThreadId tid,
                                            Bool is_running, 
                                            ULong blocks_done )
 {
+   static ULong last_blocks_done = 0;
+
    if (0)
       VG_(printf)("%d %c %llu\n", 
                   (Int)tid, is_running ? 'R' : 's', blocks_done);
-   /* Simply call onwards to CLG_(run_thread).  Maybe this can be
-      simplified later? */
-   if (is_running)
-      CLG_(run_thread)( tid );
+
+   if (!is_running) return;
+
+   /* throttle calls to CLG_(run_thread) by number of BBs executed */
+   if (blocks_done - last_blocks_done < 5000) return;
+   last_blocks_done = blocks_done;
+
+   CLG_(run_thread)( tid );
 }
 
 static