Commit 1eb2769b authored by Jørgen Lind's avatar Jørgen Lind
Browse files

Implement GetCompletionFactor

parent 7898591f
......@@ -310,7 +310,7 @@ void VolumeDataAccessManagerImpl::Cancel(int64_t requestID)
}
float VolumeDataAccessManagerImpl::GetCompletionFactor(int64_t requestID)
{
return 0.0f;
return m_requestProcessor.GetCompletionFactor(requestID);
}
static MetadataManager *GetMetadataMangerForLayer(LayerMetadataContainer const &container, const std::string &layer)
......
......@@ -283,6 +283,15 @@ void VolumeDataRequestProcessor::Cancel(int64_t jobID)
job_it->get()->cancelled = true;
}
float VolumeDataRequestProcessor::GetCompletionFactor(int64_t jobID)
{
std::unique_lock<std::mutex> lock(m_mutex);
auto job_it = std::find_if(m_jobs.begin(), m_jobs.end(), [jobID](std::unique_ptr<Job> &job) { return job->jobId == jobID; });
if (job_it == m_jobs.end())
return 0.f;
return float(job_it->get()->completed) / float(job_it->get()->pages.size());
}
int VolumeDataRequestProcessor::CountActivePages()
{
std::unique_lock<std::mutex> lock(m_mutex);
......
......@@ -86,6 +86,7 @@ public:
bool IsCanceled(int64_t requestID);
bool WaitForCompletion(int64_t requestID, int millisecondsBeforeTimeout = 0);
void Cancel(int64_t requestID);
float GetCompletionFactor(int64_t requestID);
int CountActivePages();
private:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment