aboutsummaryrefslogtreecommitdiffstats
path: root/vbench/src/vbench/vbench/ignore_before.cpp
blob: ed3833a1ffb49a6c9ee8c208dd1154a39e117681 (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
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.

#include "ignore_before.h"

namespace vbench {

IgnoreBefore::IgnoreBefore(double time, Handler<Request> &next)
    : _next(next),
      _time(time),
      _ignored(0)
{
}

void
IgnoreBefore::handle(Request::UP request)
{
    if (request->startTime() < _time) {
        ++_ignored;
        return;
    }
    _next.handle(std::move(request));
}

void
IgnoreBefore::report()
{
    fprintf(stdout, "ignored %zu requests\n", _ignored);
}

} // namespace vbench