make sampling_test more robust
The test inspects "nested-most" frames in malloc sampling samples. And some compile options caused noopt to seen as call site of malloc. I.e. because noopt is immediately after malloc. To make things more robust we create local "copy" of noopt that is marked as noinline and so immediately next instruction after malloc is call to this local_noopt thingy, which makes test more robust since malloc stack trace will see that, as we expect, AllocateAllocate is what calls malloc.
This commit is contained in:
parent
7803e80bb2
commit
e46b3e79aa
|
@ -67,7 +67,10 @@ static std::string NaiveShellQuote(std::string_view arg) {
|
||||||
|
|
||||||
extern "C" ATTRIBUTE_NOINLINE
|
extern "C" ATTRIBUTE_NOINLINE
|
||||||
void* AllocateAllocate() {
|
void* AllocateAllocate() {
|
||||||
return noopt(malloc(10000));
|
auto local_noopt = [] (void* ptr) ATTRIBUTE_NOINLINE -> void* {
|
||||||
|
return noopt(ptr);
|
||||||
|
};
|
||||||
|
return local_noopt(malloc(10000));
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef PPROF_PATH
|
#ifndef PPROF_PATH
|
||||||
|
|
Loading…
Reference in New Issue