[Gmp-commit] /home/hgfiles/gmp: Make use of cycle counter for measurements co...

mercurial at gmplib.org mercurial at gmplib.org
Mon Feb 15 12:18:52 CET 2010


details:   /home/hgfiles/gmp/rev/ba631dd1c9b4
changeset: 13429:ba631dd1c9b4
user:      Niels M?ller <nisse at lysator.liu.se>
date:      Mon Feb 15 11:47:21 2010 +0100
description:
Make use of cycle counter for measurements configurable.

diffstat:

 ChangeLog     |  5 +++++
 tune/common.c |  5 +++++
 tune/speed.h  |  1 +
 tune/time.c   |  4 ++--
 4 files changed, 13 insertions(+), 2 deletions(-)

diffs (68 lines):

diff -r c0b55fbec180 -r ba631dd1c9b4 ChangeLog
--- a/ChangeLog	Mon Feb 15 10:03:54 2010 +0100
+++ b/ChangeLog	Mon Feb 15 11:47:21 2010 +0100
@@ -1,5 +1,10 @@
 2010-02-15  Niels Möller  <nisse at lysator.liu.se>
 
+	* tune/time.c (speed_time_init): Make use of cycle counter
+	configurable, via the speed_option_cycles_broken flag.
+	* tune/common.c (speed_option_cycles_broken): New global variable.
+	(speed_option_set): Recognize option "cycles-broken".
+
 	* tune/time.c (cycles_works_p): Deleted hack to disable cycle
 	counter on linux. Needs to be replaced by something more
 	selective.
diff -r c0b55fbec180 -r ba631dd1c9b4 tune/common.c
--- a/tune/common.c	Mon Feb 15 10:03:54 2010 +0100
+++ b/tune/common.c	Mon Feb 15 11:47:21 2010 +0100
@@ -41,6 +41,7 @@
 
 int   speed_option_addrs = 0;
 int   speed_option_verbose = 0;
+int   speed_option_cycles_broken = 0;
 
 
 /* Provide __clz_tab even if it's not required, for the benefit of new code
@@ -366,6 +367,10 @@
     {
       speed_option_verbose = n;
     }
+  else if (strcmp (s, "cycles-broken") == 0)
+    {
+      speed_option_cycles_broken = 1;
+    }
   else
     {
       printf ("Unrecognised -o option: %s\n", s);
diff -r c0b55fbec180 -r ba631dd1c9b4 tune/speed.h
--- a/tune/speed.h	Mon Feb 15 10:03:54 2010 +0100
+++ b/tune/speed.h	Mon Feb 15 11:47:21 2010 +0100
@@ -415,6 +415,7 @@
 
 extern int  speed_option_addrs;
 extern int  speed_option_verbose;
+extern int  speed_option_cycles_broken;
 void speed_option_set __GMP_PROTO((const char *));
 
 mp_limb_t mpn_divrem_1_div __GMP_PROTO ((mp_ptr, mp_size_t, mp_srcptr, mp_size_t, mp_limb_t));
diff -r c0b55fbec180 -r ba631dd1c9b4 tune/time.c
--- a/tune/time.c	Mon Feb 15 10:03:54 2010 +0100
+++ b/tune/time.c	Mon Feb 15 11:47:21 2010 +0100
@@ -455,7 +455,7 @@
 
   if (result != -1)
     goto done;
-  
+
   /* FIXME: On linux, the cycle counter is not saved and restored over
    * context switches, making it almost useless for precise cputime
    * measurements. When available, it's better to use clock_gettime,
@@ -954,7 +954,7 @@
 
   speed_cycletime_init ();
 
-  if (have_cycles && cycles_works_p ())
+  if (!speed_option_cycles_broken && have_cycles && cycles_works_p ())
     {
       use_cycles = 1;
       DEFAULT (speed_cycletime, 1.0);


More information about the gmp-commit mailing list