diff options
author | ckolivas <kernel@kolivas.org> | 2011-06-09 11:45:06 +1000 |
---|---|---|
committer | ckolivas <kernel@kolivas.org> | 2011-06-09 11:45:06 +1000 |
commit | 8a832eeab524bbad160adb7c27acb370d6adedff (patch) | |
tree | 75b8e08a61d4e488824b1c0fa2de4bc05459cc03 /miner.h | |
parent | f2e4ff0e509f69404aa11f5232d8f63110383f03 (diff) |
Linux + x86_64 optimisations.
Add likely() macro.
Optimise a few obvious code paths with likely/unlikely.
Change algo to sse2_amd64 by default.
Move priority change to worker threads only.
Detect number of CPUs and set default number of threads == CPUs.
Add scheduling policy change to worker threads to SCHED_IDLE first and fallback to SCHED_BATCH on linux.
Don't error when failing to set priority.
Add CPU affinity and bind worker threads to CPUs when number of threads is a multiple of number of CPUs.
Update NEWS with changes.
Diffstat (limited to 'miner.h')
-rw-r--r-- | miner.h | 8 |
1 files changed, 5 insertions, 3 deletions
@@ -87,12 +87,14 @@ enum { }; #endif -#if defined(__GNUC__) && (__GNUC__ > 2) && defined(__OPTIMIZE__) #undef unlikely -#define unlikely(expr) (__builtin_expect((expr), 0)) +#undef likely +#if defined(__GNUC__) && (__GNUC__ > 2) && defined(__OPTIMIZE__) +#define unlikely(expr) (__builtin_expect(!!(expr), 0)) +#define likely(expr) (__builtin_expect(!!(expr), 1)) #else -#undef unlikely #define unlikely(expr) (expr) +#define likely(expr) (expr) #endif #if defined(__i386__) |