Browse Source

Set an affinity mask in thread hive threads. It improves perf

Panagiotis Christopoulos Charitos 8 years ago
parent
commit
16a6290e77
2 changed files with 6 additions and 6 deletions
  1. 1 1
      src/anki/util/ThreadHive.cpp
  2. 5 5
      tests/util/ThreadHive.cpp

+ 1 - 1
src/anki/util/ThreadHive.cpp

@@ -32,7 +32,7 @@ public:
 		, m_hive(hive)
 	{
 		ANKI_ASSERT(hive);
-		m_thread.start(this, threadCallback);
+		m_thread.start(this, threadCallback, id);
 	}
 
 private:

+ 5 - 5
tests/util/ThreadHive.cpp

@@ -229,15 +229,15 @@ ANKI_TEST(Util, ThreadHiveBench)
 	Atomic<U64> sum = {0};
 	FibTask task(&sum, salloc, FIB_N);
 
-	HighRezTimer timer;
-	timer.start();
+	auto timeA = HighRezTimer::getCurrentTime();
 	hive.submitTask(FibTask::callback, &task);
-
 	hive.waitAllTasks();
-	timer.stop();
 
-	ANKI_TEST_LOGI("Total time %fms", timer.getElapsedTime() * 1000.0);
+	auto timeB = HighRezTimer::getCurrentTime();
 	const U64 serialFib = fib(FIB_N);
+	auto timeC = HighRezTimer::getCurrentTime();
+
+	ANKI_TEST_LOGI("Total time %fms. Ground truth %fms", (timeB - timeA) * 1000.0, (timeC - timeB) * 1000.0);
 	ANKI_TEST_EXPECT_EQ(sum.get(), serialFib);
 }