forked from envoyproxy/nighthawk
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathclient_worker_impl.h
75 lines (59 loc) · 2.51 KB
/
client_worker_impl.h
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
#pragma once
#include <vector>
#include "envoy/api/api.h"
#include "envoy/event/dispatcher.h"
#include "envoy/stats/store.h"
#include "envoy/thread_local/thread_local.h"
#include "envoy/upstream/cluster_manager.h"
#include "nighthawk/client/benchmark_client.h"
#include "nighthawk/client/client_worker.h"
#include "nighthawk/client/factories.h"
#include "nighthawk/common/factories.h"
#include "nighthawk/common/phase.h"
#include "nighthawk/common/request_source.h"
#include "nighthawk/common/sequencer.h"
#include "nighthawk/common/termination_predicate.h"
#include "common/worker_impl.h"
namespace Nighthawk {
namespace Client {
class ClientWorkerImpl : public WorkerImpl, virtual public ClientWorker {
public:
enum class HardCodedWarmupStyle { OFF, ON };
ClientWorkerImpl(Envoy::Api::Api& api, Envoy::ThreadLocal::Instance& tls,
Envoy::Upstream::ClusterManagerPtr& cluster_manager,
const BenchmarkClientFactory& benchmark_client_factory,
const TerminationPredicateFactory& termination_predicate_factory,
const SequencerFactory& sequencer_factory,
const RequestSourceFactory& request_generator_factory,
Envoy::Stats::Store& store, const int worker_number,
const Envoy::MonotonicTime starting_time,
Envoy::Tracing::HttpTracerSharedPtr& http_tracer,
const HardCodedWarmupStyle hardcoded_warmup_style);
StatisticPtrMap statistics() const override;
const std::map<std::string, uint64_t>& threadLocalCounterValues() override {
return threadLocalCounterValues_;
}
const Phase& phase() const override { return *phase_; }
void shutdownThread() override;
void requestExecutionCancellation() override;
protected:
void work() override;
private:
void simpleWarmup();
std::unique_ptr<Envoy::TimeSource> time_source_;
const TerminationPredicateFactory& termination_predicate_factory_;
const SequencerFactory& sequencer_factory_;
Envoy::Stats::ScopePtr worker_scope_;
Envoy::Stats::ScopePtr worker_number_scope_;
const int worker_number_;
Envoy::Tracing::HttpTracerSharedPtr& http_tracer_;
RequestSourcePtr request_generator_;
BenchmarkClientPtr benchmark_client_;
PhasePtr phase_;
Envoy::LocalInfo::LocalInfoPtr local_info_;
std::map<std::string, uint64_t> threadLocalCounterValues_;
const HardCodedWarmupStyle hardcoded_warmup_style_;
};
using ClientWorkerImplPtr = std::unique_ptr<ClientWorkerImpl>;
} // namespace Client
} // namespace Nighthawk