Changeset View
Changeset View
Standalone View
Standalone View
src/util/system.h
Show All 16 Lines | |||||
#include <attributes.h> | #include <attributes.h> | ||||
#include <compat.h> | #include <compat.h> | ||||
#include <compat/assumptions.h> | #include <compat/assumptions.h> | ||||
#include <fs.h> | #include <fs.h> | ||||
#include <logging.h> | #include <logging.h> | ||||
#include <sync.h> | #include <sync.h> | ||||
#include <tinyformat.h> | #include <tinyformat.h> | ||||
#include <util/settings.h> | #include <util/settings.h> | ||||
#include <util/threadnames.h> | |||||
#include <util/time.h> | #include <util/time.h> | ||||
#include <any> | #include <any> | ||||
#include <cstdint> | #include <cstdint> | ||||
#include <exception> | #include <exception> | ||||
#include <map> | #include <map> | ||||
#include <optional> | #include <optional> | ||||
#include <set> | #include <set> | ||||
▲ Show 20 Lines • Show All 436 Lines • ▼ Show 20 Lines | |||||
/** | /** | ||||
* Return the number of cores available on the current system. | * Return the number of cores available on the current system. | ||||
* @note This does count virtual cores, such as those provided by | * @note This does count virtual cores, such as those provided by | ||||
* HyperThreading. | * HyperThreading. | ||||
*/ | */ | ||||
int GetNumCores(); | int GetNumCores(); | ||||
/** | |||||
* .. and a wrapper that just calls func once | |||||
*/ | |||||
template <typename Callable> void TraceThread(const char *name, Callable func) { | |||||
util::ThreadRename(name); | |||||
try { | |||||
LogPrintf("%s thread start\n", name); | |||||
func(); | |||||
LogPrintf("%s thread exit\n", name); | |||||
} catch (const std::exception &e) { | |||||
PrintExceptionContinue(&e, name); | |||||
throw; | |||||
} catch (...) { | |||||
PrintExceptionContinue(nullptr, name); | |||||
throw; | |||||
} | |||||
} | |||||
std::string CopyrightHolders(const std::string &strPrefix); | std::string CopyrightHolders(const std::string &strPrefix); | ||||
/** | /** | ||||
* On platforms that support it, tell the kernel the calling thread is | * On platforms that support it, tell the kernel the calling thread is | ||||
* CPU-intensive and non-interactive. See SCHED_BATCH in sched(7) for details. | * CPU-intensive and non-interactive. See SCHED_BATCH in sched(7) for details. | ||||
* | * | ||||
*/ | */ | ||||
void ScheduleBatchPriority(); | void ScheduleBatchPriority(); | ||||
Show All 40 Lines |