00db10
Related upstream commit:
00db10
00db10
commit 10e1cf6b73f1598e57d24933a0949dbeffa2c8a0
00db10
Author: Siddhesh Poyarekar <siddhesh@redhat.com>
00db10
Date:   Fri Oct 11 22:37:53 2013 +0530
00db10
00db10
    Add systemtap markers to math function slow paths
00db10
00db10
diff -rup glibc-2.17-c758a686/sysdeps/ieee754/dbl-64/slowexp.c glibc-2.17-c758a686/sysdeps/ieee754/dbl-64/slowexp.c
00db10
--- glibc-2.17-c758a686/sysdeps/ieee754/dbl-64/slowexp.c	2012-05-20 19:47:38.000000000 -0600
00db10
+++ glibc-2.17-c758a686/sysdeps/ieee754/dbl-64/slowexp.c	2012-05-21 10:02:51.693957300 -0600
00db10
@@ -30,6 +30,8 @@
00db10
 #include "mpa.h"
00db10
 #include <math_private.h>
00db10
 
00db10
+#include <stap-probe.h>
00db10
+
00db10
 #ifndef SECTION
00db10
 # define SECTION
00db10
 #endif
00db10
@@ -60,12 +62,21 @@ __slowexp(double x) {
00db10
   __sub(&mpy,&mpcor,&mpz,p);
00db10
   __mp_dbl(&mpw, &w, p);
00db10
   __mp_dbl(&mpz, &z, p);
00db10
-  if (w == z) return w;
00db10
+  if (w == z) {
00db10
+    /* Track how often we get to the slow exp code plus
00db10
+       its input/output values.  */
00db10
+    LIBC_PROBE (slowexp_p6, 2, &x, &w);
00db10
+    return w;
00db10
+  }
00db10
   else  {                   /* if calculating is not exactly   */
00db10
     p = 32;
00db10
     __dbl_mp(x,&mpx,p);
00db10
     __mpexp(&mpx, &mpy, p);
00db10
     __mp_dbl(&mpy, &res, p);
00db10
+ 
00db10
+    /* Track how often we get to the uber-slow exp code plus
00db10
+       its input/output values.  */
00db10
+    LIBC_PROBE (slowexp_p32, 2, &x, &res;;
00db10
     return res;
00db10
   }
00db10
 }
00db10
diff -rup glibc-2.17-c758a686/sysdeps/ieee754/dbl-64/slowpow.c glibc-2.17-c758a686/sysdeps/ieee754/dbl-64/slowpow.c
00db10
--- glibc-2.17-c758a686/sysdeps/ieee754/dbl-64/slowpow.c	2012-05-20 19:47:38.000000000 -0600
00db10
+++ glibc-2.17-c758a686/sysdeps/ieee754/dbl-64/slowpow.c	2012-05-21 10:02:51.694957291 -0600
00db10
@@ -34,6 +34,8 @@
00db10
 #include "mpa.h"
00db10
 #include <math_private.h>
00db10
 
00db10
+#include <stap-probe.h>
00db10
+
00db10
 #ifndef SECTION
00db10
 # define SECTION
00db10
 #endif
00db10
@@ -65,7 +67,12 @@ __slowpow(double x, double y, double z)
00db10
   __mp_dbl(&mpr, &res, p);
00db10
   __sub(&mpp,&eps,&mpr1,p);   /*  pp -eps =r1 */
00db10
   __mp_dbl(&mpr1, &res1, p);  /*  converting into double precision */
00db10
-  if (res == res1) return res;
00db10
+  if (res == res1) {
00db10
+    /* Track how often we get to the slow pow code plus
00db10
+       its input/output values.  */
00db10
+    LIBC_PROBE (slowpow_p10, 4, &x, &y, &z, &res;;
00db10
+    return res;
00db10
+  }
00db10
 
00db10
   p = 32;     /* if we get here result wasn't calculated exactly, continue */
00db10
   __dbl_mp(x,&mpx,p);                          /* for more exact calculation */
00db10
@@ -75,5 +82,10 @@ __slowpow(double x, double y, double z)
00db10
   __mul(&mpy,&mpz,&mpw,p);  /* y*z =w    */
00db10
   __mpexp(&mpw, &mpp, p);   /* e^w=pp    */
00db10
   __mp_dbl(&mpp, &res, p);  /* converting into double precision */
00db10
+
00db10
+  /* Track how often we get to the uber-slow pow code plus
00db10
+     its input/output values.  */
00db10
+    LIBC_PROBE (slowpow_p32, 4, &x, &y, &z, &res;;
00db10
+
00db10
   return res;
00db10
 }