wip: name os threads
This commit is contained in:
@ -16,6 +16,7 @@
|
||||
#include "octree.hpp"
|
||||
|
||||
#ifndef WEB
|
||||
#define BS_THREAD_POOL_NATIVE_EXTENSIONS
|
||||
#include <BS_thread_pool.hpp>
|
||||
#endif
|
||||
|
||||
@ -67,7 +68,8 @@ public:
|
||||
std::vector<Spring> springs;
|
||||
|
||||
public:
|
||||
MassSpringSystem() : threads(std::thread::hardware_concurrency() - 1) {
|
||||
MassSpringSystem()
|
||||
: threads(std::thread::hardware_concurrency() - 1, SetThreadName) {
|
||||
std::cout << "Using Barnes-Hut + octree repulsion force calculation."
|
||||
<< std::endl;
|
||||
|
||||
@ -83,6 +85,8 @@ public:
|
||||
MassSpringSystem &operator=(MassSpringSystem &&move) = delete;
|
||||
|
||||
private:
|
||||
static auto SetThreadName(std::size_t idx) -> void;
|
||||
|
||||
auto BuildOctree() -> void;
|
||||
|
||||
public:
|
||||
|
||||
@ -20,6 +20,8 @@
|
||||
// - Click states to display them in the board
|
||||
// - Find shortest path to any winning state and mark it in the graph
|
||||
// - Also mark the next move along the path on the board
|
||||
// TODO: Do I have a huge memory leak or is the memory just not reclaimed from
|
||||
// the C++ runtime?
|
||||
|
||||
auto main(int argc, char *argv[]) -> int {
|
||||
// if (argc < 2) {
|
||||
|
||||
@ -2,6 +2,7 @@
|
||||
#include "config.hpp"
|
||||
#include "tracy.hpp"
|
||||
|
||||
#include <BS_thread_pool.hpp>
|
||||
#include <algorithm>
|
||||
#include <cfloat>
|
||||
#include <cstddef>
|
||||
@ -108,6 +109,10 @@ auto MassSpringSystem::CalculateSpringForces() -> void {
|
||||
}
|
||||
}
|
||||
|
||||
auto MassSpringSystem::SetThreadName(std::size_t idx) -> void {
|
||||
BS::this_thread::set_os_thread_name(std::format("bh-worker-{}", idx));
|
||||
}
|
||||
|
||||
auto MassSpringSystem::BuildOctree() -> void {
|
||||
ZoneScoped;
|
||||
|
||||
@ -175,6 +180,8 @@ auto MassSpringSystem::VerletUpdate(float delta_time) -> void {
|
||||
|
||||
auto ThreadedPhysics::PhysicsThread(ThreadedPhysics::PhysicsState &state)
|
||||
-> void {
|
||||
BS::this_thread::set_os_thread_name("physics");
|
||||
|
||||
MassSpringSystem mass_springs;
|
||||
|
||||
const auto visitor = overloads{
|
||||
|
||||
Reference in New Issue
Block a user