arrfab / rpms / glibc

Forked from rpms/glibc 4 years ago
Clone

Blame SOURCES/glibc-stap-libm.patch

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