Compare commits
2 Commits
cea31d16fb
...
9c3e9df634
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9c3e9df634 | ||
|
|
e273ef01b8 |
@@ -34,9 +34,7 @@ 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_check_everyN = 50;
|
static constexpr uint32_t heartbeat_timeout_us = 20 * heartbeat_us;
|
||||||
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;
|
||||||
|
|||||||
@@ -51,16 +51,17 @@ 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 % heartbeat_check_everyN== 0) {
|
if (loop_cnt % heart_beat_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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user