MCPcopy Create free account
hub / github.com/SakuraEngine/SakuraEngine / process_logs

Method process_logs

modules/core/core/src/core/log/log_worker.cpp:217–247  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

215}
216
217void LogWorker::process_logs() SKR_NOEXCEPT
218{
219 LogManager::Get()->tscns_.calibrate();
220 LogElement e;
221
222 // try flush
223 while (auto flush_tok = queue_->query_flushing())
224 {
225 SKR_ASSERT(flush_tok->query_status() == kFlushing);
226 while (queue_->try_dequeue_from(flush_tok, e))
227 {
228 patternAndSink(e);
229 }
230 SKR_ASSERT(flush_tok->query_cnt() == 0);
231 skr_atomic32_cas_relaxed(&flush_tok->flush_status_, kFlushing, kFlushed);
232 }
233
234 // normal polling
235 const uint32_t N = 16; // avoid too many logs in one cycle
236 uint32_t n = 0;
237 while (queue_->try_dequeue(e))
238 {
239 patternAndSink(e);
240
241 n++;
242 if (n >= N) break;
243 }
244
245 // flush sinks
246 LogManager::Get()->FlushAllSinks();
247}
248
249void LogWorker::flush(SThreadID tid) SKR_NOEXCEPT
250{

Callers

nothing calls this directly

Calls 9

skr_atomic32_cas_relaxedFunction · 0.85
calibrateMethod · 0.80
query_flushingMethod · 0.80
query_statusMethod · 0.80
try_dequeue_fromMethod · 0.80
query_cntMethod · 0.80
FlushAllSinksMethod · 0.80
GetFunction · 0.50
try_dequeueMethod · 0.45

Tested by

no test coverage detected