Browse Source

chore(mbg/core): add MGB_WORKER_SHORT_SPIN env variable to set short spin

GitOrigin-RevId: c757dc36d3
tags/v1.1.0
Megvii Engine Team 5 years ago
parent
commit
4f9948d00c
1 changed files with 6 additions and 0 deletions
  1. +6
    -0
      src/core/impl/utils/thread.cpp

+ 6
- 0
src/core/impl/utils/thread.cpp View File

@@ -80,6 +80,12 @@ size_t SCQueueSynchronizer::max_spin() {
return cached_max_spin = std::numeric_limits<size_t>::max();
}

if (auto spin_string = MGB_GETENV("MGB_WORKER_MAX_SPIN")) {
auto spin = std::stoi(spin_string);
mgb_log_warn("worker would execute with spin of %d", spin);
return cached_max_spin = spin;
}

std::atomic_bool start{false}, stop{false};
size_t cnt;
double cnt_time;


Loading…
Cancel
Save