proxygen
Main Page
Related Pages
Namespaces
Classes
Files
Examples
File List
File Members
Main.cpp
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2015-present, Facebook, Inc.
3
* All rights reserved.
4
*
5
* This source code is licensed under the BSD-style license found in the
6
* LICENSE file in the root directory of this source tree. An additional grant
7
* of patent rights can be found in the PATENTS file in the same directory.
8
*
9
*/
10
#include <
folly/init/Init.h
>
11
#include <
folly/portability/GFlags.h
>
12
13
#include "
proxygen/lib/http/codec/compress/experimental/simulator/CompressionSimulator.h
"
14
#include <
proxygen/lib/http/codec/compress/HPACKEncoder.h
>
15
#include <
proxygen/lib/http/codec/compress/HPACKHeader.h
>
16
17
DEFINE_string
(input,
""
,
"File containing requests"
);
18
DEFINE_string
(scheme,
19
"qpack"
,
20
"Scheme: <qpack|qmin|hpack>"
);
21
22
DEFINE_int32
(rtt, 100,
"Simulated RTT"
);
23
DEFINE_double
(lossp, 0.0,
"Loss Probability"
);
24
DEFINE_double
(delayp, 0.05,
"Delay Probability"
);
25
DEFINE_int32
(delay, 100,
"Max extra delay"
);
26
DEFINE_int32
(ooo_thresh, 0,
"First seqn to allow ooo"
);
27
DEFINE_int32
(table_size, 4096,
"HPACK dynamic table size"
);
28
DEFINE_int64
(
seed
, 0,
"RNG seed"
);
29
DEFINE_bool
(blend,
true
,
"Blend all facebook.com and fbcdn.net domains"
);
30
DEFINE_int32
(max_blocking, 100,
31
"Maximum number of vulnerable/blocking header blocks"
);
32
DEFINE_bool
(same_packet_compression,
33
true
,
34
"Allow QPACK to compress across "
35
"headers the same packet"
);
36
37
using namespace
proxygen::compress
;
38
39
int
main
(
int
argc,
char
*
argv
[]) {
40
folly::init
(&argc, &argv,
true
);
41
if
(FLAGS_same_packet_compression) {
42
LOG(WARNING) <<
"Same packet compression no longer supported"
;
43
}
44
45
if
(FLAGS_input.empty()) {
46
LOG(ERROR) <<
"Must supply a filename"
;
47
return
1;
48
}
49
50
SchemeType
t
=
SchemeType::QPACK
;
51
if
(FLAGS_scheme ==
"qpack"
) {
52
LOG(INFO) <<
"Using QPACK"
;
53
t =
SchemeType::QPACK
;
54
}
else
if
(FLAGS_scheme ==
"qmin"
) {
55
LOG(INFO) <<
"Using QMIN"
;
56
t =
SchemeType::QMIN
;
57
}
else
if
(FLAGS_scheme ==
"hpack"
) {
58
LOG(INFO) <<
"Using HPACK with table size="
<< FLAGS_table_size;
59
t =
SchemeType::HPACK
;
60
}
else
{
61
LOG(ERROR) <<
"Unsupported scheme"
;
62
return
1;
63
}
64
65
if
(FLAGS_seed == 0) {
66
FLAGS_seed =
folly::Random::rand64
();
67
std::cout <<
"Seed: "
<< FLAGS_seed << std::endl;
68
}
69
SimParams
p{
t
,
70
FLAGS_seed,
71
std::chrono::milliseconds(FLAGS_rtt),
72
FLAGS_lossp,
73
FLAGS_delayp,
74
std::chrono::milliseconds(FLAGS_delay),
75
uint16_t
(FLAGS_ooo_thresh),
76
FLAGS_blend,
77
FLAGS_same_packet_compression,
78
uint32_t
(FLAGS_table_size),
79
uint32_t
(FLAGS_max_blocking)};
80
CompressionSimulator
sim(p);
81
if
(sim.
readInputFromFileAndSchedule
(FLAGS_input)) {
82
sim.
run
();
83
}
84
85
return
0;
86
}
proxygen::compress::SchemeType
SchemeType
Definition:
CompressionTypes.h:15
proxygen::compress::SchemeType::QPACK
HPACKEncoder.h
proxygen::compress::CompressionSimulator::readInputFromFileAndSchedule
bool readInputFromFileAndSchedule(const std::string &filename)
Definition:
CompressionSimulator.cpp:36
seed
static const int seed
Definition:
FBStringBenchmark.cpp:37
proxygen::compress::SimParams
Definition:
CompressionTypes.h:28
DEFINE_string
DEFINE_string(input,"","File containing requests")
DEFINE_bool
DEFINE_bool(blend, true,"Blend all facebook.com and fbcdn.net domains")
DEFINE_double
DEFINE_double(lossp, 0.0,"Loss Probability")
DEFINE_int32
DEFINE_int32(rtt, 100,"Simulated RTT")
HPACKHeader.h
main
int main(int argc, char **argv)
Definition:
Main.cpp:27
folly::init
void init(int *argc, char ***argv, bool removeFlags)
Definition:
Init.cpp:34
argv
char ** argv
Definition:
SmallLocksBenchmark.cpp:430
proxygen::compress
Definition:
CompressionScheme.h:16
CompressionSimulator.h
proxygen::compress::CompressionSimulator
Definition:
CompressionSimulator.h:23
DEFINE_int64
DEFINE_int64(seed, 0,"RNG seed")
proxygen::compress::SchemeType::HPACK
proxygen::compress::CompressionSimulator::run
void run()
Definition:
CompressionSimulator.cpp:73
uint32_t
uint32_t
Definition:
ConstexprMathBenchmark.cpp:186
uint16_t
uint16_t
Definition:
ConstexprMathBenchmark.cpp:182
folly::pushmi::detail::t
requires Tuple && t
Definition:
extension_operators.h:48
folly::Random::rand64
static uint64_t rand64()
Definition:
Random.h:263
proxygen::compress::SchemeType::QMIN
GFlags.h
Init.h
proxygen
lib
http
codec
compress
experimental
simulator
Main.cpp
Generated by
1.8.11