Monkey Patches for Macosx builds

1) Monkey patch for Macosx build required on perf_counters
2) Processor affinity set on Macosx
3) std::min template error