You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

80 lines
2.7 KiB

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