-
Notifications
You must be signed in to change notification settings - Fork 0
likely()/unlikely() with prediction analysis
License
LGPL-3.0, GPL-3.0 licenses found
Licenses found
LGPL-3.0
COPYING.LESSER
GPL-3.0
COPYING
kroki/likely
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
Define likely() and unlikely() macros to guide branch prediction. Implementation requires GNU tool-chain (GCC, GNU ld). Optional -D KROKI_LIKELY_REPORT[=RATIO] during compilation will enable prediction analysis. RATIO should be a float between 0.0 and 1.0, default is 1.0. Report on likely()/unlikely() with prediction rate less than or equal to RATIO will be printed to stderr on program exit. Prediction accounting is not thread-safe: when several threads try to increment a counter simultaneously some increments may be lost (however this should be a rare event and should not affect overall statistics). Defining KROKI_LIKELY_NOPOLLUTE will result in omitting likely()/unlikely() alias definition (functionality will still be available as kroki_likely()/kroki_unlikely()). Inspired by Ulrich Drepper's "What Every Programmer Should Know About Memory" (http://www.akkadia.org/drepper/cpumemory.pdf) annex A.2.
About
likely()/unlikely() with prediction analysis
Resources
License
LGPL-3.0, GPL-3.0 licenses found
Licenses found
LGPL-3.0
COPYING.LESSER
GPL-3.0
COPYING
Stars
Watchers
Forks
Packages 0
No packages published