aboutsummaryrefslogtreecommitdiffstats
path: root/searchcore/src/vespa/searchcore/proton/test/executor_observer.h
blob: 19f723ad9f96c84f445ca3314e2be9c7bdb39692 (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
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#pragma once

#include <vespa/vespalib/util/executor.h>

namespace proton::test {

class ExecutorObserver : public vespalib::Executor
{
private:
    vespalib::Executor &_executor;
    uint32_t _executeCnt;

public:
    ExecutorObserver(vespalib::Executor &executor)
        : _executor(executor),
          _executeCnt(0)
    {}

    uint32_t getExecuteCnt() const { return _executeCnt; }

    // Implements vespalib::Executor
    virtual Task::UP execute(Task::UP task) override {
        ++_executeCnt;
        return _executor.execute(std::move(task));
    }
};

}