| 268 | } |
| 269 | |
| 270 | void DbConnection::LogStatsHandler() |
| 271 | { |
| 272 | if (!GetConnected() || IsPaused()) |
| 273 | return; |
| 274 | |
| 275 | auto pending = m_PendingQueries.load(); |
| 276 | |
| 277 | auto now = Utility::GetTime(); |
| 278 | bool timeoutReached = m_LogStatsTimeout < now; |
| 279 | |
| 280 | if (pending == 0u && !timeoutReached) { |
| 281 | return; |
| 282 | } |
| 283 | |
| 284 | auto output = round(m_OutputQueries.CalculateRate(now, 10)); |
| 285 | |
| 286 | if (pending < output * 5 && !timeoutReached) { |
| 287 | return; |
| 288 | } |
| 289 | |
| 290 | auto input = round(m_InputQueries.CalculateRate(now, 10)); |
| 291 | |
| 292 | Log(LogInformation, GetReflectionType()->GetName()) |
| 293 | << "Pending queries: " << pending << " (Input: " << input |
| 294 | << "/s; Output: " << output << "/s)"; |
| 295 | |
| 296 | /* Reschedule next log entry in 5 minutes. */ |
| 297 | if (timeoutReached) { |
| 298 | m_LogStatsTimeout = now + 60 * 5; |
| 299 | } |
| 300 | } |
| 301 | |
| 302 | void DbConnection::CleanUpExecuteQuery(const String&, const String&, double) |
| 303 | { |
nothing calls this directly
no test coverage detected