Skip to content

Commit b3b22a0

Browse files
committed
SERVER-6759 - work around for libm loading on some platforms
1 parent 774853d commit b3b22a0

File tree

2 files changed

+25
-0
lines changed

2 files changed

+25
-0
lines changed

src/third_party/gperftools-2.0/src/sampler.cc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,8 @@ DEFINE_int64(tcmalloc_sample_parameter,
5656

5757
namespace tcmalloc {
5858

59+
#if !defined(NO_TCMALLOC_SAMPLES) // 10gen
60+
5961
// Statics for Sampler
6062
double Sampler::log_table_[1<<kFastlogNumBits];
6163

@@ -126,5 +128,6 @@ size_t Sampler::PickNextSamplingPoint() {
126128
return static_cast<size_t>(min(0.0, (FastLog2(q) - 26)) * (-log(2.0)
127129
* FLAGS_tcmalloc_sample_parameter) + 1);
128130
}
131+
#endif // !defined(NO_TCMALLOC_SAMPLES) // 10gen
129132

130133
} // namespace tcmalloc

src/third_party/gperftools-2.0/src/sampler.h

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,27 @@ namespace tcmalloc {
9999
// only result in a single call to PickNextSamplingPoint.
100100
//-------------------------------------------------------------------
101101

102+
#ifdef NO_TCMALLOC_SAMPLES // 10gen
103+
104+
// Dummy class with same public interface as below
105+
class PERFTOOLS_DLL_DECL Sampler {
106+
public:
107+
void Init(uint32_t seed) {}
108+
bool SampleAllocation(size_t k) { return false; }
109+
static void InitStatics() {}
110+
int GetSamplePeriod() { return 0; }
111+
112+
# if 0
113+
// "public" functions only used in the Sampler and tests of the Sampler
114+
void Cleanup();
115+
size_t PickNextSamplingPoint();
116+
static uint64_t NextRandom(uint64_t rnd_);
117+
static double FastLog2(const double & d);
118+
static void PopulateFastLog2Table();
119+
# endif
120+
};
121+
122+
#else
102123
class PERFTOOLS_DLL_DECL Sampler {
103124
public:
104125
// Initialize this sampler.
@@ -173,6 +194,7 @@ inline double Sampler::FastLog2(const double & d) {
173194
const int32_t exponent = ((x_high >> 20) & 0x7FF) - 1023;
174195
return exponent + log_table_[y];
175196
}
197+
#endif // NO_TCMALLOC_SAMPLES // 10gen
176198

177199
} // namespace tcmalloc
178200

0 commit comments

Comments
 (0)