comparison OrthancServer/ServerIndex.cpp @ 238:e4148b0ab1d0

statistics URI
author Sebastien Jodogne <s.jodogne@gmail.com>
date Fri, 30 Nov 2012 16:09:24 +0100
parents 16a4ac70bd8a
children 30887f3593dd
comparison
equal deleted inserted replaced
237:16a4ac70bd8a 238:e4148b0ab1d0
348 348
349 return StoreStatus_Failure; 349 return StoreStatus_Failure;
350 } 350 }
351 351
352 352
353 uint64_t ServerIndex::GetTotalCompressedSize() 353 void ServerIndex::ComputeStatistics(Json::Value& target)
354 { 354 {
355 boost::mutex::scoped_lock lock(mutex_); 355 boost::mutex::scoped_lock lock(mutex_);
356 return db_->GetTotalCompressedSize(); 356 target = Json::objectValue;
357 } 357
358 358 uint64_t cs = db_->GetTotalCompressedSize();
359 uint64_t ServerIndex::GetTotalUncompressedSize() 359 uint64_t us = db_->GetTotalUncompressedSize();
360 { 360 target["TotalDiskSize"] = boost::lexical_cast<std::string>(cs);
361 boost::mutex::scoped_lock lock(mutex_); 361 target["TotalUncompressedSize"] = boost::lexical_cast<std::string>(us);
362 return db_->GetTotalUncompressedSize(); 362 target["TotalDiskSizeMB"] = boost::lexical_cast<unsigned int>(cs / (1024llu * 1024llu));
363 } 363 target["TotalUncompressedSizeMB"] = boost::lexical_cast<unsigned int>(us / (1024llu * 1024llu));
364
365 target["CountPatients"] = static_cast<unsigned int>(db_->GetResourceCount(ResourceType_Patient));
366 target["CountStudies"] = static_cast<unsigned int>(db_->GetResourceCount(ResourceType_Study));
367 target["CountSeries"] = static_cast<unsigned int>(db_->GetResourceCount(ResourceType_Series));
368 target["CountInstances"] = static_cast<unsigned int>(db_->GetResourceCount(ResourceType_Instance));
369 }
370
364 371
365 372
366 SeriesStatus ServerIndex::GetSeriesStatus(int id) 373 SeriesStatus ServerIndex::GetSeriesStatus(int id)
367 { 374 {
368 // Get the expected number of instances in this series (from the metadata) 375 // Get the expected number of instances in this series (from the metadata)