Mercurial > hg > orthanc
comparison Core/JobsEngine/JobsRegistry.cpp @ 3177:053e72ff9fc5
new metrics: orthanc_jobs_[pending|running|completed]
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Wed, 30 Jan 2019 10:24:12 +0100 |
parents | 94a4f75cc746 |
children | fca730c267d7 |
comparison
equal
deleted
inserted
replaced
3176:784bbb03fb54 | 3177:053e72ff9fc5 |
---|---|
1396 assert(found->second != NULL); | 1396 assert(found->second != NULL); |
1397 found->second->SetLastStateChangeTime(lastChangeTime); | 1397 found->second->SetLastStateChangeTime(lastChangeTime); |
1398 } | 1398 } |
1399 } | 1399 } |
1400 } | 1400 } |
1401 | |
1402 | |
1403 void JobsRegistry::GetStatistics(unsigned int& pending, | |
1404 unsigned int& running, | |
1405 unsigned int& completed) | |
1406 { | |
1407 boost::mutex::scoped_lock lock(mutex_); | |
1408 CheckInvariants(); | |
1409 | |
1410 pending = 0; | |
1411 running = 0; | |
1412 completed = 0; | |
1413 | |
1414 for (JobsIndex::const_iterator it = jobsIndex_.begin(); | |
1415 it != jobsIndex_.end(); ++it) | |
1416 { | |
1417 JobHandler& job = *it->second; | |
1418 | |
1419 switch (job.GetState()) | |
1420 { | |
1421 case JobState_Retry: | |
1422 case JobState_Paused: | |
1423 case JobState_Pending: | |
1424 pending ++; | |
1425 break; | |
1426 | |
1427 case JobState_Running: | |
1428 running ++; | |
1429 break; | |
1430 | |
1431 case JobState_Success: | |
1432 case JobState_Failure: | |
1433 completed ++; | |
1434 break; | |
1435 | |
1436 default: | |
1437 throw OrthancException(ErrorCode_InternalError); | |
1438 } | |
1439 } | |
1440 } | |
1401 } | 1441 } |