blob: 374cee9ffb37b461719702a959ecc0437856688d (
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
|
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#pragma once
#include <vespa/vespalib/stllike/hash_map.h>
#include <vespa/vespalib/util/time.h>
#include <optional>
namespace proton::flushengine {
/**
* Tracks the oldest start time of active (ongoing) flushes in each flush handler.
*/
class ActiveFlushStats {
public:
using OptionalTime = std::optional<vespalib::system_time>;
private:
using StatsMap = vespalib::hash_map<vespalib::string, vespalib::system_time>;
StatsMap _stats;
public:
ActiveFlushStats();
/**
* Set the start time for a flush in the given flush handler.
* A start time is only updated if it is older than the current oldest one.
*/
void set_start_time(const vespalib::string& handler_name, vespalib::system_time start_time);
OptionalTime oldest_start_time(const vespalib::string& handler_name) const;
};
}
|