Fixing daggyr issues when reporting on tasks with very large outputs
(>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
This commit is contained in:
@@ -16,6 +16,7 @@ add_executable(${PROJECT_NAME} main.cpp
|
||||
int_basic.cpp
|
||||
# Performance checks
|
||||
perf_dag.cpp
|
||||
perf_serialization.cpp
|
||||
)
|
||||
target_link_libraries(${PROJECT_NAME} libdaggy stdc++fs Catch2::Catch2)
|
||||
|
||||
|
||||
@@ -49,7 +49,7 @@ const size_t MAX_CHILDREN = 10;
|
||||
|
||||
static auto DAG = createDAG(N_NODES, MAX_CHILDREN);
|
||||
|
||||
TEST_CASE("massive DAGs", "[dag_performance]")
|
||||
TEST_CASE("massive DAGs", "[dag_performance][perf]")
|
||||
{
|
||||
BENCHMARK_ADVANCED("dag.reset")(Catch::Benchmark::Chronometer meter)
|
||||
{
|
||||
|
||||
50
libdaggy/tests/perf_serialization.cpp
Normal file
50
libdaggy/tests/perf_serialization.cpp
Normal file
@@ -0,0 +1,50 @@
|
||||
#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
|
||||
@@ -102,3 +102,45 @@ TEST_CASE("task_serialization", "[serialize_tasks]")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE("attempt_serialization", "[serialize_attempt]")
|
||||
{
|
||||
SECTION("Serialize Simple Attempt")
|
||||
{
|
||||
using namespace daggy;
|
||||
|
||||
AttemptRecord attempt{
|
||||
.startTime = Clock::now(),
|
||||
.stopTime = Clock::now(),
|
||||
.rc = 0,
|
||||
.executorLog = "",
|
||||
.outputLog = "",
|
||||
.errorLog = "",
|
||||
};
|
||||
|
||||
auto json = attemptRecordToJSON(attempt);
|
||||
|
||||
rj::Document doc;
|
||||
REQUIRE_NOTHROW(checkRJParse(doc.Parse(json.c_str()), "Parsing AttemptRecord"));
|
||||
}
|
||||
|
||||
SECTION("Serialize Attempt with complicated logs")
|
||||
{
|
||||
using namespace daggy;
|
||||
|
||||
AttemptRecord attempt{
|
||||
.startTime = Clock::now(),
|
||||
.stopTime = Clock::now(),
|
||||
.rc = 0,
|
||||
.executorLog = "",
|
||||
.outputLog = "This is a testament to\nmore complicated, \"potentially quoted\"\nproblem\tspaces\n",
|
||||
.errorLog = "",
|
||||
};
|
||||
|
||||
auto json = attemptRecordToJSON(attempt);
|
||||
|
||||
rj::Document doc;
|
||||
REQUIRE_NOTHROW(checkRJParse(doc.Parse(json.c_str()), "Parsing AttemptRecord"));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user