summaryrefslogtreecommitdiffstats
path: root/fbench
diff options
context:
space:
mode:
authorArne Juul <arnej@verizonmedia.com>2021-02-15 14:00:16 +0000
committerArne Juul <arnej@verizonmedia.com>2021-02-15 14:16:24 +0000
commit2cb6609c2f9fec73ac67faaeb32bce13c7316f0d (patch)
treeea3a9a2014ad1213ecfe7f3697c470b4a690a563 /fbench
parente22d5ee57d65ead53263c0e48e802fcfb5f21950 (diff)
use size literals in fbench
Diffstat (limited to 'fbench')
-rw-r--r--fbench/src/fbench/fbench.cpp3
-rw-r--r--fbench/src/httpclient/httpclient.cpp9
-rw-r--r--fbench/src/util/filereader.cpp3
3 files changed, 9 insertions, 6 deletions
diff --git a/fbench/src/fbench/fbench.cpp b/fbench/src/fbench/fbench.cpp
index b2bdc69eca4..084fc2e48e6 100644
--- a/fbench/src/fbench/fbench.cpp
+++ b/fbench/src/fbench/fbench.cpp
@@ -8,6 +8,7 @@
#include <vespa/vespalib/net/tls/transport_security_options.h>
#include <vespa/vespalib/net/tls/tls_crypto_engine.h>
#include <vespa/vespalib/io/mapped_file_input.h>
+#include <vespa/vespalib/util/size_literals.h>
#include "client.h"
#include "fbench.h"
#include <cstring>
@@ -340,7 +341,7 @@ FBench::Main(int argc, char *argv[])
int byteLimit = 0;
int ignoreCount = 0;
int seconds = 60;
- int maxLineSize = 128 * 1024;
+ int maxLineSize = 128_Ki;
const int minLineSize = 1024;
const char *queryFilePattern = "query%03d.txt";
diff --git a/fbench/src/httpclient/httpclient.cpp b/fbench/src/httpclient/httpclient.cpp
index 2feed087b43..88ae6a0aa81 100644
--- a/fbench/src/httpclient/httpclient.cpp
+++ b/fbench/src/httpclient/httpclient.cpp
@@ -1,6 +1,7 @@
// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#include "httpclient.h"
#include <vespa/vespalib/net/socket_spec.h>
+#include <vespa/vespalib/util/size_literals.h>
#include <util/authority.h>
#include <cassert>
#include <cstring>
@@ -33,7 +34,7 @@ HTTPClient::HTTPClient(vespalib::CryptoEngine::SP engine, const char *hostname,
_sni_spec(make_sni_spec(authority, hostname, port, _engine->use_tls_when_client())),
_host_header_value(make_host_header_value(_sni_spec, _engine->use_tls_when_client())),
_reuseCount(0),
- _bufsize(10240),
+ _bufsize(10_Ki),
_buf(new char[_bufsize]),
_bufused(0),
_bufpos(0),
@@ -201,7 +202,7 @@ bool
HTTPClient::ReadHTTPHeader(std::string & headerinfo)
{
int lineLen;
- char line[4096];
+ char line[4_Ki];
int argc;
char *argv[32];
int i;
@@ -213,7 +214,7 @@ HTTPClient::ReadHTTPHeader(std::string & headerinfo)
_keepAliveGiven = false;
// read and split status line
- if ((lineLen = ReadLine(line, 4096)) <= 0)
+ if ((lineLen = ReadLine(line, 4_Ki)) <= 0)
return false;
SplitString(line, argc, argv, 32);
@@ -232,7 +233,7 @@ HTTPClient::ReadHTTPHeader(std::string & headerinfo)
// printf("HTTP: status: %d\n", _requestStatus);
// read and parse rest of header
- while((lineLen = ReadLine(line, 4096)) > 0) {
+ while((lineLen = ReadLine(line, 4_Ki)) > 0) {
// DEBUG
// printf("HTTP-Header: '%s'\n", line);
diff --git a/fbench/src/util/filereader.cpp b/fbench/src/util/filereader.cpp
index 0cb03a23e9c..9a48f6442a3 100644
--- a/fbench/src/util/filereader.cpp
+++ b/fbench/src/util/filereader.cpp
@@ -2,6 +2,7 @@
#include "filereader.h"
#include <iostream>
#include <unistd.h>
+#include <vespa/vespalib/util/size_literals.h>
int GetOpt (int argc, char *argv[], const char *optionsString,
const char* &optionArgument,
@@ -18,7 +19,7 @@ int GetOpt (int argc, char *argv[], const char *optionsString,
FileReader::FileReader()
: _backing(),
_file(&std::cin),
- _bufsize(1024*1024),
+ _bufsize(1_Mi),
_buf(_bufsize),
_lastReadPos(0),
_nextReadPos(0),