Changeset 11179 in ntrip for trunk/BNC/src/latencychecker.cpp
- Timestamp:
- Nov 6, 2026, 4:05:20 PM (27 hours ago)
- File:
-
- 1 edited
-
trunk/BNC/src/latencychecker.cpp (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/BNC/src/latencychecker.cpp
r11022 r11179 62 62 connect(this, SIGNAL(newMessage(QByteArray,bool)), 63 63 BNC_CORE, SLOT(slotMessage(const QByteArray,bool))); 64 connect(this, SIGNAL(newLogRecord(t_logRecord,bool)), 65 BNC_CORE, SLOT(slotLogRecord(t_logRecord,bool))); 64 66 65 67 bncSettings settings; … … 177 179 _begDateOut = _endDateTimeOut.toUTC().date().toString("yy-MM-dd"); 178 180 _begTimeOut = _endDateTimeOut.toUTC().time().toString("hh:mm:ss"); 179 emit(newMessage((_staID + ": Failure threshold exceeded, outage since " 180 + _begDateOut + " " + _begTimeOut + " UTC").toLatin1(), true)); 181 _outageSince = _endDateTimeOut.toUTC(); 182 t_logRecord rec(t_logRecord::warning, "stream", "stream_outage_begin", _staID, 183 (_staID + ": Failure threshold exceeded, outage since " 184 + _begDateOut + " " + _begTimeOut + " UTC").toLatin1()); 185 rec.addTime("since", _outageSince); 186 emit newLogRecord(rec, true); 181 187 callScript(("Begin_Outage " 182 188 + _begDateOut + " " + _begTimeOut + " UTC").toLatin1()); … … 256 262 _begDateCorr = _endDateTimeCorr.toUTC().date().toString("yy-MM-dd"); 257 263 _begTimeCorr = _endDateTimeCorr.toUTC().time().toString("hh:mm:ss"); 258 emit(newMessage((_staID + ": Failure threshold exceeded, corrupted since " 259 + _begDateCorr + " " + _begTimeCorr + " UTC").toLatin1(), true)); 264 _corruptSince = _endDateTimeCorr.toUTC(); 265 t_logRecord rec(t_logRecord::warning, "stream", "stream_corrupted_begin", _staID, 266 (_staID + ": Failure threshold exceeded, corrupted since " 267 + _begDateCorr + " " + _begTimeCorr + " UTC").toLatin1()); 268 rec.addTime("since", _corruptSince); 269 emit newLogRecord(rec, true); 260 270 callScript(("Begin_Corrupted " 261 271 + _begDateCorr + " " + _begTimeCorr + " UTC").toLatin1()); … … 276 286 _endDateCorr = _begDateTimeCorr.toUTC().date().toString("yy-MM-dd"); 277 287 _endTimeCorr = _begDateTimeCorr.toUTC().time().toString("hh:mm:ss"); 278 emit(newMessage((_staID + ": Recovery threshold exceeded, corruption ended " 279 + _endDateCorr + " " + _endTimeCorr + " UTC").toLatin1(), true)); 288 t_logRecord rec(t_logRecord::info, "stream", "stream_corrupted_end", _staID, 289 (_staID + ": Recovery threshold exceeded, corruption ended " 290 + _endDateCorr + " " + _endTimeCorr + " UTC").toLatin1()); 291 rec.addTime("ended", _begDateTimeCorr); 292 if (_corruptSince.isValid()) { 293 rec.addTime("since", _corruptSince); 294 } 295 emit newLogRecord(rec, true); 280 296 callScript(("End_Corrupted " 281 297 + _endDateCorr + " " + _endTimeCorr + " UTC Begin was " … … 304 320 _endDateOut = _begDateTimeOut.toUTC().date().toString("yy-MM-dd"); 305 321 _endTimeOut = _begDateTimeOut.toUTC().time().toString("hh:mm:ss"); 306 emit(newMessage((_staID + ": Recovery threshold exceeded, outage ended " 307 + _endDateOut + " " + _endTimeOut + " UTC").toLatin1(), true)); 322 t_logRecord rec(t_logRecord::info, "stream", "stream_outage_end", _staID, 323 (_staID + ": Recovery threshold exceeded, outage ended " 324 + _endDateOut + " " + _endTimeOut + " UTC").toLatin1()); 325 rec.addTime("ended", _begDateTimeOut); 326 if (_outageSince.isValid()) { 327 rec.addTime("since", _outageSince); 328 } 329 emit newLogRecord(rec, true); 308 330 callScript(("End_Outage " 309 331 + _endDateOut + " " + _endTimeOut + " UTC Begin was " … … 331 353 if (l._newSec % (_miscIntr * 10) < l._oldSec % (_miscIntr * 10)) { 332 354 if (l._numLat > 0) { 333 if (l._meanDiff > 0.0) { 334 if ( _checkMountPoint == _staID || _checkMountPoint == "ALL" ) { 335 emit( newMessage(QString("%1 %2: Mean latency %3 sec, min %4, max %5, rms %6, %7 epochs, %8 gaps") 336 .arg(_staID.data()) 337 .arg(l._type.data()) 338 .arg(int(l._sumLat/l._numLat*100)/100., 4, 'f', 2) 339 .arg(int(l._minLat*100)/100., 4, 'f', 2) 340 .arg(int(l._maxLat*100)/100., 4, 'f', 2) 341 .arg(int((sqrt(l._sumLatQ / l._numLat))*100)/100., 4, 'f', 2) 342 .arg(l._numLat) 343 .arg(l._numGaps) 344 .toLatin1(), true) ); 345 } 346 } else { 347 if ( _checkMountPoint == _staID || _checkMountPoint == "ALL" ) { 348 emit( newMessage(QString("%1 %2: Mean latency %3 sec, min %4, max %5, rms %6, %7 epochs") 349 .arg(_staID.data()) 350 .arg(l._type.data()) 351 .arg(int(l._sumLat/l._numLat*100)/100., 4, 'f', 2) 352 .arg(int(l._minLat*100)/100., 4, 'f', 2) 353 .arg(int(l._maxLat*100)/100., 4, 'f', 2) 354 .arg(int((sqrt(l._sumLatQ / l._numLat))*100)/100., 4, 'f', 2) 355 .arg(l._numLat) 356 .toLatin1(), true) ); 357 } 355 if ( _checkMountPoint == _staID || _checkMountPoint == "ALL" ) { 356 emitLatency(l); 358 357 } 359 358 l._meanDiff = l._diffSec / l._numLat; … … 456 455 if (int(l._newSec) % _miscIntr < int(l._oldSec) % _miscIntr) { 457 456 if (l._numLat>0) { 458 QString late; 459 if (l._meanDiff>0.) { 460 late = QString(" %1: Mean latency %2 sec, min %3, max %4, rms %5, %6 epochs, %7 gaps") 461 .arg(l._type.data()) 462 .arg(int(l._sumLat/l._numLat*100)/100., 4, 'f', 2) 463 .arg(int(l._minLat*100)/100., 4, 'f', 2) 464 .arg(int(l._maxLat*100)/100., 4, 'f', 2) 465 .arg(int((sqrt(l._sumLatQ / l._numLat))*100)/100., 4, 'f', 2) 466 .arg(l._numLat) 467 .arg(l._numGaps); 468 if ( _checkMountPoint == _staID || _checkMountPoint == "ALL" ) { 469 emit(newMessage(QString(_staID + late ).toLatin1(), true) ); 470 } 471 } 472 else { 473 late = QString(" %1: Mean latency %2 sec, min %3, max %4, rms %5, %6 epochs") 474 .arg(l._type.data()) 475 .arg(int(l._sumLat/l._numLat*100)/100., 4, 'f', 2) 476 .arg(int(l._minLat*100)/100., 4, 'f', 2) 477 .arg(int(l._maxLat*100)/100., 4, 'f', 2) 478 .arg(int((sqrt(l._sumLatQ / l._numLat))*100)/100., 4, 'f', 2) 479 .arg(l._numLat); 480 if ( _checkMountPoint == _staID || _checkMountPoint == "ALL" ) { 481 emit(newMessage(QString(_staID + late ).toLatin1(), true) ); 482 } 457 if ( _checkMountPoint == _staID || _checkMountPoint == "ALL" ) { 458 emitLatency(l); 483 459 } 484 460 } … … 568 544 } 569 545 } 546 547 // Mean latency message of one interval (classic text unchanged) 548 ////////////////////////////////////////////////////////////////////////////// 549 void latencyChecker::emitLatency(const t_latency& l) { 550 double mean = int(l._sumLat/l._numLat*100)/100.; 551 double min = int(l._minLat*100)/100.; 552 double max = int(l._maxLat*100)/100.; 553 double rms = int((sqrt(l._sumLatQ / l._numLat))*100)/100.; 554 bool gaps = (l._meanDiff > 0.0); 555 QString text = QString("%1 %2: Mean latency %3 sec, min %4, max %5, rms %6, %7 epochs") 556 .arg(_staID.data()) 557 .arg(l._type.data()) 558 .arg(mean, 4, 'f', 2) 559 .arg(min, 4, 'f', 2) 560 .arg(max, 4, 'f', 2) 561 .arg(rms, 4, 'f', 2) 562 .arg(l._numLat); 563 if (gaps) { 564 text += QString(", %1 gaps").arg(l._numGaps); 565 } 566 t_logRecord rec(t_logRecord::info, "stream", "stream_latency", _staID, text.toLatin1()); 567 rec.add("type", l._type) 568 .add("mean", mean, 2) 569 .add("min", min, 2) 570 .add("max", max, 2) 571 .add("rms", rms, 2) 572 .add("epochs", int(l._numLat)); 573 if (gaps) { 574 rec.add("gaps", int(l._numGaps)); 575 } 576 emit newLogRecord(rec, true); 577 }
Note:
See TracChangeset
for help on using the changeset viewer.
