mirror of
https://git.FreeBSD.org/ports.git
synced 2025-01-20 08:27:15 +00:00
016b2b0fbf
SMHasher is a test suite designed to test the distribution, collision, and performance properties of non-cryptographic hash functions - it aims to be the "DieHarder" of hash testing, and does a pretty good job of finding flaws with a number of popular hashes. The SMHasher suite also includes MurmurHash3, which is the latest version in the series of MurmurHash functions - the new version is faster, more robust, and its variants can produce 32- and 128-bit hash values efficiently on both x86 and x64 platforms. https://code.google.com/p/smhasher/
42 lines
860 B
C++
42 lines
860 B
C++
--- Platform.cpp 2015-03-30 17:26:46.000000000 -0400
|
|
+++ Platform.cpp.new 2015-03-30 17:26:56.000000000 -0400
|
|
@@ -19,6 +19,38 @@
|
|
SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_HIGHEST);
|
|
}
|
|
|
|
+#elif __FreeBSD__
|
|
+
|
|
+#include <string.h>
|
|
+#include <errno.h>
|
|
+#include <sys/types.h>
|
|
+#include <sys/param.h>
|
|
+#include <sys/cpuset.h>
|
|
+
|
|
+void
|
|
+SetAffinity(int cpu)
|
|
+{
|
|
+ cpuset_t mask;
|
|
+ unsigned int i;
|
|
+
|
|
+ fprintf(stdout, "SetAffinity called with arg %d\n", cpu);
|
|
+
|
|
+ CPU_ZERO(&mask);
|
|
+ i = 0;
|
|
+ do {
|
|
+ if (cpu & 1) {
|
|
+ CPU_SET(i, &mask);
|
|
+ }
|
|
+ i++;
|
|
+ cpu >>= 1;
|
|
+ } while (cpu);
|
|
+
|
|
+ if (cpuset_setaffinity(CPU_LEVEL_WHICH, CPU_WHICH_PID, -1, sizeof(cpuset_t), &mask) == -1)
|
|
+ {
|
|
+ fprintf(stderr, "SetAffinity() failed. %s", strerror(errno));
|
|
+ }
|
|
+}
|
|
+
|
|
#else
|
|
|
|
#include <sched.h>
|