summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJason Evans <je@fb.com>2015-03-12 23:25:18 (GMT)
committerJason Evans <je@fb.com>2015-03-12 23:25:18 (GMT)
commitd69964bd2d31387f79a5f0494de8fd255b693afb (patch)
tree2de08cf1ebc5d19e4192ed733a5a39e227ceb047
parentfbd8d773ad0230ffba4e2c296dac3edcac9ca27e (diff)
downloadjemalloc-d69964bd2d31387f79a5f0494de8fd255b693afb.zip
jemalloc-d69964bd2d31387f79a5f0494de8fd255b693afb.tar.gz
jemalloc-d69964bd2d31387f79a5f0494de8fd255b693afb.tar.bz2
Fix a heap profiling regression.
Fix prof_tctx_comp() to incorporate tctx state into the comparison. During a dump it is possible for both a purgatory tctx and an otherwise equivalent nominal tctx to reside in the tree at the same time. This regression was introduced by 602c8e0971160e4b85b08b16cf8a2375aa24bc04 (Implement per thread heap profiling.).
-rw-r--r--src/prof.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/prof.c b/src/prof.c
index 4f1580b..84fa5fd 100644
--- a/src/prof.c
+++ b/src/prof.c
@@ -137,8 +137,13 @@ prof_tctx_comp(const prof_tctx_t *a, const prof_tctx_t *b)
{
uint64_t a_uid = a->thr_uid;
uint64_t b_uid = b->thr_uid;
-
- return ((a_uid > b_uid) - (a_uid < b_uid));
+ int ret = (a_uid > b_uid) - (a_uid < b_uid);
+ if (ret == 0) {
+ prof_tctx_state_t a_state = a->state;
+ prof_tctx_state_t b_state = b->state;
+ ret = (a_state > b_state) - (a_state < b_state);
+ }
+ return (ret);
}
rb_gen(static UNUSED, tctx_tree_, prof_tctx_tree_t, prof_tctx_t,