Compare commits

..

2 Commits

Author SHA1 Message Date
starkwj
9c3e9df634 add readme 2026-02-12 10:46:37 +08:00
starkwj
e273ef01b8 add vxpu 2026-02-12 10:46:37 +08:00
2 changed files with 4 additions and 5 deletions

View File

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

View File

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