Mercurial > hg > orthanc
comparison OrthancServer/Plugins/Engine/OrthancPluginDatabaseV4.cpp @ 5493:b3ebe249ed5b pg-transactions
At startup, when using a database plugin, display the latency to access the DB
author | Alain Mazy <am@osimis.io> |
---|---|
date | Mon, 15 Jan 2024 18:25:08 +0100 |
parents | dceed5e3d6a9 |
children | 4dd50c4b985a |
comparison
equal
deleted
inserted
replaced
5492:26877f4b306f | 5493:b3ebe249ed5b |
---|---|
1291 errorDictionary_(errorDictionary), | 1291 errorDictionary_(errorDictionary), |
1292 definition_(database), | 1292 definition_(database), |
1293 serverIdentifier_(serverIdentifier), | 1293 serverIdentifier_(serverIdentifier), |
1294 open_(false), | 1294 open_(false), |
1295 databaseVersion_(0), | 1295 databaseVersion_(0), |
1296 dbCapabilities_(false, false, false, false, false) // updated in Open() | 1296 dbCapabilities_(false, false, false, false, false, false) // updated in Open() |
1297 { | 1297 { |
1298 CLOG(INFO, PLUGINS) << "Identifier of this Orthanc server for the global properties " | 1298 CLOG(INFO, PLUGINS) << "Identifier of this Orthanc server for the global properties " |
1299 << "of the custom database: \"" << serverIdentifier << "\""; | 1299 << "of the custom database: \"" << serverIdentifier << "\""; |
1300 | 1300 |
1301 if (definition_.backend == NULL || | 1301 if (definition_.backend == NULL || |
1366 dbCapabilities_.hasFlushToDisk_ = systemInfo.supports_flush_to_disk(); | 1366 dbCapabilities_.hasFlushToDisk_ = systemInfo.supports_flush_to_disk(); |
1367 dbCapabilities_.hasRevisionsSupport_ = systemInfo.supports_revisions(); | 1367 dbCapabilities_.hasRevisionsSupport_ = systemInfo.supports_revisions(); |
1368 dbCapabilities_.hasLabelsSupport_ = systemInfo.supports_labels(); | 1368 dbCapabilities_.hasLabelsSupport_ = systemInfo.supports_labels(); |
1369 dbCapabilities_.hasAtomicIncrementGlobalProperty_ = systemInfo.supports_increment_global_property(); | 1369 dbCapabilities_.hasAtomicIncrementGlobalProperty_ = systemInfo.supports_increment_global_property(); |
1370 dbCapabilities_.hasUpdateAndGetStatistics_ = systemInfo.has_update_and_get_statistics(); | 1370 dbCapabilities_.hasUpdateAndGetStatistics_ = systemInfo.has_update_and_get_statistics(); |
1371 dbCapabilities_.hasMeasureLatency_ = systemInfo.has_measure_latency(); | |
1371 } | 1372 } |
1372 | 1373 |
1373 open_ = true; | 1374 open_ = true; |
1374 } | 1375 } |
1375 | 1376 |
1464 } | 1465 } |
1465 } | 1466 } |
1466 } | 1467 } |
1467 | 1468 |
1468 | 1469 |
1470 uint64_t OrthancPluginDatabaseV4::MeasureLatency() | |
1471 { | |
1472 if (!open_) | |
1473 { | |
1474 throw OrthancException(ErrorCode_BadSequenceOfCalls); | |
1475 } | |
1476 else | |
1477 { | |
1478 try | |
1479 { | |
1480 DatabasePluginMessages::DatabaseRequest request; | |
1481 DatabasePluginMessages::DatabaseResponse response; | |
1482 | |
1483 ExecuteDatabase(response, *this, DatabasePluginMessages::OPERATION_MEASURE_LATENCY, request); | |
1484 return response.measure_latency().latency_us(); | |
1485 | |
1486 } | |
1487 catch (OrthancException& e) | |
1488 { | |
1489 throw; | |
1490 } | |
1491 } | |
1492 } | |
1493 | |
1469 const IDatabaseWrapper::Capabilities& OrthancPluginDatabaseV4::GetDatabaseCapabilities() const | 1494 const IDatabaseWrapper::Capabilities& OrthancPluginDatabaseV4::GetDatabaseCapabilities() const |
1470 { | 1495 { |
1471 if (!open_) | 1496 if (!open_) |
1472 { | 1497 { |
1473 throw OrthancException(ErrorCode_BadSequenceOfCalls); | 1498 throw OrthancException(ErrorCode_BadSequenceOfCalls); |