blob: c7f3a340c1b7e9009ccd75b9b3c7b656dff29dfe (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#include "job_tracker.h"
namespace proton {
JobTracker::JobTracker(time_point now, std::mutex &lock)
: _sampler(now),
_lock(lock)
{
}
double
JobTracker::sampleLoad(time_point now, const std::lock_guard<std::mutex> &guard)
{
(void) guard;
return _sampler.sampleLoad(now);
}
void
JobTracker::start()
{
std::lock_guard<std::mutex> guard(_lock);
_sampler.startJob(std::chrono::steady_clock::now());
}
void
JobTracker::end()
{
std::lock_guard<std::mutex> guard(_lock);
_sampler.endJob(std::chrono::steady_clock::now());
}
} // namespace proton
|