diff --git a/portability/CMakeLists.txt b/portability/CMakeLists.txt index 09d6f23e3d2..8f6a6f0feb2 100644 --- a/portability/CMakeLists.txt +++ b/portability/CMakeLists.txt @@ -5,7 +5,6 @@ set(tokuportability_srcs memory os_malloc portability - toku_affinity toku_assert toku_pthread toku_fair_rwlock diff --git a/portability/tests/test-affinity.cc b/portability/tests/test-affinity.cc deleted file mode 100644 index 74702346bd5..00000000000 --- a/portability/tests/test-affinity.cc +++ /dev/null @@ -1,47 +0,0 @@ -/* -*- mode: C++; c-basic-offset: 4; indent-tabs-mode: nil -*- */ -// vim: ft=cpp:expandtab:ts=8:sw=4:softtabstop=4: -#ident "$Id$" -#ident "Copyright (c) 2007-2012 Tokutek Inc. All rights reserved." -#ident "The technology is licensed by the Massachusetts Institute of Technology, Rutgers State University of New Jersey, and the Research Foundation of State University of New York at Stony Brook under United States of America Serial No. 11/760379 and to the patents and/or patent applications resulting from it." - -#include -#include -#include -#include -#include "toku_affinity.h" - -int main(void) { - int r; - toku_cpuset_t orig; - TOKU_CPU_ZERO(&orig); - r = toku_getaffinity(toku_os_getpid(), sizeof orig, &orig); - if (r) { - perror("toku_getaffinity"); - return r; - } - toku_cpuset_t set; - TOKU_CPU_ZERO(&set); - TOKU_CPU_SET(0, &set); - r = toku_setaffinity(toku_os_getpid(), sizeof set, &set); - if (r) { - perror("toku_setaffinity"); - return r; - } - toku_cpuset_t chk; - TOKU_CPU_ZERO(&chk); - r = toku_getaffinity(toku_os_getpid(), sizeof chk, &chk); - if (r) { - perror("toku_getaffinity"); - return r; - } - - // don't want to expose this api unless we use it somewhere -#if defined(HAVE_CPUSET_GETAFFINITY) - r = CPU_CMP(&set, &chk); -#else - // hope this is good enough on linux - r = memcmp(&set, &chk, sizeof set); -#endif - - return r; -} diff --git a/portability/toku_affinity.cc b/portability/toku_affinity.cc deleted file mode 100644 index 63b1afe7140..00000000000 --- a/portability/toku_affinity.cc +++ /dev/null @@ -1,42 +0,0 @@ -/* -*- mode: C++; c-basic-offset: 4; indent-tabs-mode: nil -*- */ -// vim: ft=cpp:expandtab:ts=8:sw=4:softtabstop=4: -#ident "Copyright (c) 2012 Tokutek Inc. All rights reserved." -#ident "$Id$" - -#include -#include "toku_affinity.h" - -#if defined(HAVE_SCHED_GETAFFINITY) - -int toku_getaffinity(pid_t pid, size_t cpusetsize, toku_cpuset_t *cpusetp) { - return sched_getaffinity(pid, cpusetsize, cpusetp); -} -int toku_setaffinity(pid_t pid, size_t cpusetsize, const toku_cpuset_t *cpusetp) { - return sched_setaffinity(pid, cpusetsize, cpusetp); -} - -#elif defined(HAVE_CPUSET_GETAFFINITY) - -int toku_getaffinity(pid_t pid, size_t cpusetsize, toku_cpuset_t *cpusetp) { - return cpuset_getaffinity(CPU_LEVEL_CPUSET, CPU_WHICH_PID, pid, cpusetsize, cpusetp); -} -int toku_setaffinity(pid_t pid, size_t cpusetsize, const toku_cpuset_t *cpusetp) { - return cpuset_setaffinity(CPU_LEVEL_CPUSET, CPU_WHICH_PID, pid, cpusetsize, cpusetp); -} - -#else - -// dummy implementation to get rid of unused warnings etc -int toku_getaffinity(pid_t pid __attribute__((unused)), - size_t cpusetsize __attribute__((unused)), - toku_cpuset_t *cpusetp) { - TOKU_CPU_ZERO(cpusetp); - return 0; -} -int toku_setaffinity(pid_t pid __attribute__((unused)), - size_t cpusetsize __attribute__((unused)), - const toku_cpuset_t *cpusetp __attribute__((unused))) { - return 0; -} - -#endif diff --git a/portability/toku_affinity.h b/portability/toku_affinity.h deleted file mode 100644 index 01012eb4a37..00000000000 --- a/portability/toku_affinity.h +++ /dev/null @@ -1,36 +0,0 @@ -/* -*- mode: C++; c-basic-offset: 4; indent-tabs-mode: nil -*- */ -// vim: ft=cpp:expandtab:ts=8:sw=4:softtabstop=4: -#ident "Copyright (c) 2012 Tokutek Inc. All rights reserved." -#ident "$Id$" - -#ifndef TOKU_AFFINITY_H -#define TOKU_AFFINITY_H - -#include -#include -#include - -#if defined(HAVE_SCHED_GETAFFINITY) -# include -typedef cpu_set_t toku_cpuset_t; -# define TOKU_CPU_ZERO(p) CPU_ZERO(p) -# define TOKU_CPU_SET(n, p) CPU_SET(n, p) -#elif defined(HAVE_CPUSET_GETAFFINITY) -# include -# include -typedef cpuset_t toku_cpuset_t; -# define TOKU_CPU_ZERO(p) CPU_ZERO(p) -# define TOKU_CPU_SET(n, p) CPU_SET(n, p) -#else -// dummy implementation to get rid of unused warnings etc -typedef int toku_cpuset_t; -# define TOKU_CPU_ZERO(p) (*p = 0) -# define TOKU_CPU_SET(n, p) (((void) n, (void) p)) -#endif - -// see sched_getaffinity(2) -int toku_getaffinity(pid_t pid, size_t cpusetsize, toku_cpuset_t *cpusetp); -// see sched_setaffinity(2) -int toku_setaffinity(pid_t pid, size_t cpusetsize, const toku_cpuset_t *cpusetp); - -#endif // TOKU_AFFINITY_H diff --git a/src/tests/hotindexer-with-queries.cc b/src/tests/hotindexer-with-queries.cc index 29d9cb0d517..0a7539bd3a1 100644 --- a/src/tests/hotindexer-with-queries.cc +++ b/src/tests/hotindexer-with-queries.cc @@ -8,7 +8,6 @@ #include "toku_pthread.h" #include #include -#include "toku_affinity.h" #include "key-val.h" enum {NUM_INDEXER_INDEXES=1}; @@ -213,13 +212,10 @@ static void run_test(void) // ------------ infrastructure ---------- -#include - static inline void do_args (int argc, char * const argv[]) { const char *progname=argv[0]; num_rows = NUM_ROWS; - int num_cpus = 0; argc--; argv++; while (argc>0) { if (strcmp(argv[0],"-v")==0) { @@ -229,32 +225,12 @@ do_args (int argc, char * const argv[]) { } else if (strcmp(argv[0],"-r")==0) { argc--; argv++; num_rows = atoi(argv[0]); - } else if (strcmp(argv[0], "--ncpus") == 0 && argc+1 > 0) { - argc--; argv++; - num_cpus = atoi(argv[0]); } else { fprintf(stderr, "Usage:\n %s [-v] [-q] [-r rows]\n", progname); exit(1); } argc--; argv++; } - - if (num_cpus > 0) { - toku_cpuset_t cpuset; - TOKU_CPU_ZERO(&cpuset); - for (int i = 0; i < num_cpus; i++) { - TOKU_CPU_SET(i, &cpuset); - } - int r; - r = toku_setaffinity(toku_os_getpid(), sizeof cpuset, &cpuset); - assert(r == 0); - - toku_cpuset_t use_cpuset; - TOKU_CPU_ZERO(&use_cpuset); - r = toku_getaffinity(toku_os_getpid(), sizeof use_cpuset, &use_cpuset); - assert(r == 0); - assert(memcmp(&cpuset, &use_cpuset, sizeof cpuset) == 0); - } } diff --git a/util/tests/threadpool-testrunf.cc b/util/tests/threadpool-testrunf.cc index 8f9f2886929..ee0faa465e9 100644 --- a/util/tests/threadpool-testrunf.cc +++ b/util/tests/threadpool-testrunf.cc @@ -5,8 +5,6 @@ #include -#include - #include #include #include @@ -15,9 +13,8 @@ int verbose = 0; -static int usage(int ncpus, int poolsize) { +static int usage(int poolsize) { fprintf(stderr, "[-q] [-v] [--verbose] (%d)\n", verbose); - fprintf(stderr, "[--ncpus %d]\n", ncpus); fprintf(stderr, "[--poolsize %d]\n", poolsize); return 1; } @@ -46,7 +43,6 @@ static void dotest(int poolsize, int nloops) { int main(int argc, char *argv[]) { // defaults - int ncpus = 0; int poolsize = 1; int nloops = 100000; @@ -56,10 +52,6 @@ int main(int argc, char *argv[]) { char *arg = argv[i]; if (arg[0] != '-') break; - if (strcmp(arg, "--ncpus") == 0 && i+1 < argc) { - ncpus = atoi(argv[++i]); - continue; - } if (strcmp(arg, "--poolsize") == 0 && i+1 < argc) { poolsize = atoi(argv[++i]); continue; @@ -72,27 +64,11 @@ int main(int argc, char *argv[]) { verbose = verbose > 0 ? verbose-1 : 0; continue; } - - return usage(ncpus, poolsize); + + return usage(poolsize); } int starti = i; - if (ncpus > 0) { - toku_cpuset_t cpuset; - TOKU_CPU_ZERO(&cpuset); - for (i = 0; i < ncpus; i++) - TOKU_CPU_SET(i, &cpuset); - int r; - r = toku_setaffinity(getpid(), sizeof cpuset, &cpuset); - assert(r == 0); - - toku_cpuset_t use_cpuset; - TOKU_CPU_ZERO(&use_cpuset); - r = toku_getaffinity(getpid(), sizeof use_cpuset, &use_cpuset); - assert(r == 0); - assert(memcmp(&cpuset, &use_cpuset, sizeof cpuset) == 0); - } - if (starti == argc) { dotest(poolsize, nloops); } else {