MCPcopy Create free account
hub / github.com/aethersdr/AetherSDR / enqueue

Method enqueue

src/core/AsyncLogWriter.cpp:205–251  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

203}
204
205void AsyncLogWriter::enqueue(QtMsgType type,
206 const QTime& timestamp,
207 const QString& category,
208 const QString& message)
209{
210 {
211 std::lock_guard lock(m_mutex);
212 if (!m_started || !m_accepting)
213 return;
214
215 if (m_queue.size() >= kMaxQueueEntries) {
216 if (isDebugOrInfo(type)) {
217 ++m_counters.droppedDebugInfoLines;
218 ++m_pendingDroppedDebugInfo;
219 m_cv.notify_one();
220 return;
221 }
222
223 auto dropIt = std::find_if(m_queue.begin(), m_queue.end(),
224 [](const QueueItem& item) {
225 return item.kind == ItemKind::Log && isDebugOrInfo(item.log.type);
226 });
227 if (dropIt != m_queue.end()) {
228 m_queue.erase(dropIt);
229 ++m_counters.droppedDebugInfoLines;
230 ++m_pendingDroppedDebugInfo;
231 } else if (m_queue.size() >= kHardMaxQueueEntries) {
232 ++m_counters.droppedHighPriorityLines;
233 ++m_pendingDroppedHighPriority;
234 m_cv.notify_one();
235 return;
236 }
237 }
238
239 QueueItem item;
240 item.kind = ItemKind::Log;
241 item.log.type = type;
242 item.log.timestamp = timestamp;
243 item.log.category = category;
244 item.log.message = message;
245 m_queue.push_back(std::move(item));
246
247 ++m_counters.queuedLines;
248 m_counters.maxQueueDepth = std::max<quint64>(m_counters.maxQueueDepth, m_queue.size());
249 }
250 m_cv.notify_one();
251}
252
253void AsyncLogWriter::flush()
254{

Callers 11

enqueueMessageMethod · 0.45
startMethod · 0.45
encodeMethod · 0.45
scheduleNextMethod · 0.45
mainFunction · 0.45
writeAndReadFunction · 0.45
testStderrMirroringFunction · 0.45

Calls 5

isDebugOrInfoFunction · 0.85
moveFunction · 0.85
beginMethod · 0.80
eraseMethod · 0.80
sizeMethod · 0.45