blob: 6700ee410e910ffcc3ff2b1b3c8ed6e95145b57a (
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
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
|
// Copyright Epic Games, Inc. All Rights Reserved.
#pragma once
#include "../zen.h"
namespace zen {
class BenchPurgeSubCmd : public ZenSubCmdBase
{
public:
BenchPurgeSubCmd();
void Run(const ZenCliOptions& GlobalOptions) override;
private:
bool m_SingleProcess = false;
};
class BenchHttpSubCmd : public ZenSubCmdBase
{
public:
BenchHttpSubCmd();
void Run(const ZenCliOptions& GlobalOptions) override;
private:
void RunFixedCount(const std::string& BaseUri, const std::string& Path);
void RunContinuous(const std::string& BaseUri, const std::string& Path);
std::string m_Url;
std::string m_SocketPath;
int m_Count = 100;
int m_Concurrency = 1;
std::string m_Method = "GET";
bool m_NoKeepAlive = false;
bool m_Continuous = false;
};
class BenchCommand : public ZenCmdWithSubCommands
{
public:
static constexpr char Name[] = "bench";
static constexpr char Description[] = "Utility command for benchmarking";
BenchCommand();
~BenchCommand();
cxxopts::Options& Options() override { return m_Options; }
ZenCmdCategory& CommandCategory() const override { return g_UtilitiesCategory; }
private:
cxxopts::Options m_Options{Name, Description};
std::string m_SubCommand;
BenchPurgeSubCmd m_PurgeSubCmd;
BenchHttpSubCmd m_HttpSubCmd;
};
} // namespace zen
|