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] Add probe markers for sin, cos, asin and acos


Hi,

This patch adds systemtap probe markers for slow multiple precision
paths in sin, cos, asin and acos.  Tested on x86_64.  OK to commit?

Siddhesh

	* manual/probes.texi (Mathematical Function Probes): Add
	documentation for sin, cos, asin and acos probes.
	* sysdeps/ieee754/dbl-64/sincos32.c: Include stap-probe.h.
	(__sin32): Add slowasin probe.
	(__cos32): Add slowacos probe.
	(__mpsin): Add slowsin probe.
	(__mpcos): Add slowcos probe.

diff --git a/manual/probes.texi b/manual/probes.texi
index 5492bb7..108f460 100644
--- a/manual/probes.texi
+++ b/manual/probes.texi
@@ -353,3 +353,45 @@ results in multiple precision computation with precision 32.  Argument
 @var{$arg1} is the input to the function and @var{$arg2} is the computed
 result.
 @end deftp
+
+@deftp Probe slowasin (double @var{$arg1}, double @var{$arg2})
+This probe is hit when the @code{asin} function is called with an input that
+results in multiple precision computation with precision 32.  Argument
+@var{$arg1} is the input to the function and @var{$arg2} is the computed
+result.
+@end deftp
+
+@deftp Probe slowacos (double @var{$arg1}, double @var{$arg2})
+This probe is hit when the @code{acos} function is called with an input that
+results in multiple precision computation with precision 32.  Argument
+@var{$arg1} is the input to the function and @var{$arg2} is the computed
+result.
+@end deftp
+
+@deftp Probe slowsin (double @var{$arg1}, double @var{$arg2})
+This probe is hit when the @code{sin} function is called with an input that
+results in multiple precision computation with precision 32.  Argument
+@var{$arg1} is the input to the function and @var{$arg2} is the computed
+result.
+@end deftp
+
+@deftp Probe slowcos (double @var{$arg1}, double @var{$arg2})
+This probe is hit when the @code{cos} function is called with an input that
+results in multiple precision computation with precision 32.  Argument
+@var{$arg1} is the input to the function and @var{$arg2} is the computed
+result.
+@end deftp
+
+@deftp Probe slowsin_dx (double @var{$arg1}, double @var{$arg2}, double @var{$arg3})
+This probe is hit when the @code{sin} function is called with an input that
+results in multiple precision computation with precision 32.  Argument
+@var{$arg1} is the input to the function, @var{$arg2} is the error bound of
+@var{$arg1} and @var{$arg3} is the computed result.
+@end deftp
+
+@deftp Probe slowcos_dx (double @var{$arg1}, double @var{$arg2}, double @var{$arg3})
+This probe is hit when the @code{cos} function is called with an input that
+results in multiple precision computation with precision 32.  Argument
+@var{$arg1} is the input to the function, @var{$arg2} is the error bound of
+@var{$arg1} and @var{$arg3} is the computed result.
+@end deftp
diff --git a/sysdeps/ieee754/dbl-64/sincos32.c b/sysdeps/ieee754/dbl-64/sincos32.c
index f253b8c..b6e93a4 100644
--- a/sysdeps/ieee754/dbl-64/sincos32.c
+++ b/sysdeps/ieee754/dbl-64/sincos32.c
@@ -43,6 +43,7 @@
 #include "mpa.h"
 #include "sincos32.h"
 #include <math_private.h>
+#include <stap-probe.h>
 
 #ifndef SECTION
 # define SECTION
@@ -147,10 +148,10 @@ __sin32 (double x, double res, double res1)
   __dbl_mp (x, &c, p);		/* c = x  */
   __sub (&b, &c, &a, p);
   /* if a > 0 return min (res, res1), otherwise return max (res, res1).  */
-  if (a.d[0] > 0)
-    return (res < res1) ? res : res1;
-  else
-    return (res > res1) ? res : res1;
+  if ((a.d[0] > 0 && res > res1) || (a.d[0] <= 0 && res < res1))
+    res = res1;
+  LIBC_PROBE (slowasin, 2, &res, &x);
+  return res;
 }
 
 /* Receive double x and two double results of cos(x) and return result which is
@@ -181,10 +182,10 @@ __cos32 (double x, double res, double res1)
   __dbl_mp (x, &c, p);		/* c = x                  */
   __sub (&b, &c, &a, p);
   /* if a > 0 return max (res, res1), otherwise return min (res, res1).  */
-  if (a.d[0] > 0)
-    return (res > res1) ? res : res1;
-  else
-    return (res < res1) ? res : res1;
+  if ((a.d[0] > 0 && res < res1) || (a.d[0] <= 0 && res > res1))
+    res = res1;
+  LIBC_PROBE (slowacos, 2, &res, &x);
+  return res;
 }
 
 /* Compute sin() of double-length number (X + DX) as Multi Precision number and
@@ -242,6 +243,7 @@ __mpsin (double x, double dx, bool reduce_range)
     default:
       __mp_dbl (&s, &y, p);
     }
+  LIBC_PROBE (slowsin, 3, &x, &dx, &y);
   return y;
 }
 
@@ -300,6 +302,7 @@ __mpcos (double x, double dx, bool reduce_range)
     default:
       __mp_dbl (&c, &y, p);
     }
+  LIBC_PROBE (slowcos, 3, &x, &dx, &y);
   return y;
 }
 


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