glibc/glibc-stap-libm.patch

73 lines
2.3 KiB
Diff
Raw Permalink Normal View History

2012-05-23 18:18:07 +00:00
diff -rup c/sysdeps/ieee754/dbl-64/slowexp.c d/sysdeps/ieee754/dbl-64/slowexp.c
--- c/sysdeps/ieee754/dbl-64/slowexp.c 2012-05-20 19:47:38.000000000 -0600
+++ d/sysdeps/ieee754/dbl-64/slowexp.c 2012-05-21 10:02:51.693957300 -0600
@@ -30,6 +30,8 @@
#include "mpa.h"
2012-05-23 18:18:07 +00:00
#include <math_private.h>
+#include <stap-probe.h>
+
#ifndef SECTION
# define SECTION
#endif
2012-05-23 18:18:07 +00:00
@@ -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;
}
}
2012-05-23 18:18:07 +00:00
diff -rup c/sysdeps/ieee754/dbl-64/slowpow.c d/sysdeps/ieee754/dbl-64/slowpow.c
--- c/sysdeps/ieee754/dbl-64/slowpow.c 2012-05-20 19:47:38.000000000 -0600
+++ d/sysdeps/ieee754/dbl-64/slowpow.c 2012-05-21 10:02:51.694957291 -0600
@@ -34,6 +34,8 @@
#include "mpa.h"
2012-05-23 18:18:07 +00:00
#include <math_private.h>
+#include <stap-probe.h>
+
#ifndef SECTION
# define SECTION
#endif
2012-05-23 18:18:07 +00:00
@@ -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_p6, 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 */
2012-05-23 18:18:07 +00:00
@@ -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;
}