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