(>10kb). Squashed commit of the following: commit b87fa418b4aca78928186a8fa992bef701e044a4 Author: Ian Roddis <tech@kinesin.ca> Date: Mon Feb 14 12:55:34 2022 -0400 removing memory leak commit 5e284ab92dbea991262a08c0cd50d6fc2f912e3b Author: Ian Roddis <tech@kinesin.ca> Date: Mon Feb 14 11:58:57 2022 -0400 Speeding up serialization, fixing payload sizing issue on daggyr commit e5e358820da4c2587741abdc3b6b103e5a4d4dd3 Author: Ian Roddis <tech@kinesin.ca> Date: Sun Feb 13 22:24:04 2022 -0400 changing newlines to std::endl for flush goodness commit 705ec86b75be947e64f4124ec8017cba2c8465e6 Author: Ian Roddis <tech@kinesin.ca> Date: Sun Feb 13 22:16:56 2022 -0400 adding more logging commit aa3db9c23e55da7a0523dc57e268b605ce8faac3 Author: Ian Roddis <tech@kinesin.ca> Date: Sun Feb 13 22:13:56 2022 -0400 Adding threadid commit 3b1a0f1333b2d43bc5ecad0746435504babbaa61 Author: Ian Roddis <tech@kinesin.ca> Date: Sun Feb 13 22:13:24 2022 -0400 Adding some debugging commit 804507e65251858fa597b7c27bcece8d8dfd589d Author: Ian Roddis <tech@kinesin.ca> Date: Sun Feb 13 21:52:53 2022 -0400 Removing curl global cleanup
51 lines
1.2 KiB
C++
51 lines
1.2 KiB
C++
#ifdef CATCH_CONFIG_ENABLE_BENCHMARKING
|
|
|
|
#include <catch2/catch.hpp>
|
|
#include <iostream>
|
|
#include <random>
|
|
|
|
#include <daggy/Serialization.hpp>
|
|
|
|
std::string random_string(std::size_t length)
|
|
{
|
|
const std::string CHARACTERS = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz;\"'\n\t{}[]()";
|
|
|
|
std::random_device random_device;
|
|
std::mt19937 generator(random_device());
|
|
std::uniform_int_distribution<> distribution(0, CHARACTERS.size() - 1);
|
|
|
|
std::string random_string;
|
|
|
|
for (std::size_t i = 0; i < length; ++i)
|
|
{
|
|
random_string += CHARACTERS[distribution(generator)];
|
|
}
|
|
|
|
return random_string;
|
|
}
|
|
|
|
using namespace daggy;
|
|
|
|
TEST_CASE("attempt output", "[serialize_attempt_performance][perf]")
|
|
{
|
|
size_t LOGSIZE = 512000;
|
|
// Need lots of data
|
|
AttemptRecord attempt{
|
|
.startTime = Clock::now(),
|
|
.stopTime = Clock::now(),
|
|
.rc = 0,
|
|
.executorLog = random_string(LOGSIZE),
|
|
.outputLog = random_string(LOGSIZE),
|
|
.errorLog = random_string(LOGSIZE)
|
|
};
|
|
|
|
|
|
BENCHMARK_ADVANCED("rj_dump")(Catch::Benchmark::Chronometer meter)
|
|
{
|
|
meter.measure([&] { return attemptRecordToJSON(attempt); });
|
|
};
|
|
|
|
}
|
|
|
|
#endif
|