aboutsummaryrefslogtreecommitdiffstats
path: root/yt/cpp/mapreduce/client/operation_tracker.h
blob: 9f1504ea910bbdbd7369c2db5d34228d7d997c2d (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
#pragma once

#include <yt/cpp/mapreduce/interface/operation.h>

#include <util/datetime/base.h>
#include <util/generic/hash.h>
#include <util/generic/maybe.h>
#include <util/system/mutex.h>

namespace NYT {

////////////////////////////////////////////////////////////////////////////////

class TOperationExecutionTimeTracker {
public:
    void Start(const TOperationId& operationId);
    TMaybe<TDuration> Finish(const TOperationId& operationId);
    static TOperationExecutionTimeTracker* Get();

private:
    THashMap<TOperationId, TInstant> StartTimes_;
    TMutex Lock_;
};

////////////////////////////////////////////////////////////////////////////////

} // namespace NYT