blob: 365ca0d93b2b102f16094c2e4ef30009853a8602 (
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 Yahoo. 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
|