diff options
author | Jason Evans <je@fb.com> | 2011-03-15 05:22:29 (GMT) |
---|---|---|
committer | Jason Evans <je@fb.com> | 2011-03-15 18:12:11 (GMT) |
commit | ff7450727f64180367f430b1b747f9e682e26df4 (patch) | |
tree | 62a6ffcbeb8415b6d8e960a64fccbc5bd782e16b /jemalloc/include | |
parent | fa5d245aef7087c19c375590a7ee2966a0ae339a (diff) | |
download | jemalloc-ff7450727f64180367f430b1b747f9e682e26df4.zip jemalloc-ff7450727f64180367f430b1b747f9e682e26df4.tar.gz jemalloc-ff7450727f64180367f430b1b747f9e682e26df4.tar.bz2 |
Expand a comment regarding geometric sampling.
Diffstat (limited to 'jemalloc/include')
-rw-r--r-- | jemalloc/include/jemalloc/internal/prof.h | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/jemalloc/include/jemalloc/internal/prof.h b/jemalloc/include/jemalloc/internal/prof.h index 7864000..db63465 100644 --- a/jemalloc/include/jemalloc/internal/prof.h +++ b/jemalloc/include/jemalloc/internal/prof.h @@ -247,8 +247,22 @@ prof_sample_threshold_update(prof_tdata_t *prof_tdata) double u; /* - * Compute prof_sample_threshold as a geometrically distributed random + * Compute sample threshold as a geometrically distributed random * variable with mean (2^opt_lg_prof_sample). + * + * __ __ + * | log(u) | 1 + * prof_tdata->threshold = | -------- |, where p = ------------------- + * | log(1-p) | opt_lg_prof_sample + * 2 + * + * For more information on the math, see: + * + * Non-Uniform Random Variate Generation + * Luc Devroye + * Springer-Verlag, New York, 1986 + * pp 500 + * (http://cg.scs.carleton.ca/~luc/rnbookindex.html) */ prn64(r, 53, prof_tdata->prn_state, (uint64_t)6364136223846793005LLU, (uint64_t)1442695040888963407LLU); @@ -374,7 +388,7 @@ prof_sample_accum_update(size_t size) /* Take care to avoid integer overflow. */ if (size >= prof_tdata->threshold - prof_tdata->accum) { prof_tdata->accum -= (prof_tdata->threshold - size); - /* Compute new prof_sample_threshold. */ + /* Compute new sample threshold. */ prof_sample_threshold_update(prof_tdata); while (prof_tdata->accum >= prof_tdata->threshold) { prof_tdata->accum -= prof_tdata->threshold; |