Skip to content

Commit

Permalink
Add UNUSED_ATTRIBUTE
Browse files Browse the repository at this point in the history
  • Loading branch information
AngLi-Leon authored and apavlo committed Jul 13, 2017
1 parent 2bf837b commit c0af294
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
10 changes: 6 additions & 4 deletions src/main/tpcc/tpcc_workload.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -109,15 +109,17 @@ size_t GenerateWarehouseId(const size_t &thread_id) {
}
}

void PinToCore(size_t core) {
// Mac OS X does not export interfaces that identify processors or control thread placement
// explicit thread to processor binding is not supported.
// Reference: https://superuser.com/questions/149312/how-to-set-processor-affinity-on-os-x
#ifndef __APPLE__
void PinToCore(size_t core) {
cpu_set_t cpuset;
CPU_ZERO(&cpuset);
CPU_SET(core, &cpuset);
pthread_setaffinity_np(pthread_self(), sizeof(cpu_set_t), &cpuset);
#else
void PinToCore(size_t UNUSED_ATTRIBUTE core) {
// Mac OS X does not export interfaces that identify processors or control thread placement
// explicit thread to processor binding is not supported.
// Reference: https://superuser.com/questions/149312/how-to-set-processor-affinity-on-os-x
#endif
}

Expand Down
10 changes: 6 additions & 4 deletions src/main/ycsb/ycsb_workload.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,15 +84,17 @@ volatile bool is_running = true;
PadInt *abort_counts;
PadInt *commit_counts;

void PinToCore(size_t core) {
// Mac OS X does not export interfaces that identify processors or control thread placement
// explicit thread to processor binding is not supported.
// Reference: https://superuser.com/questions/149312/how-to-set-processor-affinity-on-os-x
#ifndef __APPLE__
void PinToCore(size_t core) {
cpu_set_t cpuset;
CPU_ZERO(&cpuset);
CPU_SET(core, &cpuset);
pthread_setaffinity_np(pthread_self(), sizeof(cpu_set_t), &cpuset);
#else
void PinToCore(size_t UNUSED_ATTRIBUTE core) {
// Mac OS X does not export interfaces that identify processors or control thread placement
// explicit thread to processor binding is not supported.
// Reference: https://superuser.com/questions/149312/how-to-set-processor-affinity-on-os-x
#endif
}

Expand Down

0 comments on commit c0af294

Please sign in to comment.