inform compiler that tcmalloc allocation sampling is unlikely

Now compiler generates slightly better code which produces jump-less
code for common case of not sampling allocations.
This commit is contained in:
Aliaksey Kandratsenka 2014-11-09 17:12:05 -08:00
parent 4f051fddcd
commit bce72dda07
1 changed files with 1 additions and 1 deletions

View File

@ -1091,7 +1091,7 @@ inline void* do_malloc_small(ThreadCache* heap, size_t size) {
size_t cl = Static::sizemap()->SizeClass(size);
size = Static::sizemap()->class_to_size(cl);
if ((FLAGS_tcmalloc_sample_parameter > 0) && heap->SampleAllocation(size)) {
if (UNLIKELY(FLAGS_tcmalloc_sample_parameter > 0) && heap->SampleAllocation(size)) {
return DoSampledAllocation(size);
} else {
// The common case, and also the simplest. This just pops the