summary refs log tree commit diff
path: root/sysdeps
diff options
context:
space:
mode:
authorSiddhesh Poyarekar <siddhesh@redhat.com>2013-10-11 22:37:53 +0530
committerSiddhesh Poyarekar <siddhesh@redhat.com>2013-10-11 22:37:53 +0530
commit10e1cf6b73f1598e57d24933a0949dbeffa2c8a0 (patch)
tree2dd2ce2fe7144de439047f6dddbeb2f660746d94 /sysdeps
parent3d110c7c6e6549bd4124fce49cdc672f9e449799 (diff)
downloadglibc-10e1cf6b73f1598e57d24933a0949dbeffa2c8a0.tar.gz
glibc-10e1cf6b73f1598e57d24933a0949dbeffa2c8a0.tar.xz
glibc-10e1cf6b73f1598e57d24933a0949dbeffa2c8a0.zip
Add systemtap markers to math function slow paths
Add systemtap probes to various slow paths in libm so that application
developers may use systemtap to find out if their applications are
hitting these slow paths.  We have added probes for pow, exp, log,
tan, atan and atan2.
Diffstat (limited to 'sysdeps')
-rw-r--r--sysdeps/ieee754/dbl-64/e_atan2.c7
-rw-r--r--sysdeps/ieee754/dbl-64/e_log.c7
-rw-r--r--sysdeps/ieee754/dbl-64/s_atan.c7
-rw-r--r--sysdeps/ieee754/dbl-64/s_tan.c2
-rw-r--r--sysdeps/ieee754/dbl-64/slowexp.c13
-rw-r--r--sysdeps/ieee754/dbl-64/slowpow.c14
6 files changed, 45 insertions, 5 deletions
diff --git a/sysdeps/ieee754/dbl-64/e_atan2.c b/sysdeps/ieee754/dbl-64/e_atan2.c
index 4ebe9c01f9..40756223ce 100644
--- a/sysdeps/ieee754/dbl-64/e_atan2.c
+++ b/sysdeps/ieee754/dbl-64/e_atan2.c
@@ -42,6 +42,7 @@
 #include "uatan.tbl"
 #include "atnat2.h"
 #include <math_private.h>
+#include <stap-probe.h>
 
 #ifndef SECTION
 # define SECTION
@@ -597,7 +598,11 @@ atan2Mp (double x, double y, const int pr[])
       __mp_dbl (&mpz1, &z1, p);
       __mp_dbl (&mpz2, &z2, p);
       if (z1 == z2)
-	return z1;
+	{
+	  LIBC_PROBE (slowatan2, 4, &p, &x, &y, &z1);
+	  return z1;
+	}
     }
+  LIBC_PROBE (slowatan2_inexact, 4, &p, &x, &y, &z1);
   return z1;			/*if impossible to do exact computing */
 }
diff --git a/sysdeps/ieee754/dbl-64/e_log.c b/sysdeps/ieee754/dbl-64/e_log.c
index f9300f9cef..17ab75aa39 100644
--- a/sysdeps/ieee754/dbl-64/e_log.c
+++ b/sysdeps/ieee754/dbl-64/e_log.c
@@ -39,6 +39,7 @@
 #include "mpa.h"
 #include "MathLib.h"
 #include <math_private.h>
+#include <stap-probe.h>
 
 #ifndef SECTION
 # define SECTION
@@ -242,8 +243,12 @@ stage_n:
       __mp_dbl (&mpy1, &y1, p);
       __mp_dbl (&mpy2, &y2, p);
       if (y1 == y2)
-	return y1;
+	{
+	  LIBC_PROBE (slowlog, 3, &p, &x, &y1);
+	  return y1;
+	}
     }
+  LIBC_PROBE (slowlog_inexact, 3, &p, &x, &y1);
   return y1;
 }
 
diff --git a/sysdeps/ieee754/dbl-64/s_atan.c b/sysdeps/ieee754/dbl-64/s_atan.c
index 7b6c83ffb6..35ab5c1926 100644
--- a/sysdeps/ieee754/dbl-64/s_atan.c
+++ b/sysdeps/ieee754/dbl-64/s_atan.c
@@ -42,6 +42,7 @@
 #include "uatan.tbl"
 #include "atnat.h"
 #include <math.h>
+#include <stap-probe.h>
 
 void __mpatan (mp_no *, mp_no *, int);	/* see definition in mpatan.c */
 static double atanMp (double, const int[]);
@@ -306,8 +307,12 @@ atanMp (double x, const int pr[])
       __mp_dbl (&mpy1, &y1, p);
       __mp_dbl (&mpy2, &y2, p);
       if (y1 == y2)
-	return y1;
+	{
+	  LIBC_PROBE (slowatan, 3, &p, &x, &y1);
+	  return y1;
+	}
     }
+  LIBC_PROBE (slowatan_inexact, 3, &p, &x, &y1);
   return y1;			/*if impossible to do exact computing */
 }
 
diff --git a/sysdeps/ieee754/dbl-64/s_tan.c b/sysdeps/ieee754/dbl-64/s_tan.c
index 54f863e544..cc0dbbbc9f 100644
--- a/sysdeps/ieee754/dbl-64/s_tan.c
+++ b/sysdeps/ieee754/dbl-64/s_tan.c
@@ -41,6 +41,7 @@
 #include <math.h>
 #include <math_private.h>
 #include <fenv.h>
+#include <stap-probe.h>
 
 #ifndef SECTION
 # define SECTION
@@ -838,6 +839,7 @@ tanMp (double x)
   p = 32;
   __mptan (x, &mpy, p);
   __mp_dbl (&mpy, &y, p);
+  LIBC_PROBE (slowtan, 2, &x, &y);
   return y;
 }
 
diff --git a/sysdeps/ieee754/dbl-64/slowexp.c b/sysdeps/ieee754/dbl-64/slowexp.c
index 8f353f634f..525224f44a 100644
--- a/sysdeps/ieee754/dbl-64/slowexp.c
+++ b/sysdeps/ieee754/dbl-64/slowexp.c
@@ -29,6 +29,8 @@
 /**************************************************************************/
 #include <math_private.h>
 
+#include <stap-probe.h>
+
 #ifndef USE_LONG_DOUBLE_FOR_MP
 # include "mpa.h"
 void __mpexp (mp_no *x, mp_no *y, int p);
@@ -60,13 +62,22 @@ __slowexp (double x)
   __mp_dbl (&mpw, &w, p);
   __mp_dbl (&mpz, &z, p);
   if (w == z)
-    return w;
+    {
+      /* Track how often we get to the slow exp code plus
+	 its input/output values.  */
+      LIBC_PROBE (slowexp_p6, 2, &x, &w);
+      return w;
+    }
   else
     {
       p = 32;
       __dbl_mp (x, &mpx, p);
       __mpexp (&mpx, &mpy, p);
       __mp_dbl (&mpy, &res, p);
+
+      /* Track how often we get to the uber-slow exp code plus
+	 its input/output values.  */
+      LIBC_PROBE (slowexp_p32, 2, &x, &res);
       return res;
     }
 #else
diff --git a/sysdeps/ieee754/dbl-64/slowpow.c b/sysdeps/ieee754/dbl-64/slowpow.c
index a379728b14..d200c39e59 100644
--- a/sysdeps/ieee754/dbl-64/slowpow.c
+++ b/sysdeps/ieee754/dbl-64/slowpow.c
@@ -34,6 +34,8 @@
 #include "mpa.h"
 #include <math_private.h>
 
+#include <stap-probe.h>
+
 #ifndef SECTION
 # define SECTION
 #endif
@@ -97,7 +99,12 @@ __slowpow (double x, double y, double z)
   __sub (&mpp, &eps, &mpr1, p);
   __mp_dbl (&mpr1, &res1, p);
   if (res == res1)
-    return res;
+    {
+      /* Track how often we get to the slow pow code plus
+	 its input/output values.  */
+      LIBC_PROBE (slowpow_p10, 4, &x, &y, &z, &res);
+      return res;
+    }
 
   /* If we don't, then we repeat using a higher precision.  768 bits of
      precision ought to be enough for anybody.  */
@@ -109,5 +116,10 @@ __slowpow (double x, double y, double z)
   __mul (&mpy, &mpz, &mpw, p);
   __mpexp (&mpw, &mpp, p);
   __mp_dbl (&mpp, &res, p);
+
+  /* Track how often we get to the uber-slow pow code plus
+     its input/output values.  */
+  LIBC_PROBE (slowpow_p32, 4, &x, &y, &z, &res);
+
   return res;
 }