mirror of
https://git.FreeBSD.org/src.git
synced 2024-11-24 07:40:52 +00:00
Unbreak high resolution profiling a little: use dummy asms to prevent
timing loops being optimized away. Once apon a time, gcc promised not to optimize away timing loops, but gcc started optimizing away the call to a null function in the timing loop here some time between gcc-3.3.3 and gcc-3.4.6, and it started optimizing away the timing loop itself some time between gcc-3.4.6 and gcc-4.2.
This commit is contained in:
parent
d076fbea58
commit
7df7fc34a3
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=170659
@ -268,18 +268,23 @@ mexitcount(selfpc)
|
||||
}
|
||||
}
|
||||
|
||||
#ifndef __GNUCLIKE_ASM
|
||||
#error "This file uses null asms to prevent timing loops being optimized away."
|
||||
#endif
|
||||
|
||||
void
|
||||
empty_loop()
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < CALIB_SCALE; i++)
|
||||
;
|
||||
__asm __volatile("");
|
||||
}
|
||||
|
||||
void
|
||||
nullfunc()
|
||||
{
|
||||
__asm __volatile("");
|
||||
}
|
||||
|
||||
void
|
||||
|
Loading…
Reference in New Issue
Block a user