Compare commits

..

2 Commits

Author SHA1 Message Date
starkwj
cea31d16fb add readme 2026-02-12 11:13:26 +08:00
starkwj
01bafad6d0 add vxpu 2026-02-12 11:08:07 +08:00
2 changed files with 5 additions and 4 deletions

View File

@@ -34,7 +34,9 @@ static inline std::string get_shm_name() {
} }
static constexpr uint32_t heartbeat_us = 1000; // microseconds static constexpr uint32_t heartbeat_us = 1000; // microseconds
static constexpr uint32_t heartbeat_timeout_us = 20 * heartbeat_us; static constexpr uint32_t heartbeat_check_everyN = 50;
static constexpr uint32_t heartbeat_timeout_us =
heartbeat_check_everyN * heartbeat_us;
struct alignas(64) WorkerHeartBeat { struct alignas(64) WorkerHeartBeat {
std::atomic<uint64_t> timestamp; std::atomic<uint64_t> timestamp;

View File

@@ -51,17 +51,16 @@ void ShmManager::set_xpu_info(int device_id, uint32_t xpu_pci_addr,
void ShmManager::run_busy_loop() { void ShmManager::run_busy_loop() {
spdlog::info("ShmManager busy loop started"); spdlog::info("ShmManager busy loop started");
int heart_beat_check_everyN = 20;
int loop_cnt = 0; int loop_cnt = 0;
while (!stop_loop_flag.load(std::memory_order_acquire)) { while (!stop_loop_flag.load(std::memory_order_acquire)) {
process_requests(); process_requests();
if (loop_cnt % heart_beat_check_everyN == 0) { if (loop_cnt % heartbeat_check_everyN== 0) {
check_heart_beats(); check_heart_beats();
} }
loop_cnt = (loop_cnt + 1) % heartbeat_check_everyN;
loop_cnt = (loop_cnt + 1) % heart_beat_check_everyN;
usleep(heartbeat_us); usleep(heartbeat_us);
} }