Page MenuHomePhabricator

D5112.id16653.diff
No OneTemporary

D5112.id16653.diff

diff --git a/services/lib/src/GlobalTools.h b/services/lib/src/GlobalTools.h
--- a/services/lib/src/GlobalTools.h
+++ b/services/lib/src/GlobalTools.h
@@ -13,6 +13,8 @@
bool hasEnvFlag(const std::string &flag);
+size_t getNumberOfCores();
+
std::string decorateTableName(const std::string &baseName);
bool isSandbox();
diff --git a/services/lib/src/GlobalTools.cpp b/services/lib/src/GlobalTools.cpp
--- a/services/lib/src/GlobalTools.cpp
+++ b/services/lib/src/GlobalTools.cpp
@@ -10,6 +10,8 @@
#include <iomanip>
#include <regex>
#include <string>
+#include <thread>
+#include <algorithm>
namespace comm {
namespace network {
@@ -28,6 +30,10 @@
return std::string(std::getenv(flag.c_str())) == "1";
}
+size_t getNumberOfCores() {
+ return (size_t)std::max((unsigned int)1, std::thread::hardware_concurrency());
+}
+
std::string decorateTableName(const std::string &baseName) {
std::string suffix = "";
if (hasEnvFlag("COMM_TEST_SERVICES")) {

File Metadata

Mime Type
text/plain
Expires
Wed, Nov 6, 9:40 PM (22 h, 12 s)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2432636
Default Alt Text
D5112.id16653.diff (975 B)

Event Timeline