From 2cb6609c2f9fec73ac67faaeb32bce13c7316f0d Mon Sep 17 00:00:00 2001 From: Arne Juul Date: Mon, 15 Feb 2021 14:00:16 +0000 Subject: use size literals in fbench --- fbench/src/fbench/fbench.cpp | 3 ++- fbench/src/httpclient/httpclient.cpp | 9 +++++---- fbench/src/util/filereader.cpp | 3 ++- 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 #include #include +#include #include "client.h" #include "fbench.h" #include @@ -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 +#include #include #include #include @@ -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 #include +#include 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), -- cgit v1.2.3