From 005e0e34fe524cdc62a6457374689bb87f01d027 Mon Sep 17 00:00:00 2001 From: Jim Eckerlein Date: Sun, 19 Feb 2023 22:32:52 +0100 Subject: [PATCH 001/102] Add googletest --- .gitmodules | 3 ++ CMakeLists.txt | 5 +++ test/CMakeLists.txt | 5 +++ test/googletest | 1 + test/test.cpp | 84 +++++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 98 insertions(+) create mode 100644 test/CMakeLists.txt create mode 160000 test/googletest create mode 100644 test/test.cpp diff --git a/.gitmodules b/.gitmodules index 2e130c0..e5203c4 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,6 @@ [submodule "data-sources/mt4g"] path = data-sources/mt4g url = https://github.com/caps-tum/mt4g.git +[submodule "test/googletest"] + path = test/googletest + url = git@github.com:google/googletest.git diff --git a/CMakeLists.txt b/CMakeLists.txt index b8ae050..fd3222d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -48,6 +48,7 @@ option(DATA_SOURCES "Build and install all data sources" OFF) option(DS_HWLOC "Build and install data source hwloc (Retrieves hwloc topology information)" OFF) option(DS_MT4G "Build and install data source mt4g (Compute and memory topology of NVidia GPUs)" OFF) option(DS_NUMA "Build and install data source caps-numa-benchmark" OFF) +option(TESTS "Build tests" OFF) if(CAT_AWARE) add_definitions(-DCAT_AWARE ) @@ -67,3 +68,7 @@ endif() add_subdirectory(src) add_subdirectory(examples) add_subdirectory(data-sources) + +if(${TESTS}) + add_subdirectory(test) +endif() diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt new file mode 100644 index 0000000..548ce41 --- /dev/null +++ b/test/CMakeLists.txt @@ -0,0 +1,5 @@ +add_subdirectory(googletest) + +add_executable(test test.cpp) +target_link_libraries(test PRIVATE sys-sage gtest gmock) +include_directories(../src) # The include path is not set in the sys-sage target because CMAKE_INCLUDE_CURRENT_DIR is used instead diff --git a/test/googletest b/test/googletest new file mode 160000 index 0000000..7a7231c --- /dev/null +++ b/test/googletest @@ -0,0 +1 @@ +Subproject commit 7a7231c442484be389fdf01594310349ca0e42a8 diff --git a/test/test.cpp b/test/test.cpp new file mode 100644 index 0000000..9c0a7d1 --- /dev/null +++ b/test/test.cpp @@ -0,0 +1,84 @@ +#include "sys-sage.hpp" + +#include "gtest/gtest.h" +#include "gmock/gmock.h" + +#include +#include + +int main(int argc, char **argv) +{ + testing::InitGoogleTest(&argc, argv); + return RUN_ALL_TESTS(); +} + +TEST(test, tautology) +{ + EXPECT_EQ(42, 42); +} + +std::vector gatherChildren(xmlNode *parent) +{ + std::vector childrenVector; + childrenVector.reserve(xmlChildElementCount(parent)); + for (xmlNode *child = xmlFirstElementChild(parent);; child = xmlNextElementSibling(child)) + { + childrenVector.push_back(child); + if (child == xmlLastElementChild(parent)) + { + break; + } + } + return childrenVector; +} + +std::map> gatherChildrenByName(xmlNode *parent) +{ + std::map> map; + for (xmlNode *child = xmlFirstElementChild(parent);; child = xmlNextElementSibling(child)) + { + map[child->name].push_back(child); + if (child == xmlLastElementChild(parent)) + { + break; + } + } + return map; +} + +// TEST(ExportToXml, Empty) { +// auto topo = new Topology; +// exportToXml(topo, "test_export.xml"); +// auto doc = xmlParseFile("foo.xml"); +// ASSERT_EQ(xmlChildElementCount(doc->children), 0); +// xmlFreeDoc(doc); +// } + +TEST(ExportToXml, SingleComponent) +{ + auto topo = new Topology; + auto memory = new Memory{topo, "A single memory component", 16}; + exportToXml(topo, "test_export.xml"); + auto doc = xmlParseFile("foo.xml"); + + ASSERT_GE(xmlChildElementCount(doc->children), 1); + + xmlNode *components = nullptr; + // for (xmlNode* node = xmlFirstElementChild(doc->children); node != xmlLastElementChild(doc->children) + 1; node = xmlNextElementSibling(node)) { + // std::cout << node->name << std::endl; + // } + + gatherChildrenByName(doc->children); + + // for (xmlNode *node = xmlFirstElementChild(doc->children);; node = xmlNextElementSibling(node)) + // { + // if ("") + // std::cout << node->name << std::endl; + // if (node == xmlLastElementChild(doc->children)) + // { + // break; + // } + // } + + xmlFreeDoc(doc); +} From 1d481da89a2347b4ae9621ddaf5aad22ceb51a98 Mon Sep 17 00:00:00 2001 From: Jim Eckerlein Date: Tue, 21 Feb 2023 15:26:53 +0100 Subject: [PATCH 002/102] Write tests for exportToXml --- test/test.cpp | 193 ++++++++++++++++++++++++++++++++++++-------------- 1 file changed, 138 insertions(+), 55 deletions(-) diff --git a/test/test.cpp b/test/test.cpp index 9c0a7d1..28db94d 100644 --- a/test/test.cpp +++ b/test/test.cpp @@ -3,8 +3,10 @@ #include "gtest/gtest.h" #include "gmock/gmock.h" -#include -#include +#include +#include + +#include int main(int argc, char **argv) { @@ -12,73 +14,154 @@ int main(int argc, char **argv) return RUN_ALL_TESTS(); } -TEST(test, tautology) +/** + * Create a string view over UTF-8 code points as used by libxml. + */ +std::basic_string_view operator""_xsv(const char *string, size_t len) { - EXPECT_EQ(42, 42); + return {BAD_CAST(string), len}; } -std::vector gatherChildren(xmlNode *parent) +TEST(ExportToXml, MinimalTopology) { - std::vector childrenVector; - childrenVector.reserve(xmlChildElementCount(parent)); - for (xmlNode *child = xmlFirstElementChild(parent);; child = xmlNextElementSibling(child)) { - childrenVector.push_back(child); - if (child == xmlLastElementChild(parent)) + auto topo = new Component{42, "a name", SYS_SAGE_COMPONENT_NONE}; + exportToXml(topo, "test_export.xml"); + } + { + xmlDoc *doc = xmlParseFile("test_export.xml"); + ASSERT_NE(doc->children, nullptr); + ASSERT_NE(doc->children->name, nullptr); + xmlNode *sysSage = doc->children; + ASSERT_EQ("sys-sage"_xsv, sysSage->name); + + bool foundComponents = false; + bool foundDataPaths = false; + + for (xmlNode *child = sysSage->children; child; child = child->next) { - break; + if ("components"_xsv == child->name) + { + EXPECT_FALSE(foundComponents); + foundComponents = true; + } + else if ("data-paths"_xsv == child->name) + { + EXPECT_FALSE(foundDataPaths); + foundDataPaths = true; + } } + + EXPECT_TRUE(foundComponents); + EXPECT_TRUE(foundDataPaths); + + xmlFreeDoc(doc); } - return childrenVector; } -std::map> gatherChildrenByName(xmlNode *parent) +TEST(ExportToXml, SingleComponent) { - std::map> map; - for (xmlNode *child = xmlFirstElementChild(parent);; child = xmlNextElementSibling(child)) { - map[child->name].push_back(child); - if (child == xmlLastElementChild(parent)) + auto topo = new Topology; + auto memory = new Memory{topo, "A single memory component", 16}; + (void)memory; + exportToXml(topo, "test_export.xml"); + } + + { + xmlDoc *doc = xmlParseFile("test_export.xml"); + + ASSERT_GE(xmlChildElementCount(doc->children), 1); + + xmlNode *node = doc->children; + + for (xmlNode *child = node->children; child; child = child->next) { - break; + if ("components"_xsv == child->name) + { + node = child; + break; + } } - } - return map; -} -// TEST(ExportToXml, Empty) { -// auto topo = new Topology; -// exportToXml(topo, "test_export.xml"); -// auto doc = xmlParseFile("foo.xml"); -// ASSERT_EQ(xmlChildElementCount(doc->children), 0); -// xmlFreeDoc(doc); -// } + { + bool foundTopology = false; + for (xmlNode *child = node->children; child; child = child->next) + { + if ("Topology"_xsv == child->name) + { + EXPECT_FALSE(foundTopology); + foundTopology = true; + node = child; + } + } + ASSERT_TRUE(foundTopology); + } -TEST(ExportToXml, SingleComponent) -{ - auto topo = new Topology; - auto memory = new Memory{topo, "A single memory component", 16}; - exportToXml(topo, "test_export.xml"); - auto doc = xmlParseFile("foo.xml"); - - ASSERT_GE(xmlChildElementCount(doc->children), 1); - - xmlNode *components = nullptr; - // for (xmlNode* node = xmlFirstElementChild(doc->children); node != xmlLastElementChild(doc->children) + 1; node = xmlNextElementSibling(node)) { - // std::cout << node->name << std::endl; - // } - - gatherChildrenByName(doc->children); - - // for (xmlNode *node = xmlFirstElementChild(doc->children);; node = xmlNextElementSibling(node)) - // { - // if ("") - // std::cout << node->name << std::endl; - // if (node == xmlLastElementChild(doc->children)) - // { - // break; - // } - // } - - xmlFreeDoc(doc); + auto topo = node; + + { + bool foundIdProp = false; + bool foundNameProp = false; + for (auto prop = topo->properties; prop != nullptr; prop = prop->next) + { + if ("id"_xsv == prop->name) + { + foundIdProp = true; + ASSERT_NE(prop->children, nullptr); + EXPECT_EQ("0"_xsv, prop->children->content); + } + else if ("name"_xsv == prop->name) + { + foundNameProp = true; + EXPECT_NE(prop->children, nullptr); + } + } + EXPECT_TRUE(foundIdProp); + EXPECT_TRUE(foundNameProp); + } + + xmlNode *memory = nullptr; + for (auto child = topo->children; child != nullptr; child = child->next) + { + if ("Memory"_xsv == child->name) + { + memory = child; + break; + } + } + ASSERT_NE(memory, nullptr); + + { + bool foundIdProp = false; + bool foundNameProp = false; + bool foundSizeProp = false; + for (auto prop = memory->properties; prop != nullptr; prop = prop->next) + { + if ("id"_xsv == prop->name) + { + foundIdProp = true; + ASSERT_NE(prop->children, nullptr); + EXPECT_EQ("0"_xsv, prop->children->content); + } + else if ("name"_xsv == prop->name) + { + foundNameProp = true; + ASSERT_NE(prop->children, nullptr); + EXPECT_EQ("A single memory component"_xsv, prop->children->content); + } + else if ("size"_xsv == prop->name) + { + foundSizeProp = true; + ASSERT_NE(prop->children, nullptr); + EXPECT_EQ("16"_xsv, prop->children->content); + } + } + EXPECT_TRUE(foundIdProp); + EXPECT_TRUE(foundNameProp); + EXPECT_TRUE(foundSizeProp); + } + + xmlFreeDoc(doc); + } } From 501f11a912d092373db5b9c7a4e33edc09908f75 Mon Sep 17 00:00:00 2001 From: Jim Eckerlein Date: Tue, 21 Feb 2023 18:06:36 +0100 Subject: [PATCH 003/102] Write XML schema for exportToXml output --- schema.xml | 168 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 168 insertions(+) create mode 100644 schema.xml diff --git a/schema.xml b/schema.xml new file mode 100644 index 0000000..9013514 --- /dev/null +++ b/schema.xml @@ -0,0 +1,168 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file From 1e6b3acee644e074f8b1115753691de378bb245c Mon Sep 17 00:00:00 2001 From: Jim Eckerlein Date: Tue, 21 Feb 2023 18:39:02 +0100 Subject: [PATCH 004/102] Validate XMLs in tests --- test/CMakeLists.txt | 1 + schema.xml => test/schema.xml | 0 test/test.cpp | 76 +++++++++++++++++++++++------------ 3 files changed, 51 insertions(+), 26 deletions(-) rename schema.xml => test/schema.xml (100%) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 548ce41..04d67cc 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -3,3 +3,4 @@ add_subdirectory(googletest) add_executable(test test.cpp) target_link_libraries(test PRIVATE sys-sage gtest gmock) include_directories(../src) # The include path is not set in the sys-sage target because CMAKE_INCLUDE_CURRENT_DIR is used instead +target_compile_definitions(test PRIVATE TEST_RESOURCE_DIR="${CMAKE_CURRENT_SOURCE_DIR}") diff --git a/schema.xml b/test/schema.xml similarity index 100% rename from schema.xml rename to test/schema.xml diff --git a/test/test.cpp b/test/test.cpp index 28db94d..79e2107 100644 --- a/test/test.cpp +++ b/test/test.cpp @@ -5,6 +5,7 @@ #include #include +#include #include @@ -22,43 +23,64 @@ std::basic_string_view operator""_xsv(const char *string, size_t return {BAD_CAST(string), len}; } -TEST(ExportToXml, MinimalTopology) +/** + * Validates XML output of sys-sage using an XML schema file. + */ +void validate(std::string_view path) { + xmlSchemaParserCtxt *parser = xmlSchemaNewParserCtxt(TEST_RESOURCE_DIR "/schema.xml"); + if (parser == nullptr) { - auto topo = new Component{42, "a name", SYS_SAGE_COMPONENT_NONE}; - exportToXml(topo, "test_export.xml"); + throw std::runtime_error{""}; } + + xmlSchema *schema = xmlSchemaParse(parser); + xmlSchemaFreeParserCtxt(parser); + + xmlSchemaValidCtxt *validator = xmlSchemaNewValidCtxt(schema); + if (validator == nullptr) { - xmlDoc *doc = xmlParseFile("test_export.xml"); - ASSERT_NE(doc->children, nullptr); - ASSERT_NE(doc->children->name, nullptr); - xmlNode *sysSage = doc->children; - ASSERT_EQ("sys-sage"_xsv, sysSage->name); + xmlSchemaFree(schema); + throw std::runtime_error{""}; + } - bool foundComponents = false; - bool foundDataPaths = false; + xmlSchemaSetValidErrors(validator, (xmlSchemaValidityErrorFunc)fprintf, (xmlSchemaValidityWarningFunc)fprintf, stdout); - for (xmlNode *child = sysSage->children; child; child = child->next) - { - if ("components"_xsv == child->name) - { - EXPECT_FALSE(foundComponents); - foundComponents = true; - } - else if ("data-paths"_xsv == child->name) - { - EXPECT_FALSE(foundDataPaths); - foundDataPaths = true; - } - } + xmlDoc *doc = xmlParseFile(path.data()); + if (doc == nullptr) + { + xmlSchemaFree(schema); + xmlSchemaFreeValidCtxt(validator); - EXPECT_TRUE(foundComponents); - EXPECT_TRUE(foundDataPaths); + std::string message{"Cannot open "}; + message += path; + message += " for validation"; + throw std::runtime_error{message}; + } - xmlFreeDoc(doc); + int code = xmlSchemaValidateDoc(validator, doc); + + xmlSchemaFree(schema); + xmlSchemaFreeValidCtxt(validator); + + xmlFreeDoc(doc); + + if (code != 0) + { + std::string message{"XML validation of "}; + message += path; + message += " failed"; + throw std::runtime_error{message}; } } +TEST(ExportToXml, MinimalTopology) +{ + auto topo = new Component{42, "a name", SYS_SAGE_COMPONENT_NONE}; + exportToXml(topo, "test_export.xml"); + validate("test_export.xml"); +} + TEST(ExportToXml, SingleComponent) { { @@ -69,6 +91,8 @@ TEST(ExportToXml, SingleComponent) } { + validate("test_export.xml"); + xmlDoc *doc = xmlParseFile("test_export.xml"); ASSERT_GE(xmlChildElementCount(doc->children), 1); From acce662f74f0553de0a3eafe64d07f7ed08f5734 Mon Sep 17 00:00:00 2001 From: Jim Eckerlein Date: Tue, 21 Feb 2023 19:03:58 +0100 Subject: [PATCH 005/102] Implement RAII type to avoid memory leaks --- test/test.cpp | 113 ++++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 95 insertions(+), 18 deletions(-) diff --git a/test/test.cpp b/test/test.cpp index 79e2107..f670e9a 100644 --- a/test/test.cpp +++ b/test/test.cpp @@ -23,35 +23,120 @@ std::basic_string_view operator""_xsv(const char *string, size_t return {BAD_CAST(string), len}; } +/** + * A container which implements RAII (Resource acquisition is initialization) for + * automatic destructor dispatch. + */ +template +class RAII +{ + using Dtor = void (*)(T *); + + T *inner; /** The acquired value. Is never null. */ + Dtor dtor; /** The destructor to run during de-initialization. */ + +public: + RAII(T *inner, Dtor dtor) : inner{inner}, dtor{dtor} + { + if (inner == nullptr) + { + throw std::runtime_error{"Failed to acquire test resource"}; + } + } + + /** + * Sometimes, the destructor accepts a generic `void *` instead of the concrete value type. + */ + RAII(T *inner, void (*dtor)(void *)) : inner{inner}, dtor{reinterpret_cast(dtor)} + { + if (inner == nullptr) + { + throw std::runtime_error{"Failed to acquire test resource"}; + } + } + + RAII(const RAII &) = delete; + + /** + * Transfer ownership. + */ + RAII(RAII &&rhs) : inner{rhs.inner}, dtor{rhs.dtor} + { + rhs.dtor = nullptr; + } + + RAII &operator=(const RAII &) = delete; + + RAII &operator=(RAII &&rhs) + { + inner = rhs.inner; + dtor = rhs.dtor; + rhs.dtor = nullptr; + }; + + ~RAII() + { + if (dtor != nullptr) + { + dtor(inner); + } + } + + T *operator->() + { + return inner; + } + + operator T *() + { + return inner; + } + + T *operator*() + { + return inner; + } +}; + +template +RAII(T *, D) -> RAII; + +TEST(Tests, RAII) +{ + int x = 0; + { + RAII raii{&x, [](int *x) + { *x = 42; }}; + ASSERT_EQ(x, 0); + ASSERT_EQ(*static_cast(raii), 0); + } + ASSERT_EQ(x, 42); +} + /** * Validates XML output of sys-sage using an XML schema file. */ void validate(std::string_view path) { - xmlSchemaParserCtxt *parser = xmlSchemaNewParserCtxt(TEST_RESOURCE_DIR "/schema.xml"); + auto parser = RAII{xmlSchemaNewParserCtxt(TEST_RESOURCE_DIR "/schema.xml"), xmlSchemaFreeParserCtxt}; if (parser == nullptr) { throw std::runtime_error{""}; } - xmlSchema *schema = xmlSchemaParse(parser); - xmlSchemaFreeParserCtxt(parser); + auto schema = RAII{xmlSchemaParse(parser), xmlSchemaFree}; - xmlSchemaValidCtxt *validator = xmlSchemaNewValidCtxt(schema); + auto validator = RAII{xmlSchemaNewValidCtxt(schema), xmlSchemaFreeValidCtxt}; if (validator == nullptr) { - xmlSchemaFree(schema); throw std::runtime_error{""}; } xmlSchemaSetValidErrors(validator, (xmlSchemaValidityErrorFunc)fprintf, (xmlSchemaValidityWarningFunc)fprintf, stdout); - xmlDoc *doc = xmlParseFile(path.data()); + auto doc = RAII{xmlParseFile(path.data()), xmlFreeDoc}; if (doc == nullptr) { - xmlSchemaFree(schema); - xmlSchemaFreeValidCtxt(validator); - std::string message{"Cannot open "}; message += path; message += " for validation"; @@ -59,12 +144,6 @@ void validate(std::string_view path) } int code = xmlSchemaValidateDoc(validator, doc); - - xmlSchemaFree(schema); - xmlSchemaFreeValidCtxt(validator); - - xmlFreeDoc(doc); - if (code != 0) { std::string message{"XML validation of "}; @@ -93,7 +172,7 @@ TEST(ExportToXml, SingleComponent) { validate("test_export.xml"); - xmlDoc *doc = xmlParseFile("test_export.xml"); + auto doc = RAII{xmlParseFile("test_export.xml"), xmlFreeDoc}; ASSERT_GE(xmlChildElementCount(doc->children), 1); @@ -185,7 +264,5 @@ TEST(ExportToXml, SingleComponent) EXPECT_TRUE(foundNameProp); EXPECT_TRUE(foundSizeProp); } - - xmlFreeDoc(doc); } } From 654997cafafc103301996423c4d2fe034444c35e Mon Sep 17 00:00:00 2001 From: Jim Eckerlein Date: Tue, 21 Feb 2023 21:13:17 +0100 Subject: [PATCH 006/102] Extend RAII --- test/test.cpp | 34 +++++++++++++++++++++++++++++++--- 1 file changed, 31 insertions(+), 3 deletions(-) diff --git a/test/test.cpp b/test/test.cpp index f670e9a..07e99fa 100644 --- a/test/test.cpp +++ b/test/test.cpp @@ -36,7 +36,11 @@ class RAII Dtor dtor; /** The destructor to run during de-initialization. */ public: - RAII(T *inner, Dtor dtor) : inner{inner}, dtor{dtor} + /** + * Constructs a new RAII object owning an inner value and an associated destructor. + */ + RAII(T *inner, Dtor dtor) + : inner{inner}, dtor{dtor} { if (inner == nullptr) { @@ -47,7 +51,9 @@ class RAII /** * Sometimes, the destructor accepts a generic `void *` instead of the concrete value type. */ - RAII(T *inner, void (*dtor)(void *)) : inner{inner}, dtor{reinterpret_cast(dtor)} + RAII(T *inner, void (*dtor)(void *)) + requires(!std::is_same_v) + : inner{inner}, dtor{reinterpret_cast(dtor)} { if (inner == nullptr) { @@ -101,7 +107,16 @@ class RAII template RAII(T *, D) -> RAII; -TEST(Tests, RAII) +template +RAII(void *, D) -> RAII; + +TEST(RAII, InnerCannotBeNull) +{ + ASSERT_ANY_THROW(RAII(reinterpret_cast(0), free)); + ASSERT_ANY_THROW(RAII(reinterpret_cast(0), [](void *) {})); +} + +TEST(RAII, DestructorRuns) { int x = 0; { @@ -113,6 +128,19 @@ TEST(Tests, RAII) ASSERT_EQ(x, 42); } +TEST(RAII, MoveOwnership) +{ + int x = 0; + { + RAII r0{&x, [](int *x) + { *x += 1; }}; + RAII r1{std::move(r0)}; + ASSERT_EQ(x, 0); + ASSERT_EQ(*static_cast(r1), 0); + } + ASSERT_EQ(x, 1); +} + /** * Validates XML output of sys-sage using an XML schema file. */ From 978400bd1d14f904d5eb5e5f93d6cebaf24488e8 Mon Sep 17 00:00:00 2001 From: Jim Eckerlein Date: Tue, 21 Feb 2023 21:16:57 +0100 Subject: [PATCH 007/102] Write tests for attributes --- test/test.cpp | 102 +++++++++++++------------------------------------- 1 file changed, 27 insertions(+), 75 deletions(-) diff --git a/test/test.cpp b/test/test.cpp index 07e99fa..e8479f8 100644 --- a/test/test.cpp +++ b/test/test.cpp @@ -6,6 +6,7 @@ #include #include #include +#include #include @@ -84,7 +85,7 @@ class RAII { if (dtor != nullptr) { - dtor(inner); + dtor(inner); } } @@ -188,6 +189,18 @@ TEST(ExportToXml, MinimalTopology) validate("test_export.xml"); } +xmlNode *getSingleNodeByPath(xmlChar *path, xmlXPathContext *context) +{ + auto result = RAII{xmlXPathEvalExpression(path, context), xmlXPathFreeObject}; + if (result->nodesetval == nullptr || result->type != XPATH_NODESET || result->nodesetval->nodeNr != 1) + { + std::string message{"Invalid query with path "}; + message += reinterpret_cast(path); + throw std::runtime_error{message}; + } + return result->nodesetval->nodeTab[0]; +} + TEST(ExportToXml, SingleComponent) { { @@ -201,96 +214,35 @@ TEST(ExportToXml, SingleComponent) validate("test_export.xml"); auto doc = RAII{xmlParseFile("test_export.xml"), xmlFreeDoc}; + auto pathContext = RAII{xmlXPathNewContext(doc), xmlXPathFreeContext}; - ASSERT_GE(xmlChildElementCount(doc->children), 1); - - xmlNode *node = doc->children; + ASSERT_NO_THROW(getSingleNodeByPath(BAD_CAST("/sys-sage/components/Topology"), pathContext)); - for (xmlNode *child = node->children; child; child = child->next) { - if ("components"_xsv == child->name) - { - node = child; - break; - } + auto result = RAII{xmlXPathEvalExpression(BAD_CAST("string(/sys-sage/components/Topology/@id)"), pathContext), xmlXPathFreeObject}; + ASSERT_EQ("0"_xsv, result->stringval); } { - bool foundTopology = false; - for (xmlNode *child = node->children; child; child = child->next) - { - if ("Topology"_xsv == child->name) - { - EXPECT_FALSE(foundTopology); - foundTopology = true; - node = child; - } - } - ASSERT_TRUE(foundTopology); + auto result = RAII{xmlXPathEvalExpression(BAD_CAST("string(/sys-sage/components/Topology/@name)"), pathContext), xmlXPathFreeObject}; + ASSERT_EQ("sys-sage Topology"_xsv, result->stringval); } - auto topo = node; + ASSERT_NO_THROW(getSingleNodeByPath(BAD_CAST("/sys-sage/components/Topology/Memory"), pathContext)); { - bool foundIdProp = false; - bool foundNameProp = false; - for (auto prop = topo->properties; prop != nullptr; prop = prop->next) - { - if ("id"_xsv == prop->name) - { - foundIdProp = true; - ASSERT_NE(prop->children, nullptr); - EXPECT_EQ("0"_xsv, prop->children->content); - } - else if ("name"_xsv == prop->name) - { - foundNameProp = true; - EXPECT_NE(prop->children, nullptr); - } - } - EXPECT_TRUE(foundIdProp); - EXPECT_TRUE(foundNameProp); + auto result = RAII{xmlXPathEvalExpression(BAD_CAST("string(/sys-sage/components/Topology/Memory/@id)"), pathContext), xmlXPathFreeObject}; + ASSERT_EQ("0"_xsv, result->stringval); } - xmlNode *memory = nullptr; - for (auto child = topo->children; child != nullptr; child = child->next) { - if ("Memory"_xsv == child->name) - { - memory = child; - break; - } + auto result = RAII{xmlXPathEvalExpression(BAD_CAST("string(/sys-sage/components/Topology/Memory/@name)"), pathContext), xmlXPathFreeObject}; + ASSERT_EQ("A single memory component"_xsv, result->stringval); } - ASSERT_NE(memory, nullptr); { - bool foundIdProp = false; - bool foundNameProp = false; - bool foundSizeProp = false; - for (auto prop = memory->properties; prop != nullptr; prop = prop->next) - { - if ("id"_xsv == prop->name) - { - foundIdProp = true; - ASSERT_NE(prop->children, nullptr); - EXPECT_EQ("0"_xsv, prop->children->content); - } - else if ("name"_xsv == prop->name) - { - foundNameProp = true; - ASSERT_NE(prop->children, nullptr); - EXPECT_EQ("A single memory component"_xsv, prop->children->content); - } - else if ("size"_xsv == prop->name) - { - foundSizeProp = true; - ASSERT_NE(prop->children, nullptr); - EXPECT_EQ("16"_xsv, prop->children->content); - } - } - EXPECT_TRUE(foundIdProp); - EXPECT_TRUE(foundNameProp); - EXPECT_TRUE(foundSizeProp); + auto result = RAII{xmlXPathEvalExpression(BAD_CAST("string(/sys-sage/components/Topology/Memory/@size)"), pathContext), xmlXPathFreeObject}; + ASSERT_EQ("16"_xsv, result->stringval); } } } From 7cdd1206aa7d52083a533aa4769ebaa4d631cd1f Mon Sep 17 00:00:00 2001 From: Jim Eckerlein Date: Tue, 21 Feb 2023 21:18:19 +0100 Subject: [PATCH 008/102] Validate sample output --- test/sys-sage_sample_output.xml | 279 ++++++++++++++++++++++++++++++++ test/test.cpp | 5 + 2 files changed, 284 insertions(+) create mode 100644 test/sys-sage_sample_output.xml diff --git a/test/sys-sage_sample_output.xml b/test/sys-sage_sample_output.xml new file mode 100644 index 0000000..8c65ee4 --- /dev/null +++ b/test/sys-sage_sample_output.xml @@ -0,0 +1,279 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/test/test.cpp b/test/test.cpp index e8479f8..b244505 100644 --- a/test/test.cpp +++ b/test/test.cpp @@ -189,6 +189,11 @@ TEST(ExportToXml, MinimalTopology) validate("test_export.xml"); } +TEST(ExportToXml, SampleOutput) +{ + validate("sys-sage_sample_output.xml"); +} + xmlNode *getSingleNodeByPath(xmlChar *path, xmlXPathContext *context) { auto result = RAII{xmlXPathEvalExpression(path, context), xmlXPathFreeObject}; From 83dc6cc7e21fa0d58ed6f0d24e594bd6d4b3b4fd Mon Sep 17 00:00:00 2001 From: Jim Eckerlein Date: Tue, 21 Feb 2023 21:25:57 +0100 Subject: [PATCH 009/102] Separate tests into modules --- test/CMakeLists.txt | 4 +- test/export.cpp | 128 +++++++++ test/raii.cpp | 35 +++ test/raii.hpp | 91 +++++++ test/{ => resources}/schema.xml | 0 .../sys-sage_sample_output.xml | 0 test/test.cpp | 242 ------------------ 7 files changed, 256 insertions(+), 244 deletions(-) create mode 100644 test/export.cpp create mode 100644 test/raii.cpp create mode 100644 test/raii.hpp rename test/{ => resources}/schema.xml (100%) rename test/{ => resources}/sys-sage_sample_output.xml (100%) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 04d67cc..871960b 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -1,6 +1,6 @@ add_subdirectory(googletest) -add_executable(test test.cpp) +add_executable(test test.cpp raii.cpp raii.hpp export.cpp) target_link_libraries(test PRIVATE sys-sage gtest gmock) include_directories(../src) # The include path is not set in the sys-sage target because CMAKE_INCLUDE_CURRENT_DIR is used instead -target_compile_definitions(test PRIVATE TEST_RESOURCE_DIR="${CMAKE_CURRENT_SOURCE_DIR}") +target_compile_definitions(test PRIVATE TEST_RESOURCE_DIR="${CMAKE_CURRENT_SOURCE_DIR}/resources") diff --git a/test/export.cpp b/test/export.cpp new file mode 100644 index 0000000..a40dc94 --- /dev/null +++ b/test/export.cpp @@ -0,0 +1,128 @@ +#include "gtest/gtest.h" + +#include +#include +#include +#include + +#include "sys-sage.hpp" + +#include "raii.hpp" + +/** + * Create a string view over UTF-8 code points as used by libxml. + */ +std::basic_string_view operator""_xsv(const char *string, size_t len) +{ + return {BAD_CAST(string), len}; +} + +/** + * Validates XML output of sys-sage using an XML schema file. + */ +void validate(std::string_view path) +{ + auto parser = RAII{xmlSchemaNewParserCtxt(TEST_RESOURCE_DIR "/schema.xml"), xmlSchemaFreeParserCtxt}; + if (parser == nullptr) + { + throw std::runtime_error{""}; + } + + auto schema = RAII{xmlSchemaParse(parser), xmlSchemaFree}; + + auto validator = RAII{xmlSchemaNewValidCtxt(schema), xmlSchemaFreeValidCtxt}; + if (validator == nullptr) + { + throw std::runtime_error{""}; + } + + xmlSchemaSetValidErrors(validator, (xmlSchemaValidityErrorFunc)fprintf, (xmlSchemaValidityWarningFunc)fprintf, stdout); + + auto doc = RAII{xmlParseFile(path.data()), xmlFreeDoc}; + if (doc == nullptr) + { + std::string message{"Cannot open "}; + message += path; + message += " for validation"; + throw std::runtime_error{message}; + } + + int code = xmlSchemaValidateDoc(validator, doc); + if (code != 0) + { + std::string message{"XML validation of "}; + message += path; + message += " failed"; + throw std::runtime_error{message}; + } +} + +TEST(ExportToXml, MinimalTopology) +{ + auto topo = new Component{42, "a name", SYS_SAGE_COMPONENT_NONE}; + exportToXml(topo, "test_export.xml"); + validate("test_export.xml"); +} + +TEST(ExportToXml, SampleOutput) +{ + validate("sys-sage_sample_output.xml"); +} + +xmlNode *getSingleNodeByPath(xmlChar *path, xmlXPathContext *context) +{ + auto result = RAII{xmlXPathEvalExpression(path, context), xmlXPathFreeObject}; + if (result->nodesetval == nullptr || result->type != XPATH_NODESET || result->nodesetval->nodeNr != 1) + { + std::string message{"Invalid query with path "}; + message += reinterpret_cast(path); + throw std::runtime_error{message}; + } + return result->nodesetval->nodeTab[0]; +} + +TEST(ExportToXml, SingleComponent) +{ + { + auto topo = new Topology; + auto memory = new Memory{topo, "A single memory component", 16}; + (void)memory; + exportToXml(topo, "test_export.xml"); + } + + { + validate("test_export.xml"); + + auto doc = RAII{xmlParseFile("test_export.xml"), xmlFreeDoc}; + auto pathContext = RAII{xmlXPathNewContext(doc), xmlXPathFreeContext}; + + ASSERT_NO_THROW(getSingleNodeByPath(BAD_CAST("/sys-sage/components/Topology"), pathContext)); + + { + auto result = RAII{xmlXPathEvalExpression(BAD_CAST("string(/sys-sage/components/Topology/@id)"), pathContext), xmlXPathFreeObject}; + ASSERT_EQ("0"_xsv, result->stringval); + } + + { + auto result = RAII{xmlXPathEvalExpression(BAD_CAST("string(/sys-sage/components/Topology/@name)"), pathContext), xmlXPathFreeObject}; + ASSERT_EQ("sys-sage Topology"_xsv, result->stringval); + } + + ASSERT_NO_THROW(getSingleNodeByPath(BAD_CAST("/sys-sage/components/Topology/Memory"), pathContext)); + + { + auto result = RAII{xmlXPathEvalExpression(BAD_CAST("string(/sys-sage/components/Topology/Memory/@id)"), pathContext), xmlXPathFreeObject}; + ASSERT_EQ("0"_xsv, result->stringval); + } + + { + auto result = RAII{xmlXPathEvalExpression(BAD_CAST("string(/sys-sage/components/Topology/Memory/@name)"), pathContext), xmlXPathFreeObject}; + ASSERT_EQ("A single memory component"_xsv, result->stringval); + } + + { + auto result = RAII{xmlXPathEvalExpression(BAD_CAST("string(/sys-sage/components/Topology/Memory/@size)"), pathContext), xmlXPathFreeObject}; + ASSERT_EQ("16"_xsv, result->stringval); + } + } +} diff --git a/test/raii.cpp b/test/raii.cpp new file mode 100644 index 0000000..33c33d4 --- /dev/null +++ b/test/raii.cpp @@ -0,0 +1,35 @@ +#include "raii.hpp" + +#include "gtest/gtest.h" +#include "gmock/gmock.h" + +TEST(RAII, InnerCannotBeNull) +{ + ASSERT_ANY_THROW(RAII(reinterpret_cast(0), free)); + ASSERT_ANY_THROW(RAII(reinterpret_cast(0), [](void *) {})); +} + +TEST(RAII, DestructorRuns) +{ + int x = 0; + { + RAII raii{&x, [](int *x) + { *x = 42; }}; + ASSERT_EQ(x, 0); + ASSERT_EQ(*static_cast(raii), 0); + } + ASSERT_EQ(x, 42); +} + +TEST(RAII, MoveOwnership) +{ + int x = 0; + { + RAII r0{&x, [](int *x) + { *x += 1; }}; + RAII r1{std::move(r0)}; + ASSERT_EQ(x, 0); + ASSERT_EQ(*static_cast(r1), 0); + } + ASSERT_EQ(x, 1); +} diff --git a/test/raii.hpp b/test/raii.hpp new file mode 100644 index 0000000..bbc566f --- /dev/null +++ b/test/raii.hpp @@ -0,0 +1,91 @@ +#pragma once + +#include +#include + +/** + * A container which implements RAII (Resource acquisition is initialization) for + * automatic destructor dispatch. + */ +template +class RAII +{ + using Dtor = void (*)(T *); + + T *inner; /** The acquired value. Is never null. */ + Dtor dtor; /** The destructor to run during de-initialization. */ + +public: + /** + * Constructs a new RAII object owning an inner value and an associated destructor. + */ + RAII(T *inner, Dtor dtor) + : inner{inner}, dtor{dtor} + { + if (inner == nullptr) + { + throw std::runtime_error{"Failed to acquire test resource"}; + } + } + + /** + * Sometimes, the destructor accepts a generic `void *` instead of the concrete value type. + */ + RAII(T *inner, void (*dtor)(void *)) + requires(!std::is_same_v) + : inner{inner}, dtor{reinterpret_cast(dtor)} + { + if (inner == nullptr) + { + throw std::runtime_error{"Failed to acquire test resource"}; + } + } + + RAII(const RAII &) = delete; + + /** + * Transfer ownership. + */ + RAII(RAII &&rhs) : inner{rhs.inner}, dtor{rhs.dtor} + { + rhs.dtor = nullptr; + } + + RAII &operator=(const RAII &) = delete; + + RAII &operator=(RAII &&rhs) + { + inner = rhs.inner; + dtor = rhs.dtor; + rhs.dtor = nullptr; + }; + + ~RAII() + { + if (dtor != nullptr) + { + dtor(inner); + } + } + + T *operator->() + { + return inner; + } + + operator T *() + { + return inner; + } + + T *operator*() + { + return inner; + } +}; + +template +RAII(T *, D) -> RAII; + +template +RAII(void *, D) -> RAII; diff --git a/test/schema.xml b/test/resources/schema.xml similarity index 100% rename from test/schema.xml rename to test/resources/schema.xml diff --git a/test/sys-sage_sample_output.xml b/test/resources/sys-sage_sample_output.xml similarity index 100% rename from test/sys-sage_sample_output.xml rename to test/resources/sys-sage_sample_output.xml diff --git a/test/test.cpp b/test/test.cpp index b244505..38d57bb 100644 --- a/test/test.cpp +++ b/test/test.cpp @@ -1,12 +1,6 @@ #include "sys-sage.hpp" #include "gtest/gtest.h" -#include "gmock/gmock.h" - -#include -#include -#include -#include #include @@ -15,239 +9,3 @@ int main(int argc, char **argv) testing::InitGoogleTest(&argc, argv); return RUN_ALL_TESTS(); } - -/** - * Create a string view over UTF-8 code points as used by libxml. - */ -std::basic_string_view operator""_xsv(const char *string, size_t len) -{ - return {BAD_CAST(string), len}; -} - -/** - * A container which implements RAII (Resource acquisition is initialization) for - * automatic destructor dispatch. - */ -template -class RAII -{ - using Dtor = void (*)(T *); - - T *inner; /** The acquired value. Is never null. */ - Dtor dtor; /** The destructor to run during de-initialization. */ - -public: - /** - * Constructs a new RAII object owning an inner value and an associated destructor. - */ - RAII(T *inner, Dtor dtor) - : inner{inner}, dtor{dtor} - { - if (inner == nullptr) - { - throw std::runtime_error{"Failed to acquire test resource"}; - } - } - - /** - * Sometimes, the destructor accepts a generic `void *` instead of the concrete value type. - */ - RAII(T *inner, void (*dtor)(void *)) - requires(!std::is_same_v) - : inner{inner}, dtor{reinterpret_cast(dtor)} - { - if (inner == nullptr) - { - throw std::runtime_error{"Failed to acquire test resource"}; - } - } - - RAII(const RAII &) = delete; - - /** - * Transfer ownership. - */ - RAII(RAII &&rhs) : inner{rhs.inner}, dtor{rhs.dtor} - { - rhs.dtor = nullptr; - } - - RAII &operator=(const RAII &) = delete; - - RAII &operator=(RAII &&rhs) - { - inner = rhs.inner; - dtor = rhs.dtor; - rhs.dtor = nullptr; - }; - - ~RAII() - { - if (dtor != nullptr) - { - dtor(inner); - } - } - - T *operator->() - { - return inner; - } - - operator T *() - { - return inner; - } - - T *operator*() - { - return inner; - } -}; - -template -RAII(T *, D) -> RAII; - -template -RAII(void *, D) -> RAII; - -TEST(RAII, InnerCannotBeNull) -{ - ASSERT_ANY_THROW(RAII(reinterpret_cast(0), free)); - ASSERT_ANY_THROW(RAII(reinterpret_cast(0), [](void *) {})); -} - -TEST(RAII, DestructorRuns) -{ - int x = 0; - { - RAII raii{&x, [](int *x) - { *x = 42; }}; - ASSERT_EQ(x, 0); - ASSERT_EQ(*static_cast(raii), 0); - } - ASSERT_EQ(x, 42); -} - -TEST(RAII, MoveOwnership) -{ - int x = 0; - { - RAII r0{&x, [](int *x) - { *x += 1; }}; - RAII r1{std::move(r0)}; - ASSERT_EQ(x, 0); - ASSERT_EQ(*static_cast(r1), 0); - } - ASSERT_EQ(x, 1); -} - -/** - * Validates XML output of sys-sage using an XML schema file. - */ -void validate(std::string_view path) -{ - auto parser = RAII{xmlSchemaNewParserCtxt(TEST_RESOURCE_DIR "/schema.xml"), xmlSchemaFreeParserCtxt}; - if (parser == nullptr) - { - throw std::runtime_error{""}; - } - - auto schema = RAII{xmlSchemaParse(parser), xmlSchemaFree}; - - auto validator = RAII{xmlSchemaNewValidCtxt(schema), xmlSchemaFreeValidCtxt}; - if (validator == nullptr) - { - throw std::runtime_error{""}; - } - - xmlSchemaSetValidErrors(validator, (xmlSchemaValidityErrorFunc)fprintf, (xmlSchemaValidityWarningFunc)fprintf, stdout); - - auto doc = RAII{xmlParseFile(path.data()), xmlFreeDoc}; - if (doc == nullptr) - { - std::string message{"Cannot open "}; - message += path; - message += " for validation"; - throw std::runtime_error{message}; - } - - int code = xmlSchemaValidateDoc(validator, doc); - if (code != 0) - { - std::string message{"XML validation of "}; - message += path; - message += " failed"; - throw std::runtime_error{message}; - } -} - -TEST(ExportToXml, MinimalTopology) -{ - auto topo = new Component{42, "a name", SYS_SAGE_COMPONENT_NONE}; - exportToXml(topo, "test_export.xml"); - validate("test_export.xml"); -} - -TEST(ExportToXml, SampleOutput) -{ - validate("sys-sage_sample_output.xml"); -} - -xmlNode *getSingleNodeByPath(xmlChar *path, xmlXPathContext *context) -{ - auto result = RAII{xmlXPathEvalExpression(path, context), xmlXPathFreeObject}; - if (result->nodesetval == nullptr || result->type != XPATH_NODESET || result->nodesetval->nodeNr != 1) - { - std::string message{"Invalid query with path "}; - message += reinterpret_cast(path); - throw std::runtime_error{message}; - } - return result->nodesetval->nodeTab[0]; -} - -TEST(ExportToXml, SingleComponent) -{ - { - auto topo = new Topology; - auto memory = new Memory{topo, "A single memory component", 16}; - (void)memory; - exportToXml(topo, "test_export.xml"); - } - - { - validate("test_export.xml"); - - auto doc = RAII{xmlParseFile("test_export.xml"), xmlFreeDoc}; - auto pathContext = RAII{xmlXPathNewContext(doc), xmlXPathFreeContext}; - - ASSERT_NO_THROW(getSingleNodeByPath(BAD_CAST("/sys-sage/components/Topology"), pathContext)); - - { - auto result = RAII{xmlXPathEvalExpression(BAD_CAST("string(/sys-sage/components/Topology/@id)"), pathContext), xmlXPathFreeObject}; - ASSERT_EQ("0"_xsv, result->stringval); - } - - { - auto result = RAII{xmlXPathEvalExpression(BAD_CAST("string(/sys-sage/components/Topology/@name)"), pathContext), xmlXPathFreeObject}; - ASSERT_EQ("sys-sage Topology"_xsv, result->stringval); - } - - ASSERT_NO_THROW(getSingleNodeByPath(BAD_CAST("/sys-sage/components/Topology/Memory"), pathContext)); - - { - auto result = RAII{xmlXPathEvalExpression(BAD_CAST("string(/sys-sage/components/Topology/Memory/@id)"), pathContext), xmlXPathFreeObject}; - ASSERT_EQ("0"_xsv, result->stringval); - } - - { - auto result = RAII{xmlXPathEvalExpression(BAD_CAST("string(/sys-sage/components/Topology/Memory/@name)"), pathContext), xmlXPathFreeObject}; - ASSERT_EQ("A single memory component"_xsv, result->stringval); - } - - { - auto result = RAII{xmlXPathEvalExpression(BAD_CAST("string(/sys-sage/components/Topology/Memory/@size)"), pathContext), xmlXPathFreeObject}; - ASSERT_EQ("16"_xsv, result->stringval); - } - } -} From 1aa5376eba519d7a609e65707feb93cea63e3a8d Mon Sep 17 00:00:00 2001 From: Jim Eckerlein Date: Tue, 21 Feb 2023 21:44:12 +0100 Subject: [PATCH 010/102] Fix test resource access --- test/CMakeLists.txt | 2 +- test/export.cpp | 9 ++++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 871960b..36c7a3f 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -3,4 +3,4 @@ add_subdirectory(googletest) add_executable(test test.cpp raii.cpp raii.hpp export.cpp) target_link_libraries(test PRIVATE sys-sage gtest gmock) include_directories(../src) # The include path is not set in the sys-sage target because CMAKE_INCLUDE_CURRENT_DIR is used instead -target_compile_definitions(test PRIVATE TEST_RESOURCE_DIR="${CMAKE_CURRENT_SOURCE_DIR}/resources") +target_compile_definitions(test PRIVATE SYS_SAGE_TEST_RESOURCE_DIR="${CMAKE_CURRENT_SOURCE_DIR}/resources") diff --git a/test/export.cpp b/test/export.cpp index a40dc94..8fbc544 100644 --- a/test/export.cpp +++ b/test/export.cpp @@ -9,6 +9,8 @@ #include "raii.hpp" +#include + /** * Create a string view over UTF-8 code points as used by libxml. */ @@ -22,13 +24,14 @@ std::basic_string_view operator""_xsv(const char *string, size_t */ void validate(std::string_view path) { - auto parser = RAII{xmlSchemaNewParserCtxt(TEST_RESOURCE_DIR "/schema.xml"), xmlSchemaFreeParserCtxt}; + auto parser = std::unique_ptr{xmlSchemaNewParserCtxt(SYS_SAGE_TEST_RESOURCE_DIR "/schema.xml"), xmlSchemaFreeParserCtxt}; + if (parser == nullptr) { throw std::runtime_error{""}; } - auto schema = RAII{xmlSchemaParse(parser), xmlSchemaFree}; + auto schema = RAII{xmlSchemaParse(parser.get()), xmlSchemaFree}; auto validator = RAII{xmlSchemaNewValidCtxt(schema), xmlSchemaFreeValidCtxt}; if (validator == nullptr) @@ -66,7 +69,7 @@ TEST(ExportToXml, MinimalTopology) TEST(ExportToXml, SampleOutput) { - validate("sys-sage_sample_output.xml"); + validate(SYS_SAGE_TEST_RESOURCE_DIR "/sys-sage_sample_output.xml"); } xmlNode *getSingleNodeByPath(xmlChar *path, xmlXPathContext *context) From 4ab531c2ccff0018b005e75d9ddad54fd145281f Mon Sep 17 00:00:00 2001 From: Jim Eckerlein Date: Tue, 21 Feb 2023 21:56:29 +0100 Subject: [PATCH 011/102] Use unique_ptr instead of own RAII implementation --- test/CMakeLists.txt | 2 +- test/export.cpp | 56 ++++++++++++++-------------- test/raii.cpp | 35 ----------------- test/raii.hpp | 91 --------------------------------------------- 4 files changed, 30 insertions(+), 154 deletions(-) delete mode 100644 test/raii.cpp delete mode 100644 test/raii.hpp diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 36c7a3f..3ad91a1 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -1,6 +1,6 @@ add_subdirectory(googletest) -add_executable(test test.cpp raii.cpp raii.hpp export.cpp) +add_executable(test test.cpp export.cpp) target_link_libraries(test PRIVATE sys-sage gtest gmock) include_directories(../src) # The include path is not set in the sys-sage target because CMAKE_INCLUDE_CURRENT_DIR is used instead target_compile_definitions(test PRIVATE SYS_SAGE_TEST_RESOURCE_DIR="${CMAKE_CURRENT_SOURCE_DIR}/resources") diff --git a/test/export.cpp b/test/export.cpp index 8fbc544..138f51d 100644 --- a/test/export.cpp +++ b/test/export.cpp @@ -7,8 +7,6 @@ #include "sys-sage.hpp" -#include "raii.hpp" - #include /** @@ -19,29 +17,25 @@ std::basic_string_view operator""_xsv(const char *string, size_t return {BAD_CAST(string), len}; } +template +using raii = std::unique_ptr; + /** * Validates XML output of sys-sage using an XML schema file. */ void validate(std::string_view path) { - auto parser = std::unique_ptr{xmlSchemaNewParserCtxt(SYS_SAGE_TEST_RESOURCE_DIR "/schema.xml"), xmlSchemaFreeParserCtxt}; - - if (parser == nullptr) - { - throw std::runtime_error{""}; - } + auto parser = raii{xmlSchemaNewParserCtxt(SYS_SAGE_TEST_RESOURCE_DIR "/schema.xml"), xmlSchemaFreeParserCtxt}; + ASSERT_NE(parser, nullptr); - auto schema = RAII{xmlSchemaParse(parser.get()), xmlSchemaFree}; + auto schema = raii{xmlSchemaParse(parser.get()), xmlSchemaFree}; + ASSERT_NE(schema, nullptr); - auto validator = RAII{xmlSchemaNewValidCtxt(schema), xmlSchemaFreeValidCtxt}; - if (validator == nullptr) - { - throw std::runtime_error{""}; - } + auto validator = raii{xmlSchemaNewValidCtxt(schema.get()), xmlSchemaFreeValidCtxt}; - xmlSchemaSetValidErrors(validator, (xmlSchemaValidityErrorFunc)fprintf, (xmlSchemaValidityWarningFunc)fprintf, stdout); + xmlSchemaSetValidErrors(validator.get(), (xmlSchemaValidityErrorFunc)fprintf, (xmlSchemaValidityWarningFunc)fprintf, stdout); - auto doc = RAII{xmlParseFile(path.data()), xmlFreeDoc}; + auto doc = raii{xmlParseFile(path.data()), xmlFreeDoc}; if (doc == nullptr) { std::string message{"Cannot open "}; @@ -50,7 +44,7 @@ void validate(std::string_view path) throw std::runtime_error{message}; } - int code = xmlSchemaValidateDoc(validator, doc); + int code = xmlSchemaValidateDoc(validator.get(), doc.get()); if (code != 0) { std::string message{"XML validation of "}; @@ -74,7 +68,7 @@ TEST(ExportToXml, SampleOutput) xmlNode *getSingleNodeByPath(xmlChar *path, xmlXPathContext *context) { - auto result = RAII{xmlXPathEvalExpression(path, context), xmlXPathFreeObject}; + auto result = raii{xmlXPathEvalExpression(path, context), xmlXPathFreeObject}; if (result->nodesetval == nullptr || result->type != XPATH_NODESET || result->nodesetval->nodeNr != 1) { std::string message{"Invalid query with path "}; @@ -96,35 +90,43 @@ TEST(ExportToXml, SingleComponent) { validate("test_export.xml"); - auto doc = RAII{xmlParseFile("test_export.xml"), xmlFreeDoc}; - auto pathContext = RAII{xmlXPathNewContext(doc), xmlXPathFreeContext}; + auto doc = raii{xmlParseFile("test_export.xml"), xmlFreeDoc}; + ASSERT_NE(doc, nullptr); + + auto pathContext = raii{xmlXPathNewContext(doc.get()), xmlXPathFreeContext}; + ASSERT_NE(pathContext, nullptr); - ASSERT_NO_THROW(getSingleNodeByPath(BAD_CAST("/sys-sage/components/Topology"), pathContext)); + ASSERT_NO_THROW(getSingleNodeByPath(BAD_CAST("/sys-sage/components/Topology"), pathContext.get())); { - auto result = RAII{xmlXPathEvalExpression(BAD_CAST("string(/sys-sage/components/Topology/@id)"), pathContext), xmlXPathFreeObject}; + auto result = raii{xmlXPathEvalExpression(BAD_CAST("string(/sys-sage/components/Topology/@id)"), pathContext.get()), xmlXPathFreeObject}; + ASSERT_NE(result, nullptr); ASSERT_EQ("0"_xsv, result->stringval); } { - auto result = RAII{xmlXPathEvalExpression(BAD_CAST("string(/sys-sage/components/Topology/@name)"), pathContext), xmlXPathFreeObject}; + auto result = raii{xmlXPathEvalExpression(BAD_CAST("string(/sys-sage/components/Topology/@name)"), pathContext.get()), xmlXPathFreeObject}; + ASSERT_NE(result, nullptr); ASSERT_EQ("sys-sage Topology"_xsv, result->stringval); } - ASSERT_NO_THROW(getSingleNodeByPath(BAD_CAST("/sys-sage/components/Topology/Memory"), pathContext)); + ASSERT_NO_THROW(getSingleNodeByPath(BAD_CAST("/sys-sage/components/Topology/Memory"), pathContext.get())); { - auto result = RAII{xmlXPathEvalExpression(BAD_CAST("string(/sys-sage/components/Topology/Memory/@id)"), pathContext), xmlXPathFreeObject}; + auto result = raii{xmlXPathEvalExpression(BAD_CAST("string(/sys-sage/components/Topology/Memory/@id)"), pathContext.get()), xmlXPathFreeObject}; + ASSERT_NE(result, nullptr); ASSERT_EQ("0"_xsv, result->stringval); } { - auto result = RAII{xmlXPathEvalExpression(BAD_CAST("string(/sys-sage/components/Topology/Memory/@name)"), pathContext), xmlXPathFreeObject}; + auto result = raii{xmlXPathEvalExpression(BAD_CAST("string(/sys-sage/components/Topology/Memory/@name)"), pathContext.get()), xmlXPathFreeObject}; + ASSERT_NE(result, nullptr); ASSERT_EQ("A single memory component"_xsv, result->stringval); } { - auto result = RAII{xmlXPathEvalExpression(BAD_CAST("string(/sys-sage/components/Topology/Memory/@size)"), pathContext), xmlXPathFreeObject}; + auto result = raii{xmlXPathEvalExpression(BAD_CAST("string(/sys-sage/components/Topology/Memory/@size)"), pathContext.get()), xmlXPathFreeObject}; + ASSERT_NE(result, nullptr); ASSERT_EQ("16"_xsv, result->stringval); } } diff --git a/test/raii.cpp b/test/raii.cpp deleted file mode 100644 index 33c33d4..0000000 --- a/test/raii.cpp +++ /dev/null @@ -1,35 +0,0 @@ -#include "raii.hpp" - -#include "gtest/gtest.h" -#include "gmock/gmock.h" - -TEST(RAII, InnerCannotBeNull) -{ - ASSERT_ANY_THROW(RAII(reinterpret_cast(0), free)); - ASSERT_ANY_THROW(RAII(reinterpret_cast(0), [](void *) {})); -} - -TEST(RAII, DestructorRuns) -{ - int x = 0; - { - RAII raii{&x, [](int *x) - { *x = 42; }}; - ASSERT_EQ(x, 0); - ASSERT_EQ(*static_cast(raii), 0); - } - ASSERT_EQ(x, 42); -} - -TEST(RAII, MoveOwnership) -{ - int x = 0; - { - RAII r0{&x, [](int *x) - { *x += 1; }}; - RAII r1{std::move(r0)}; - ASSERT_EQ(x, 0); - ASSERT_EQ(*static_cast(r1), 0); - } - ASSERT_EQ(x, 1); -} diff --git a/test/raii.hpp b/test/raii.hpp deleted file mode 100644 index bbc566f..0000000 --- a/test/raii.hpp +++ /dev/null @@ -1,91 +0,0 @@ -#pragma once - -#include -#include - -/** - * A container which implements RAII (Resource acquisition is initialization) for - * automatic destructor dispatch. - */ -template -class RAII -{ - using Dtor = void (*)(T *); - - T *inner; /** The acquired value. Is never null. */ - Dtor dtor; /** The destructor to run during de-initialization. */ - -public: - /** - * Constructs a new RAII object owning an inner value and an associated destructor. - */ - RAII(T *inner, Dtor dtor) - : inner{inner}, dtor{dtor} - { - if (inner == nullptr) - { - throw std::runtime_error{"Failed to acquire test resource"}; - } - } - - /** - * Sometimes, the destructor accepts a generic `void *` instead of the concrete value type. - */ - RAII(T *inner, void (*dtor)(void *)) - requires(!std::is_same_v) - : inner{inner}, dtor{reinterpret_cast(dtor)} - { - if (inner == nullptr) - { - throw std::runtime_error{"Failed to acquire test resource"}; - } - } - - RAII(const RAII &) = delete; - - /** - * Transfer ownership. - */ - RAII(RAII &&rhs) : inner{rhs.inner}, dtor{rhs.dtor} - { - rhs.dtor = nullptr; - } - - RAII &operator=(const RAII &) = delete; - - RAII &operator=(RAII &&rhs) - { - inner = rhs.inner; - dtor = rhs.dtor; - rhs.dtor = nullptr; - }; - - ~RAII() - { - if (dtor != nullptr) - { - dtor(inner); - } - } - - T *operator->() - { - return inner; - } - - operator T *() - { - return inner; - } - - T *operator*() - { - return inner; - } -}; - -template -RAII(T *, D) -> RAII; - -template -RAII(void *, D) -> RAII; From f272b48d9dccd6228b3dad97bb69344a97699e89 Mon Sep 17 00:00:00 2001 From: Jim Eckerlein Date: Tue, 21 Feb 2023 21:57:06 +0100 Subject: [PATCH 012/102] Ignore .vscode --- .gitignore | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.gitignore b/.gitignore index aa555c6..362a1dc 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,5 @@ main *.so build/* install/* + +.vscode From 06df5e6dc4415c48386a41b91e43fe04b0ef9dbb Mon Sep 17 00:00:00 2001 From: Jim Eckerlein Date: Wed, 22 Feb 2023 17:41:55 +0100 Subject: [PATCH 013/102] Fix schema --- test/resources/schema.xml | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/test/resources/schema.xml b/test/resources/schema.xml index 9013514..b9beea2 100644 --- a/test/resources/schema.xml +++ b/test/resources/schema.xml @@ -36,19 +36,21 @@ - - - - - - - - - - - - - + + + + + + + + + + + + + + + From e5fb8c6e43d0edca9f77037913631ba7321e0406 Mon Sep 17 00:00:00 2001 From: Jim Eckerlein Date: Sat, 25 Feb 2023 13:56:55 +0100 Subject: [PATCH 014/102] Add attributes to the schema --- test/export.cpp | 5 + test/resources/schema.xml | 14 + test/resources/sys-sage_custom_attributes.xml | 309 ++++++++++++++++++ 3 files changed, 328 insertions(+) create mode 100644 test/resources/sys-sage_custom_attributes.xml diff --git a/test/export.cpp b/test/export.cpp index 138f51d..53a4050 100644 --- a/test/export.cpp +++ b/test/export.cpp @@ -66,6 +66,11 @@ TEST(ExportToXml, SampleOutput) validate(SYS_SAGE_TEST_RESOURCE_DIR "/sys-sage_sample_output.xml"); } +TEST(ExportToXml, SampleOutputWithAttributes) +{ + validate(SYS_SAGE_TEST_RESOURCE_DIR "/sys-sage_custom_attributes.xml"); +} + xmlNode *getSingleNodeByPath(xmlChar *path, xmlXPathContext *context) { auto result = raii{xmlXPathEvalExpression(path, context), xmlXPathFreeObject}; diff --git a/test/resources/schema.xml b/test/resources/schema.xml index b9beea2..7b99fc1 100644 --- a/test/resources/schema.xml +++ b/test/resources/schema.xml @@ -18,6 +18,10 @@ + + + @@ -49,10 +53,20 @@ + + + + + + + + + + diff --git a/test/resources/sys-sage_custom_attributes.xml b/test/resources/sys-sage_custom_attributes.xml new file mode 100644 index 0000000..c573b6c --- /dev/null +++ b/test/resources/sys-sage_custom_attributes.xml @@ -0,0 +1,309 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file From f80624d79cbf0d7124e28f0692120753dab0f881 Mon Sep 17 00:00:00 2001 From: Jim Eckerlein Date: Wed, 1 Mar 2023 15:51:32 +0100 Subject: [PATCH 015/102] Validate that attributes --- test/export.cpp | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/test/export.cpp b/test/export.cpp index 53a4050..627c83f 100644 --- a/test/export.cpp +++ b/test/export.cpp @@ -20,6 +20,9 @@ std::basic_string_view operator""_xsv(const char *string, size_t template using raii = std::unique_ptr; +void validateAttributes() {} +void validateSourceTargets() {} + /** * Validates XML output of sys-sage using an XML schema file. */ @@ -52,6 +55,30 @@ void validate(std::string_view path) message += " failed"; throw std::runtime_error{message}; } + + // Validate that attributes either have child nodes or a value attribute + { + auto pathContext = raii{xmlXPathNewContext(doc.get()), xmlXPathFreeContext}; + ASSERT_NE(pathContext, nullptr); + + auto attributeNodes = raii{xmlXPathEvalExpression(BAD_CAST("//Attribute"), pathContext.get()), xmlXPathFreeObject}; + ASSERT_NE(attributeNodes->nodesetval, nullptr); + ASSERT_EQ(attributeNodes->type, XPATH_NODESET); + for (int i = 0; i < attributeNodes->nodesetval->nodeNr; ++i) + { + xmlNode *node = attributeNodes->nodesetval->nodeTab[i]; + bool hasChildren = node->children != nullptr; + + auto attributes = raii{xmlXPathNodeEval(node, BAD_CAST("@value"), pathContext.get()), xmlXPathFreeObject}; + bool hasValueAttribute = attributes->nodesetval->nodeNr > 0; + + bool hasNeither = !(hasChildren || hasValueAttribute); + bool hasEitherChildrenOrValueAttribute = hasChildren != hasValueAttribute; + + EXPECT_TRUE(hasEitherChildrenOrValueAttribute || hasNeither) + << path << ':' << node->line << " must have either child nodes or a value attribute"; + } + } } TEST(ExportToXml, MinimalTopology) From 24809d580b28d7bee3e1ef37308d56fa6108cf1a Mon Sep 17 00:00:00 2001 From: Jim Eckerlein Date: Wed, 1 Mar 2023 15:54:36 +0100 Subject: [PATCH 016/102] Reduce boiler plate code by using relative XPaths --- test/export.cpp | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/test/export.cpp b/test/export.cpp index 627c83f..f4075ad 100644 --- a/test/export.cpp +++ b/test/export.cpp @@ -128,36 +128,38 @@ TEST(ExportToXml, SingleComponent) auto pathContext = raii{xmlXPathNewContext(doc.get()), xmlXPathFreeContext}; ASSERT_NE(pathContext, nullptr); - ASSERT_NO_THROW(getSingleNodeByPath(BAD_CAST("/sys-sage/components/Topology"), pathContext.get())); + xmlNode *topo = nullptr; + ASSERT_NO_THROW(topo = getSingleNodeByPath(BAD_CAST("/sys-sage/components/Topology"), pathContext.get())); { - auto result = raii{xmlXPathEvalExpression(BAD_CAST("string(/sys-sage/components/Topology/@id)"), pathContext.get()), xmlXPathFreeObject}; + auto result = raii{xmlXPathNodeEval(topo, BAD_CAST("string(@id)"), pathContext.get()), xmlXPathFreeObject}; ASSERT_NE(result, nullptr); ASSERT_EQ("0"_xsv, result->stringval); } { - auto result = raii{xmlXPathEvalExpression(BAD_CAST("string(/sys-sage/components/Topology/@name)"), pathContext.get()), xmlXPathFreeObject}; + auto result = raii{xmlXPathNodeEval(topo, BAD_CAST("string(@name)"), pathContext.get()), xmlXPathFreeObject}; ASSERT_NE(result, nullptr); ASSERT_EQ("sys-sage Topology"_xsv, result->stringval); } - ASSERT_NO_THROW(getSingleNodeByPath(BAD_CAST("/sys-sage/components/Topology/Memory"), pathContext.get())); + xmlNode *memory = nullptr; + ASSERT_NO_THROW(memory = getSingleNodeByPath(BAD_CAST("/sys-sage/components/Topology/Memory"), pathContext.get())); { - auto result = raii{xmlXPathEvalExpression(BAD_CAST("string(/sys-sage/components/Topology/Memory/@id)"), pathContext.get()), xmlXPathFreeObject}; + auto result = raii{xmlXPathNodeEval(memory, BAD_CAST("string(@id)"), pathContext.get()), xmlXPathFreeObject}; ASSERT_NE(result, nullptr); ASSERT_EQ("0"_xsv, result->stringval); } { - auto result = raii{xmlXPathEvalExpression(BAD_CAST("string(/sys-sage/components/Topology/Memory/@name)"), pathContext.get()), xmlXPathFreeObject}; + auto result = raii{xmlXPathNodeEval(memory, BAD_CAST("string(@name)"), pathContext.get()), xmlXPathFreeObject}; ASSERT_NE(result, nullptr); ASSERT_EQ("A single memory component"_xsv, result->stringval); } { - auto result = raii{xmlXPathEvalExpression(BAD_CAST("string(/sys-sage/components/Topology/Memory/@size)"), pathContext.get()), xmlXPathFreeObject}; + auto result = raii{xmlXPathNodeEval(memory, BAD_CAST("string(@size)"), pathContext.get()), xmlXPathFreeObject}; ASSERT_NE(result, nullptr); ASSERT_EQ("16"_xsv, result->stringval); } From 7732b3d0e31ddecce5746a7a24903994d6287915 Mon Sep 17 00:00:00 2001 From: Jim Eckerlein Date: Wed, 1 Mar 2023 15:55:33 +0100 Subject: [PATCH 017/102] Ignore test exports --- .gitignore | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.gitignore b/.gitignore index 362a1dc..6351f8b 100644 --- a/.gitignore +++ b/.gitignore @@ -7,3 +7,5 @@ build/* install/* .vscode + +test_export.xml From 794ede6b2a4a29530ea98eab584abeda55ed8e76 Mon Sep 17 00:00:00 2001 From: Jim Eckerlein Date: Wed, 1 Mar 2023 16:18:03 +0100 Subject: [PATCH 018/102] Validate component addresses --- test/export.cpp | 48 ++++++++++++++++--- test/resources/sys-sage_custom_attributes.xml | 4 +- 2 files changed, 43 insertions(+), 9 deletions(-) diff --git a/test/export.cpp b/test/export.cpp index f4075ad..b2d7cc5 100644 --- a/test/export.cpp +++ b/test/export.cpp @@ -8,11 +8,15 @@ #include "sys-sage.hpp" #include +#include +#include + +using XmlStringView = std::basic_string_view; /** * Create a string view over UTF-8 code points as used by libxml. */ -std::basic_string_view operator""_xsv(const char *string, size_t len) +XmlStringView operator""_xsv(const char *string, size_t len) { return {BAD_CAST(string), len}; } @@ -20,9 +24,6 @@ std::basic_string_view operator""_xsv(const char *string, size_t template using raii = std::unique_ptr; -void validateAttributes() {} -void validateSourceTargets() {} - /** * Validates XML output of sys-sage using an XML schema file. */ @@ -56,11 +57,11 @@ void validate(std::string_view path) throw std::runtime_error{message}; } + auto pathContext = raii{xmlXPathNewContext(doc.get()), xmlXPathFreeContext}; + ASSERT_NE(pathContext, nullptr); + // Validate that attributes either have child nodes or a value attribute { - auto pathContext = raii{xmlXPathNewContext(doc.get()), xmlXPathFreeContext}; - ASSERT_NE(pathContext, nullptr); - auto attributeNodes = raii{xmlXPathEvalExpression(BAD_CAST("//Attribute"), pathContext.get()), xmlXPathFreeObject}; ASSERT_NE(attributeNodes->nodesetval, nullptr); ASSERT_EQ(attributeNodes->type, XPATH_NODESET); @@ -79,6 +80,39 @@ void validate(std::string_view path) << path << ':' << node->line << " must have either child nodes or a value attribute"; } } + + // Validate that all component addresses are unique and that all data path endpoints exist + { + auto componentAddrs = raii{xmlXPathEvalExpression(BAD_CAST("/sys-sage/components//*/@addr"), pathContext.get()), xmlXPathFreeObject}; + auto dataPathEndpoints = raii{ + xmlXPathEvalExpression(BAD_CAST("/sys-sage/data-paths/datapath/@source | /sys-sage/data-paths/datapath/@target"), pathContext.get()), + xmlXPathFreeObject}; + + std::set addrs; + + if (componentAddrs->nodesetval != nullptr && componentAddrs->nodesetval->nodeNr > 0) + { + for (int i = 0; i < componentAddrs->nodesetval->nodeNr; ++i) + { + auto node = componentAddrs->nodesetval->nodeTab[i]; + XmlStringView addr = node->children->content; + EXPECT_FALSE(addrs.contains(addr)) + << path << ':' << node->children->line << " The addr attribute must be unique for each component"; + addrs.insert(addr); + } + } + + if (dataPathEndpoints->nodesetval != nullptr && dataPathEndpoints->nodesetval->nodeNr > 0) + { + for (int i = 0; i < dataPathEndpoints->nodesetval->nodeNr; ++i) + { + auto endpoint = dataPathEndpoints->nodesetval->nodeTab[i]; + XmlStringView addr = endpoint->children->content; + EXPECT_TRUE(addrs.contains(addr)) + << path << ':' << endpoint->children->line << " The data path endpoint must be an existing component address"; + } + } + } } TEST(ExportToXml, MinimalTopology) diff --git a/test/resources/sys-sage_custom_attributes.xml b/test/resources/sys-sage_custom_attributes.xml index c573b6c..111b0e8 100644 --- a/test/resources/sys-sage_custom_attributes.xml +++ b/test/resources/sys-sage_custom_attributes.xml @@ -21,9 +21,9 @@ - - Date: Wed, 1 Mar 2023 16:58:35 +0100 Subject: [PATCH 019/102] Test topology constructors, setters and getters --- test/CMakeLists.txt | 2 +- test/topology.cpp | 136 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 137 insertions(+), 1 deletion(-) create mode 100644 test/topology.cpp diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 3ad91a1..3b10cb3 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -1,6 +1,6 @@ add_subdirectory(googletest) -add_executable(test test.cpp export.cpp) +add_executable(test test.cpp topology.cpp export.cpp) target_link_libraries(test PRIVATE sys-sage gtest gmock) include_directories(../src) # The include path is not set in the sys-sage target because CMAKE_INCLUDE_CURRENT_DIR is used instead target_compile_definitions(test PRIVATE SYS_SAGE_TEST_RESOURCE_DIR="${CMAKE_CURRENT_SOURCE_DIR}/resources") diff --git a/test/topology.cpp b/test/topology.cpp new file mode 100644 index 0000000..1dc100c --- /dev/null +++ b/test/topology.cpp @@ -0,0 +1,136 @@ +#include "gtest/gtest.h" + +#include "sys-sage.hpp" + +TEST(Components, Node) +{ + Node node{42}; + EXPECT_EQ(42, node.GetId()); + EXPECT_EQ(SYS_SAGE_COMPONENT_NODE, node.GetComponentType()); + // TODO: Parent should be nullified + // EXPECT_EQ(nullptr, node.GetParent()); + + Node root{0}; + node.SetParent(&root); + EXPECT_EQ(&root, node.GetParent()); +} + +TEST(Components, Topology) +{ + Topology node; + EXPECT_EQ(0, node.GetId()); + EXPECT_EQ(SYS_SAGE_COMPONENT_TOPOLOGY, node.GetComponentType()); +} + +TEST(Components, Thread) +{ + Node root{0}; + Thread node{&root, 42, "foo"}; + EXPECT_EQ(&root, node.GetParent()); + EXPECT_EQ(42, node.GetId()); + EXPECT_EQ("foo", node.GetName()); + EXPECT_EQ(SYS_SAGE_COMPONENT_THREAD, node.GetComponentType()); +} + +TEST(Components, Core) +{ + Node root{0}; + Core node{&root, 42, "foo"}; + EXPECT_EQ(&root, node.GetParent()); + EXPECT_EQ(42, node.GetId()); + EXPECT_EQ("foo", node.GetName()); + EXPECT_EQ(SYS_SAGE_COMPONENT_CORE, node.GetComponentType()); +} + +TEST(Components, Cache) +{ + Node root{0}; + Cache node{&root, 42, "3", 32, 2, 16}; + EXPECT_EQ(&root, node.GetParent()); + EXPECT_EQ(42, node.GetId()); + EXPECT_EQ("Cache", node.GetName()); + EXPECT_EQ("3", node.GetCacheName()); + EXPECT_EQ(3, node.GetCacheLevel()); + EXPECT_EQ(32, node.GetCacheSize()); + EXPECT_EQ(2, node.GetCacheAssociativityWays()); + EXPECT_EQ(16, node.GetCacheLineSize()); + EXPECT_EQ(SYS_SAGE_COMPONENT_CACHE, node.GetComponentType()); + + node.SetCacheSize(16); + EXPECT_EQ(16, node.GetCacheSize()); + + node.SetCacheLineSize(8); + EXPECT_EQ(8, node.GetCacheLineSize()); +} + +TEST(Components, Subdivision) +{ + Node root{0}; + Subdivision node{&root, 42, "foo"}; + EXPECT_EQ(&root, node.GetParent()); + EXPECT_EQ(42, node.GetId()); + EXPECT_EQ("foo", node.GetName()); + EXPECT_EQ(SYS_SAGE_COMPONENT_SUBDIVISION, node.GetComponentType()); + + node.SetSubdivisionType(3); + EXPECT_EQ(3, node.GetSubdivisionType()); +} + +TEST(Components, Numa) +{ + Node root{0}; + Numa node{&root, 42, 64}; + EXPECT_EQ(&root, node.GetParent()); + EXPECT_EQ(42, node.GetId()); + EXPECT_EQ("Numa", node.GetName()); + EXPECT_EQ(SYS_SAGE_COMPONENT_NUMA, node.GetComponentType()); + + node.SetSubdivisionType(3); + EXPECT_EQ(3, node.GetSubdivisionType()); +} + +TEST(Components, Chip) +{ + Node root{0}; + Chip node{&root, 42, "foo", 5}; + EXPECT_EQ(&root, node.GetParent()); + EXPECT_EQ(42, node.GetId()); + EXPECT_EQ("foo", node.GetName()); + EXPECT_EQ(SYS_SAGE_COMPONENT_CHIP, node.GetComponentType()); + EXPECT_EQ(5, node.GetChipType()); + + node.SetModel("model"); + EXPECT_EQ("model", node.GetModel()); + + node.SetVendor("vendor"); + EXPECT_EQ("vendor", node.GetVendor()); + + node.SetChipType(6); + EXPECT_EQ(6, node.GetChipType()); +} + +TEST(Components, Memory) +{ + Node root{0}; + Memory node{&root, "foo", 32}; + EXPECT_EQ(&root, node.GetParent()); + EXPECT_EQ(0, node.GetId()); + EXPECT_EQ("foo", node.GetName()); + EXPECT_EQ(32, node.GetSize()); + EXPECT_EQ(SYS_SAGE_COMPONENT_MEMORY, node.GetComponentType()); + + node.SetSize(64); + EXPECT_EQ(64, node.GetSize()); +} + +TEST(Components, Storage) +{ + Node root{0}; + Storage node{&root}; + EXPECT_EQ(&root, node.GetParent()); + EXPECT_EQ(SYS_SAGE_COMPONENT_STORAGE, node.GetComponentType()); + + // TODO: Enable when implementation is available + // node.SetSize(64); + // EXPECT_EQ(64, node.GetSize()); +} From 126940b39b959187bdbc67ab6007270549053981 Mon Sep 17 00:00:00 2001 From: Jim Eckerlein Date: Wed, 1 Mar 2023 17:02:12 +0100 Subject: [PATCH 020/102] Test CheckComponentTreeConsistency --- test/topology.cpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/test/topology.cpp b/test/topology.cpp index 1dc100c..7480f17 100644 --- a/test/topology.cpp +++ b/test/topology.cpp @@ -134,3 +134,20 @@ TEST(Components, Storage) // node.SetSize(64); // EXPECT_EQ(64, node.GetSize()); } + +TEST(Components, CheckComponentTreeConsistency) +{ + { + Node a{}; + Node b{&a}; + Node c{&b}; + EXPECT_EQ(0, a.CheckComponentTreeConsistency()); + } + { + Node a{}; + Node b{&a}; + Node c{&b}; + c.SetParent(&a); + EXPECT_EQ(1, a.CheckComponentTreeConsistency()); + } +} From c1b716483f331ddb2d2f519a651c861b8450b538 Mon Sep 17 00:00:00 2001 From: Jim Eckerlein Date: Wed, 1 Mar 2023 18:00:25 +0100 Subject: [PATCH 021/102] Test complex component functions --- test/topology.cpp | 191 ++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 185 insertions(+), 6 deletions(-) diff --git a/test/topology.cpp b/test/topology.cpp index 7480f17..ed42784 100644 --- a/test/topology.cpp +++ b/test/topology.cpp @@ -7,6 +7,7 @@ TEST(Components, Node) Node node{42}; EXPECT_EQ(42, node.GetId()); EXPECT_EQ(SYS_SAGE_COMPONENT_NODE, node.GetComponentType()); + EXPECT_EQ("Node", node.GetComponentTypeStr()); // TODO: Parent should be nullified // EXPECT_EQ(nullptr, node.GetParent()); @@ -20,6 +21,7 @@ TEST(Components, Topology) Topology node; EXPECT_EQ(0, node.GetId()); EXPECT_EQ(SYS_SAGE_COMPONENT_TOPOLOGY, node.GetComponentType()); + EXPECT_EQ("Topology", node.GetComponentTypeStr()); } TEST(Components, Thread) @@ -30,6 +32,7 @@ TEST(Components, Thread) EXPECT_EQ(42, node.GetId()); EXPECT_EQ("foo", node.GetName()); EXPECT_EQ(SYS_SAGE_COMPONENT_THREAD, node.GetComponentType()); + EXPECT_EQ("HW_thread", node.GetComponentTypeStr()); } TEST(Components, Core) @@ -40,6 +43,7 @@ TEST(Components, Core) EXPECT_EQ(42, node.GetId()); EXPECT_EQ("foo", node.GetName()); EXPECT_EQ(SYS_SAGE_COMPONENT_CORE, node.GetComponentType()); + EXPECT_EQ("Core", node.GetComponentTypeStr()); } TEST(Components, Cache) @@ -55,6 +59,7 @@ TEST(Components, Cache) EXPECT_EQ(2, node.GetCacheAssociativityWays()); EXPECT_EQ(16, node.GetCacheLineSize()); EXPECT_EQ(SYS_SAGE_COMPONENT_CACHE, node.GetComponentType()); + EXPECT_EQ("Cache", node.GetComponentTypeStr()); node.SetCacheSize(16); EXPECT_EQ(16, node.GetCacheSize()); @@ -71,6 +76,7 @@ TEST(Components, Subdivision) EXPECT_EQ(42, node.GetId()); EXPECT_EQ("foo", node.GetName()); EXPECT_EQ(SYS_SAGE_COMPONENT_SUBDIVISION, node.GetComponentType()); + EXPECT_EQ("Subdivision", node.GetComponentTypeStr()); node.SetSubdivisionType(3); EXPECT_EQ(3, node.GetSubdivisionType()); @@ -84,6 +90,7 @@ TEST(Components, Numa) EXPECT_EQ(42, node.GetId()); EXPECT_EQ("Numa", node.GetName()); EXPECT_EQ(SYS_SAGE_COMPONENT_NUMA, node.GetComponentType()); + EXPECT_EQ("NUMA", node.GetComponentTypeStr()); node.SetSubdivisionType(3); EXPECT_EQ(3, node.GetSubdivisionType()); @@ -97,6 +104,7 @@ TEST(Components, Chip) EXPECT_EQ(42, node.GetId()); EXPECT_EQ("foo", node.GetName()); EXPECT_EQ(SYS_SAGE_COMPONENT_CHIP, node.GetComponentType()); + EXPECT_EQ("Chip", node.GetComponentTypeStr()); EXPECT_EQ(5, node.GetChipType()); node.SetModel("model"); @@ -118,6 +126,7 @@ TEST(Components, Memory) EXPECT_EQ("foo", node.GetName()); EXPECT_EQ(32, node.GetSize()); EXPECT_EQ(SYS_SAGE_COMPONENT_MEMORY, node.GetComponentType()); + EXPECT_EQ("Memory", node.GetComponentTypeStr()); node.SetSize(64); EXPECT_EQ(64, node.GetSize()); @@ -129,25 +138,195 @@ TEST(Components, Storage) Storage node{&root}; EXPECT_EQ(&root, node.GetParent()); EXPECT_EQ(SYS_SAGE_COMPONENT_STORAGE, node.GetComponentType()); + EXPECT_EQ("Storage", node.GetComponentTypeStr()); // TODO: Enable when implementation is available // node.SetSize(64); // EXPECT_EQ(64, node.GetSize()); } +TEST(Components, ChildrenInsertionAndRemoval) +{ + Node a; + Node b; + Node c; + Node d; + + a.InsertChild(&b); + a.InsertChild(&c); + a.InsertChild(&d); + ASSERT_EQ(3, a.GetChildren()->size()); + + ASSERT_EQ(1, a.RemoveChild(&b)); + ASSERT_EQ(2, a.GetChildren()->size()); + ASSERT_EQ(std::find(a.GetChildren()->begin(), a.GetChildren()->end(), &b), a.GetChildren()->end()); + ASSERT_NE(std::find(a.GetChildren()->begin(), a.GetChildren()->end(), &c), a.GetChildren()->end()); + ASSERT_NE(std::find(a.GetChildren()->begin(), a.GetChildren()->end(), &d), a.GetChildren()->end()); +} + +TEST(Components, GetChild) +{ + Node a{1}; + Node b{2}; + Node c{3}; + Node d{4}; + + a.InsertChild(&b); + a.InsertChild(&c); + b.InsertChild(&d); + + EXPECT_EQ(a.GetChild(2), &b); + EXPECT_EQ(a.GetChild(3), &c); + EXPECT_EQ(a.GetChild(4), nullptr); +} + +TEST(Components, GetChildByType) +{ + Node a; + Memory b; + Memory c; + Chip d; + + a.InsertChild(&b); + a.InsertChild(&c); + a.InsertChild(&d); + + EXPECT_EQ(a.GetChildByType(SYS_SAGE_COMPONENT_MEMORY), &b); + EXPECT_EQ(a.GetChildByType(SYS_SAGE_COMPONENT_CHIP), &d); + EXPECT_EQ(a.GetAllChildrenByType(SYS_SAGE_COMPONENT_MEMORY), (std::vector{&b, &c})); +} + TEST(Components, CheckComponentTreeConsistency) { { - Node a{}; - Node b{&a}; - Node c{&b}; + Node a; + Node b; + Node c; + a.InsertChild(&b); + b.InsertChild(&c); EXPECT_EQ(0, a.CheckComponentTreeConsistency()); } { - Node a{}; - Node b{&a}; - Node c{&b}; + Node a; + Node b; + Node c; + a.InsertChild(&b); + b.InsertChild(&c); c.SetParent(&a); EXPECT_EQ(1, a.CheckComponentTreeConsistency()); } } + +TEST(Components, GetComponentsNLevelsDeeper) +{ + Node a; + Node b; + Node c; + Node d; + + a.InsertChild(&b); + a.InsertChild(&c); + c.InsertChild(&d); + + std::vector array; + a.GetComponentsNLevelsDeeper(&array, 1); + EXPECT_EQ(2, array.size()); +} + +TEST(Components, GetSubcomponentsByType) +{ + Node a; + Chip b; + Memory c; + Chip d; + + a.InsertChild(&b); + a.InsertChild(&c); + c.InsertChild(&d); + + std::vector array; + a.GetSubcomponentsByType(&array, SYS_SAGE_COMPONENT_CHIP); + EXPECT_EQ(2, array.size()); +} + +TEST(Components, GetNumThreads) +{ + Node a; + Thread b; + Thread c; + Node d; + Thread e; + Node f; + + a.InsertChild(&b); + a.InsertChild(&c); + a.InsertChild(&d); + d.InsertChild(&e); + d.InsertChild(&f); + + EXPECT_EQ(3, a.GetNumThreads()); +} + +TEST(Components, GetSubtreeNodeList) +{ + Node a; + Node b; + Node c; + Node d; + + a.InsertChild(&b); + b.InsertChild(&d); + a.InsertChild(&c); + + std::vector array; + a.GetSubtreeNodeList(&array); + EXPECT_EQ(array, (std::vector{&a, &b, &d, &c})); +} + +TEST(Components, GetTopoTreeDepth) +{ + Node a; + Node b; + Node c; + Node d; + Node e; + Node f; + Node g; + + a.InsertChild(&b); + b.InsertChild(&c); + a.InsertChild(&d); + d.InsertChild(&e); + e.InsertChild(&f); + a.InsertChild(&g); + + // a -> b -> c + // \> d -> e -> f + // \> g + + EXPECT_EQ(3, a.GetTopoTreeDepth()); +} + +TEST(Components, GetTopologySize) +{ + Chip a; + Memory b; + + // TODO: Add data paths + + { + + unsigned size = 0; + unsigned dataPathSize = 0; + EXPECT_LE(sizeof(Chip), a.GetTopologySize(&size, &dataPathSize)); + } + + { + unsigned size = 0; + unsigned dataPathSize = 0; + a.InsertChild(&b); + EXPECT_LE(sizeof(Chip) + sizeof(Memory), a.GetTopologySize(&size, &dataPathSize)); + EXPECT_LE(0, dataPathSize); + EXPECT_LE(sizeof(Chip) + sizeof(Memory), size); + } +} From 4801139715f22c1c035983952038558d3bd5d5e1 Mon Sep 17 00:00:00 2001 From: Jim Eckerlein Date: Tue, 7 Mar 2023 15:57:39 +0100 Subject: [PATCH 022/102] Add datapath tests --- test/CMakeLists.txt | 2 +- test/datapath.cpp | 120 ++++++++++++++++++++++++++++++++++++++++++++ test/topology.cpp | 40 +++++++++------ 3 files changed, 145 insertions(+), 17 deletions(-) create mode 100644 test/datapath.cpp diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 3b10cb3..1160909 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -1,6 +1,6 @@ add_subdirectory(googletest) -add_executable(test test.cpp topology.cpp export.cpp) +add_executable(test test.cpp topology.cpp datapath.cpp export.cpp) target_link_libraries(test PRIVATE sys-sage gtest gmock) include_directories(../src) # The include path is not set in the sys-sage target because CMAKE_INCLUDE_CURRENT_DIR is used instead target_compile_definitions(test PRIVATE SYS_SAGE_TEST_RESOURCE_DIR="${CMAKE_CURRENT_SOURCE_DIR}/resources") diff --git a/test/datapath.cpp b/test/datapath.cpp new file mode 100644 index 0000000..a35d92e --- /dev/null +++ b/test/datapath.cpp @@ -0,0 +1,120 @@ +#include "gtest/gtest.h" + +#include "sys-sage.hpp" + +TEST(DataPath, Constructors) +{ + Component a, b; + { + DataPath dp{&a, &b, SYS_SAGE_DATAPATH_ORIENTED, SYS_SAGE_DATAPATH_TYPE_PHYSICAL}; + EXPECT_EQ(&a, dp.GetSource()); + EXPECT_EQ(&b, dp.GetTarget()); + EXPECT_EQ(SYS_SAGE_DATAPATH_ORIENTED, dp.GetOriented()); + EXPECT_EQ(SYS_SAGE_DATAPATH_TYPE_PHYSICAL, dp.GetDpType()); + } + { + DataPath dp{&a, &b, SYS_SAGE_DATAPATH_ORIENTED, 5.0, 42.0}; + EXPECT_EQ(&a, dp.GetSource()); + EXPECT_EQ(&b, dp.GetTarget()); + EXPECT_EQ(SYS_SAGE_DATAPATH_ORIENTED, dp.GetOriented()); + EXPECT_EQ(SYS_SAGE_DATAPATH_TYPE_NONE, dp.GetDpType()); + EXPECT_EQ(5.0, dp.GetBw()); + EXPECT_EQ(42.0, dp.GetLatency()); + } + { + DataPath dp{&a, &b, SYS_SAGE_DATAPATH_ORIENTED, SYS_SAGE_DATAPATH_TYPE_PHYSICAL, 5.0, 42.0}; + EXPECT_EQ(&a, dp.GetSource()); + EXPECT_EQ(&b, dp.GetTarget()); + EXPECT_EQ(SYS_SAGE_DATAPATH_ORIENTED, dp.GetOriented()); + EXPECT_EQ(SYS_SAGE_DATAPATH_TYPE_PHYSICAL, dp.GetDpType()); + EXPECT_EQ(5.0, dp.GetBw()); + EXPECT_EQ(42.0, dp.GetLatency()); + } +} + +TEST(DataPath, UnidirectionalDataPath) +{ + Component a, b; + DataPath dp{&a, &b, SYS_SAGE_DATAPATH_ORIENTED, SYS_SAGE_DATAPATH_TYPE_PHYSICAL}; + + ASSERT_NE(nullptr, a.GetDataPaths(SYS_SAGE_DATAPATH_INCOMING)); + ASSERT_NE(nullptr, a.GetDataPaths(SYS_SAGE_DATAPATH_OUTGOING)); + EXPECT_TRUE(a.GetDataPaths(SYS_SAGE_DATAPATH_INCOMING)->empty()); + EXPECT_EQ((std::vector{&dp}), *a.GetDataPaths(SYS_SAGE_DATAPATH_OUTGOING)); + + ASSERT_NE(nullptr, b.GetDataPaths(SYS_SAGE_DATAPATH_INCOMING)); + ASSERT_NE(nullptr, b.GetDataPaths(SYS_SAGE_DATAPATH_OUTGOING)); + EXPECT_EQ((std::vector{&dp}), *b.GetDataPaths(SYS_SAGE_DATAPATH_INCOMING)); + EXPECT_TRUE(b.GetDataPaths(SYS_SAGE_DATAPATH_OUTGOING)->empty()); +} + +TEST(DataPath, BidirectionalDataPath) +{ + Component a, b; + DataPath dp{&a, &b, SYS_SAGE_DATAPATH_BIDIRECTIONAL, SYS_SAGE_DATAPATH_TYPE_PHYSICAL}; + + ASSERT_NE(nullptr, a.GetDataPaths(SYS_SAGE_DATAPATH_INCOMING)); + ASSERT_NE(nullptr, a.GetDataPaths(SYS_SAGE_DATAPATH_OUTGOING)); + EXPECT_EQ((std::vector{&dp}), *a.GetDataPaths(SYS_SAGE_DATAPATH_INCOMING)); + EXPECT_EQ((std::vector{&dp}), *a.GetDataPaths(SYS_SAGE_DATAPATH_OUTGOING)); + + ASSERT_NE(nullptr, b.GetDataPaths(SYS_SAGE_DATAPATH_INCOMING)); + ASSERT_NE(nullptr, b.GetDataPaths(SYS_SAGE_DATAPATH_OUTGOING)); + EXPECT_EQ((std::vector{&dp}), *b.GetDataPaths(SYS_SAGE_DATAPATH_INCOMING)); + EXPECT_EQ((std::vector{&dp}), *b.GetDataPaths(SYS_SAGE_DATAPATH_OUTGOING)); +} + +TEST(DataPath, GetDpByType) +{ + Component a, b; + DataPath dp1{&a, &b, SYS_SAGE_DATAPATH_ORIENTED, SYS_SAGE_DATAPATH_TYPE_LOGICAL}; + DataPath dp2{&a, &b, SYS_SAGE_DATAPATH_ORIENTED, SYS_SAGE_DATAPATH_TYPE_PHYSICAL}; + DataPath dp3{&a, &b, SYS_SAGE_DATAPATH_ORIENTED, SYS_SAGE_DATAPATH_TYPE_PHYSICAL}; + DataPath dp4{&b, &a, SYS_SAGE_DATAPATH_ORIENTED, SYS_SAGE_DATAPATH_TYPE_PHYSICAL}; + + EXPECT_EQ(&dp1, a.GetDpByType(SYS_SAGE_DATAPATH_TYPE_LOGICAL, SYS_SAGE_DATAPATH_OUTGOING)); + EXPECT_EQ(&dp2, a.GetDpByType(SYS_SAGE_DATAPATH_TYPE_PHYSICAL, SYS_SAGE_DATAPATH_OUTGOING)); + EXPECT_EQ(nullptr, a.GetDpByType(SYS_SAGE_DATAPATH_TYPE_L3CAT, SYS_SAGE_DATAPATH_OUTGOING)); + EXPECT_EQ(&dp4, a.GetDpByType(SYS_SAGE_DATAPATH_TYPE_PHYSICAL, SYS_SAGE_DATAPATH_INCOMING)); + EXPECT_EQ(&dp4, b.GetDpByType(SYS_SAGE_DATAPATH_TYPE_PHYSICAL, SYS_SAGE_DATAPATH_OUTGOING)); + EXPECT_EQ(&dp4, b.GetDpByType(SYS_SAGE_DATAPATH_TYPE_PHYSICAL, SYS_SAGE_DATAPATH_INCOMING | SYS_SAGE_DATAPATH_OUTGOING)); +} + +TEST(DataPath, GetAllDpByType) +{ + Component a, b; + DataPath dp1{&a, &b, SYS_SAGE_DATAPATH_ORIENTED, SYS_SAGE_DATAPATH_TYPE_LOGICAL}; + DataPath dp2{&a, &b, SYS_SAGE_DATAPATH_ORIENTED, SYS_SAGE_DATAPATH_TYPE_PHYSICAL}; + DataPath dp3{&a, &b, SYS_SAGE_DATAPATH_ORIENTED, SYS_SAGE_DATAPATH_TYPE_PHYSICAL}; + DataPath dp4{&b, &a, SYS_SAGE_DATAPATH_ORIENTED, SYS_SAGE_DATAPATH_TYPE_PHYSICAL}; + + { + std::vector v; + a.GetAllDpByType(&v, SYS_SAGE_DATAPATH_TYPE_LOGICAL, SYS_SAGE_DATAPATH_INCOMING); + EXPECT_TRUE(v.empty()); + } + + { + std::vector v; + a.GetAllDpByType(&v, SYS_SAGE_DATAPATH_TYPE_PHYSICAL, SYS_SAGE_DATAPATH_INCOMING); + EXPECT_EQ((std::vector{&dp4}), v); + } + + { + std::vector v; + a.GetAllDpByType(&v, SYS_SAGE_DATAPATH_TYPE_LOGICAL, SYS_SAGE_DATAPATH_OUTGOING); + EXPECT_EQ((std::vector{&dp1}), v); + } + + { + std::vector v; + a.GetAllDpByType(&v, SYS_SAGE_DATAPATH_TYPE_PHYSICAL, SYS_SAGE_DATAPATH_OUTGOING); + EXPECT_EQ((std::vector{&dp2, &dp3}), v); + } + + { + std::vector v; + a.GetAllDpByType(&v, SYS_SAGE_DATAPATH_TYPE_PHYSICAL, SYS_SAGE_DATAPATH_INCOMING | SYS_SAGE_DATAPATH_OUTGOING); + EXPECT_EQ((std::vector{&dp2, &dp3, &dp4}), v); + } +} diff --git a/test/topology.cpp b/test/topology.cpp index ed42784..76b9d4c 100644 --- a/test/topology.cpp +++ b/test/topology.cpp @@ -300,33 +300,41 @@ TEST(Components, GetTopoTreeDepth) e.InsertChild(&f); a.InsertChild(&g); - // a -> b -> c - // \> d -> e -> f - // \> g - EXPECT_EQ(3, a.GetTopoTreeDepth()); } TEST(Components, GetTopologySize) { - Chip a; - Memory b; - - // TODO: Add data paths - { - - unsigned size = 0; + Chip a; + Memory b; + unsigned componentSize = 0; unsigned dataPathSize = 0; - EXPECT_LE(sizeof(Chip), a.GetTopologySize(&size, &dataPathSize)); + EXPECT_LE(sizeof(Chip), a.GetTopologySize(&componentSize, &dataPathSize)); } { - unsigned size = 0; - unsigned dataPathSize = 0; + Chip a; + Memory b; a.InsertChild(&b); - EXPECT_LE(sizeof(Chip) + sizeof(Memory), a.GetTopologySize(&size, &dataPathSize)); + unsigned componentSize = 0; + unsigned dataPathSize = 0; + EXPECT_LE(sizeof(Chip) + sizeof(Memory), a.GetTopologySize(&componentSize, &dataPathSize)); EXPECT_LE(0, dataPathSize); - EXPECT_LE(sizeof(Chip) + sizeof(Memory), size); + EXPECT_LE(sizeof(Chip) + sizeof(Memory), componentSize); + } + + { + Chip a; + Memory b; + DataPath dp1{&a, &b, SYS_SAGE_DATAPATH_ORIENTED, SYS_SAGE_DATAPATH_TYPE_PHYSICAL}; + DataPath dp2{&b, &a, SYS_SAGE_DATAPATH_ORIENTED, SYS_SAGE_DATAPATH_TYPE_LOGICAL}; + dp1.attrib.emplace("foo", nullptr); + unsigned componentSize = 0; + unsigned dataPathSize = 0; + auto size = a.GetTopologySize(&componentSize, &dataPathSize); + EXPECT_LE(sizeof(Chip), componentSize); + EXPECT_LE((2 * (sizeof(DataPath *) + sizeof(DataPath)) + sizeof(std::string) + sizeof(void *)), dataPathSize); + EXPECT_LE(componentSize + dataPathSize, size); } } From 8e8a54e097481a77299660f767d52faaa1aea458 Mon Sep 17 00:00:00 2001 From: Jim Eckerlein Date: Wed, 8 Mar 2023 11:45:00 +0100 Subject: [PATCH 023/102] Remove GetTopologySize test --- test/topology.cpp | 36 ------------------------------------ 1 file changed, 36 deletions(-) diff --git a/test/topology.cpp b/test/topology.cpp index 76b9d4c..0beea7e 100644 --- a/test/topology.cpp +++ b/test/topology.cpp @@ -302,39 +302,3 @@ TEST(Components, GetTopoTreeDepth) EXPECT_EQ(3, a.GetTopoTreeDepth()); } - -TEST(Components, GetTopologySize) -{ - { - Chip a; - Memory b; - unsigned componentSize = 0; - unsigned dataPathSize = 0; - EXPECT_LE(sizeof(Chip), a.GetTopologySize(&componentSize, &dataPathSize)); - } - - { - Chip a; - Memory b; - a.InsertChild(&b); - unsigned componentSize = 0; - unsigned dataPathSize = 0; - EXPECT_LE(sizeof(Chip) + sizeof(Memory), a.GetTopologySize(&componentSize, &dataPathSize)); - EXPECT_LE(0, dataPathSize); - EXPECT_LE(sizeof(Chip) + sizeof(Memory), componentSize); - } - - { - Chip a; - Memory b; - DataPath dp1{&a, &b, SYS_SAGE_DATAPATH_ORIENTED, SYS_SAGE_DATAPATH_TYPE_PHYSICAL}; - DataPath dp2{&b, &a, SYS_SAGE_DATAPATH_ORIENTED, SYS_SAGE_DATAPATH_TYPE_LOGICAL}; - dp1.attrib.emplace("foo", nullptr); - unsigned componentSize = 0; - unsigned dataPathSize = 0; - auto size = a.GetTopologySize(&componentSize, &dataPathSize); - EXPECT_LE(sizeof(Chip), componentSize); - EXPECT_LE((2 * (sizeof(DataPath *) + sizeof(DataPath)) + sizeof(std::string) + sizeof(void *)), dataPathSize); - EXPECT_LE(componentSize + dataPathSize, size); - } -} From 92cf001ab37232d4fd32304e2948c656bc5f2a8a Mon Sep 17 00:00:00 2001 From: Jim Eckerlein Date: Wed, 8 Mar 2023 11:47:17 +0100 Subject: [PATCH 024/102] =?UTF-8?q?Add=20definitions=20for=20Storage::SetS?= =?UTF-8?q?ize=20and=C2=A0GetSize?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Topology.hpp | 4 ++-- test/topology.cpp | 5 ++--- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/Topology.hpp b/src/Topology.hpp index 3585f5f..47c3e48 100644 --- a/src/Topology.hpp +++ b/src/Topology.hpp @@ -400,8 +400,8 @@ class Storage : public Component { */ Storage(); Storage(Component * parent); - long long GetSize(); - void SetSize(long long _size); + long long GetSize() { return size; }; + void SetSize(long long _size) { size = _size; }; /** !!Should normally not be used!! Helper function of XML dump generation. @see exportToXml(Component* root, string path = "", std::function custom_search_attrib_key_fcn = NULL); diff --git a/test/topology.cpp b/test/topology.cpp index 0beea7e..5cb5171 100644 --- a/test/topology.cpp +++ b/test/topology.cpp @@ -140,9 +140,8 @@ TEST(Components, Storage) EXPECT_EQ(SYS_SAGE_COMPONENT_STORAGE, node.GetComponentType()); EXPECT_EQ("Storage", node.GetComponentTypeStr()); - // TODO: Enable when implementation is available - // node.SetSize(64); - // EXPECT_EQ(64, node.GetSize()); + node.SetSize(64); + EXPECT_EQ(64, node.GetSize()); } TEST(Components, ChildrenInsertionAndRemoval) From 18660b1689a5368eb2772d88a944d46dea8f6e13 Mon Sep 17 00:00:00 2001 From: Jim Eckerlein Date: Wed, 8 Mar 2023 11:48:25 +0100 Subject: [PATCH 025/102] Nullify parent pointer --- src/Topology.hpp | 2 +- test/topology.cpp | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/Topology.hpp b/src/Topology.hpp index 47c3e48..3653482 100644 --- a/src/Topology.hpp +++ b/src/Topology.hpp @@ -296,7 +296,7 @@ class Component { */ const int componentType; vector children; /**< Contains the list (std::vector) of pointers to children of the component in the component tree. */ - Component* parent; /**< Contains pointer to the parent component in the component tree. If this component is the root, parent will be NULL.*/ + Component* parent { nullptr }; /**< Contains pointer to the parent component in the component tree. If this component is the root, parent will be NULL.*/ vector dp_incoming; /**< Contains references to data paths that point to this component. @see DataPath */ vector dp_outgoing; /**< Contains references to data paths that point from this component. @see DataPath */ diff --git a/test/topology.cpp b/test/topology.cpp index 5cb5171..acd21bd 100644 --- a/test/topology.cpp +++ b/test/topology.cpp @@ -8,8 +8,7 @@ TEST(Components, Node) EXPECT_EQ(42, node.GetId()); EXPECT_EQ(SYS_SAGE_COMPONENT_NODE, node.GetComponentType()); EXPECT_EQ("Node", node.GetComponentTypeStr()); - // TODO: Parent should be nullified - // EXPECT_EQ(nullptr, node.GetParent()); + EXPECT_EQ(nullptr, node.GetParent()); Node root{0}; node.SetParent(&root); From fa6d71870269ec59bc9c63e20e9763469ba7c42e Mon Sep 17 00:00:00 2001 From: Jim Eckerlein Date: Wed, 8 Mar 2023 11:50:47 +0100 Subject: [PATCH 026/102] Rename test suites --- test/export.cpp | 8 ++++---- test/topology.cpp | 38 +++++++++++++++++++------------------- 2 files changed, 23 insertions(+), 23 deletions(-) diff --git a/test/export.cpp b/test/export.cpp index b2d7cc5..c3f2161 100644 --- a/test/export.cpp +++ b/test/export.cpp @@ -115,19 +115,19 @@ void validate(std::string_view path) } } -TEST(ExportToXml, MinimalTopology) +TEST(Export, MinimalTopology) { auto topo = new Component{42, "a name", SYS_SAGE_COMPONENT_NONE}; exportToXml(topo, "test_export.xml"); validate("test_export.xml"); } -TEST(ExportToXml, SampleOutput) +TEST(Export, SampleOutput) { validate(SYS_SAGE_TEST_RESOURCE_DIR "/sys-sage_sample_output.xml"); } -TEST(ExportToXml, SampleOutputWithAttributes) +TEST(Export, SampleOutputWithAttributes) { validate(SYS_SAGE_TEST_RESOURCE_DIR "/sys-sage_custom_attributes.xml"); } @@ -144,7 +144,7 @@ xmlNode *getSingleNodeByPath(xmlChar *path, xmlXPathContext *context) return result->nodesetval->nodeTab[0]; } -TEST(ExportToXml, SingleComponent) +TEST(Export, SingleComponent) { { auto topo = new Topology; diff --git a/test/topology.cpp b/test/topology.cpp index acd21bd..4fcaab6 100644 --- a/test/topology.cpp +++ b/test/topology.cpp @@ -2,7 +2,7 @@ #include "sys-sage.hpp" -TEST(Components, Node) +TEST(Topology, Node) { Node node{42}; EXPECT_EQ(42, node.GetId()); @@ -15,7 +15,7 @@ TEST(Components, Node) EXPECT_EQ(&root, node.GetParent()); } -TEST(Components, Topology) +TEST(Topology, Topology) { Topology node; EXPECT_EQ(0, node.GetId()); @@ -23,7 +23,7 @@ TEST(Components, Topology) EXPECT_EQ("Topology", node.GetComponentTypeStr()); } -TEST(Components, Thread) +TEST(Topology, Thread) { Node root{0}; Thread node{&root, 42, "foo"}; @@ -34,7 +34,7 @@ TEST(Components, Thread) EXPECT_EQ("HW_thread", node.GetComponentTypeStr()); } -TEST(Components, Core) +TEST(Topology, Core) { Node root{0}; Core node{&root, 42, "foo"}; @@ -45,7 +45,7 @@ TEST(Components, Core) EXPECT_EQ("Core", node.GetComponentTypeStr()); } -TEST(Components, Cache) +TEST(Topology, Cache) { Node root{0}; Cache node{&root, 42, "3", 32, 2, 16}; @@ -67,7 +67,7 @@ TEST(Components, Cache) EXPECT_EQ(8, node.GetCacheLineSize()); } -TEST(Components, Subdivision) +TEST(Topology, Subdivision) { Node root{0}; Subdivision node{&root, 42, "foo"}; @@ -81,7 +81,7 @@ TEST(Components, Subdivision) EXPECT_EQ(3, node.GetSubdivisionType()); } -TEST(Components, Numa) +TEST(Topology, Numa) { Node root{0}; Numa node{&root, 42, 64}; @@ -95,7 +95,7 @@ TEST(Components, Numa) EXPECT_EQ(3, node.GetSubdivisionType()); } -TEST(Components, Chip) +TEST(Topology, Chip) { Node root{0}; Chip node{&root, 42, "foo", 5}; @@ -116,7 +116,7 @@ TEST(Components, Chip) EXPECT_EQ(6, node.GetChipType()); } -TEST(Components, Memory) +TEST(Topology, Memory) { Node root{0}; Memory node{&root, "foo", 32}; @@ -131,7 +131,7 @@ TEST(Components, Memory) EXPECT_EQ(64, node.GetSize()); } -TEST(Components, Storage) +TEST(Topology, Storage) { Node root{0}; Storage node{&root}; @@ -143,7 +143,7 @@ TEST(Components, Storage) EXPECT_EQ(64, node.GetSize()); } -TEST(Components, ChildrenInsertionAndRemoval) +TEST(Topology, ChildrenInsertionAndRemoval) { Node a; Node b; @@ -162,7 +162,7 @@ TEST(Components, ChildrenInsertionAndRemoval) ASSERT_NE(std::find(a.GetChildren()->begin(), a.GetChildren()->end(), &d), a.GetChildren()->end()); } -TEST(Components, GetChild) +TEST(Topology, GetChild) { Node a{1}; Node b{2}; @@ -178,7 +178,7 @@ TEST(Components, GetChild) EXPECT_EQ(a.GetChild(4), nullptr); } -TEST(Components, GetChildByType) +TEST(Topology, GetChildByType) { Node a; Memory b; @@ -194,7 +194,7 @@ TEST(Components, GetChildByType) EXPECT_EQ(a.GetAllChildrenByType(SYS_SAGE_COMPONENT_MEMORY), (std::vector{&b, &c})); } -TEST(Components, CheckComponentTreeConsistency) +TEST(Topology, CheckComponentTreeConsistency) { { Node a; @@ -215,7 +215,7 @@ TEST(Components, CheckComponentTreeConsistency) } } -TEST(Components, GetComponentsNLevelsDeeper) +TEST(Topology, GetComponentsNLevelsDeeper) { Node a; Node b; @@ -231,7 +231,7 @@ TEST(Components, GetComponentsNLevelsDeeper) EXPECT_EQ(2, array.size()); } -TEST(Components, GetSubcomponentsByType) +TEST(Topology, GetSubcomponentsByType) { Node a; Chip b; @@ -247,7 +247,7 @@ TEST(Components, GetSubcomponentsByType) EXPECT_EQ(2, array.size()); } -TEST(Components, GetNumThreads) +TEST(Topology, GetNumThreads) { Node a; Thread b; @@ -265,7 +265,7 @@ TEST(Components, GetNumThreads) EXPECT_EQ(3, a.GetNumThreads()); } -TEST(Components, GetSubtreeNodeList) +TEST(Topology, GetSubtreeNodeList) { Node a; Node b; @@ -281,7 +281,7 @@ TEST(Components, GetSubtreeNodeList) EXPECT_EQ(array, (std::vector{&a, &b, &d, &c})); } -TEST(Components, GetTopoTreeDepth) +TEST(Topology, GetTopoTreeDepth) { Node a; Node b; From 4493e0a86d3294ee95e655fd45aea2e0bf44ebeb Mon Sep 17 00:00:00 2001 From: Jim Eckerlein Date: Wed, 8 Mar 2023 12:18:14 +0100 Subject: [PATCH 027/102] Initialize count of component --- src/Topology.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Topology.hpp b/src/Topology.hpp index 3653482..da498d1 100644 --- a/src/Topology.hpp +++ b/src/Topology.hpp @@ -278,7 +278,7 @@ class Component { int id; /**< Numeric ID of the component. There is no requirement for uniqueness of the ID, however it is advised to have unique IDs at least in the realm of parent's children. Some tree search functions, which take the id as a search parameter search for first match, so the user is responsible to manage uniqueness in the realm of the search subtree (or should be aware of the consequences of not doing so). Component's ID is set by the constructor, and is retrieved via int GetId(); */ int depth; /**< TODO not implemented */ string name; /**< Name of the component (as a string). */ - int count; /**< Can be used to represent multiple Components with the same properties. By default, it represents only 1 component, and is set to -1. */ + int count{-1}; /**< Can be used to represent multiple Components with the same properties. By default, it represents only 1 component, and is set to -1. */ /** Component type of the component. The component type denotes of which class the instance is (Often the components are stored as Component*, even though they are a member of one of the child classes) \n This attribute is constant, set by the constructor, and READONLY. From 49f612ae81f6b1e163f138b88de121a606d2c203 Mon Sep 17 00:00:00 2001 From: Jim Eckerlein Date: Wed, 8 Mar 2023 12:29:33 +0100 Subject: [PATCH 028/102] Test custom attributes --- test/export.cpp | 138 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 138 insertions(+) diff --git a/test/export.cpp b/test/export.cpp index c3f2161..6fc7d9f 100644 --- a/test/export.cpp +++ b/test/export.cpp @@ -199,3 +199,141 @@ TEST(Export, SingleComponent) } } } + +TEST(Export, CustomAttributes) +{ + { + Topology topo; + Node node{&topo, 1}; + + std::string codename = "marsupial"; + std::string foo = "foo"; + int rackNo = 15; + node.attrib["codename"] = reinterpret_cast(&codename); + node.attrib["rack_no"] = reinterpret_cast(&rackNo); + node.attrib["unknown_will_not_be_printed"] = reinterpret_cast(&foo); + + struct My_core_attributes + { + double temperature; + int frequency; + }; + + My_core_attributes attrib{.temperature = 38.222, .frequency = 2000000000}; + Core c1{&node, 1}; + c1.attrib["my_core_info"] = reinterpret_cast(&attrib); + + auto print_my_attribs = [](string key, void *value, string *ret_value_str) -> int + { + if (key == "codename" || key == "info") + { + *ret_value_str = *(string *)value; + return 1; + } + else if (key == "rack_no") + { + *ret_value_str = std::to_string(*(int *)value); + return 1; + } + + return 0; + }; + + auto print_my_custom_attribs = [](string key, void *value, xmlNode *xml) -> int + { + if (key != "my_core_info") + { + return 0; + } + + auto custom = reinterpret_cast(value); + auto temperatur = std::to_string(custom->temperature); + auto frequency = std::to_string(custom->frequency); + xmlNode *attribNode = xmlNewNode(nullptr, BAD_CAST(key.c_str())); + xmlNewProp(attribNode, BAD_CAST("temperature"), BAD_CAST(temperatur.c_str())); + xmlNewProp(attribNode, BAD_CAST("temp_unit"), BAD_CAST("C")); + xmlNewProp(attribNode, BAD_CAST("frequency"), BAD_CAST(frequency.c_str())); + xmlNewProp(attribNode, BAD_CAST("freq_unit"), BAD_CAST("Hz")); + + xmlNode *attrib = xmlNewNode(nullptr, BAD_CAST("Attribute")); + xmlNewProp(attrib, BAD_CAST("name"), BAD_CAST(key.c_str())); + xmlAddChild(xml, attrib); + xmlAddChild(attrib, attribNode); + + return 1; + }; + + std::string output_name = "test_export.xml"; + exportToXml(&topo, output_name, print_my_attribs, print_my_custom_attribs); + } + + { + validate("test_export.xml"); + + auto doc = raii{xmlParseFile("test_export.xml"), xmlFreeDoc}; + ASSERT_NE(doc, nullptr); + + auto pathContext = raii{xmlXPathNewContext(doc.get()), xmlXPathFreeContext}; + ASSERT_NE(pathContext, nullptr); + + xmlNode *node = nullptr; + ASSERT_NO_THROW(node = getSingleNodeByPath(BAD_CAST("/sys-sage/components/Topology/Node"), pathContext.get())); + + { + auto result = raii{xmlXPathNodeEval(node, BAD_CAST("string(Attribute[1]/@name)"), pathContext.get()), xmlXPathFreeObject}; + ASSERT_NE(result, nullptr); + ASSERT_EQ("codename"_xsv, result->stringval); + } + + { + auto result = raii{xmlXPathNodeEval(node, BAD_CAST("string(Attribute[1]/@value)"), pathContext.get()), xmlXPathFreeObject}; + ASSERT_NE(result, nullptr); + ASSERT_EQ("marsupial"_xsv, result->stringval); + } + + { + auto result = raii{xmlXPathNodeEval(node, BAD_CAST("string(Attribute[2]/@name)"), pathContext.get()), xmlXPathFreeObject}; + ASSERT_NE(result, nullptr); + ASSERT_EQ("rack_no"_xsv, result->stringval); + } + + { + auto result = raii{xmlXPathNodeEval(node, BAD_CAST("string(Attribute[2]/@value)"), pathContext.get()), xmlXPathFreeObject}; + ASSERT_NE(result, nullptr); + ASSERT_EQ("15"_xsv, result->stringval); + } + + xmlNode *core = nullptr; + ASSERT_NO_THROW(core = getSingleNodeByPath(BAD_CAST("/sys-sage/components/Topology/Node/Core"), pathContext.get())); + + { + auto result = raii{xmlXPathNodeEval(core, BAD_CAST("string(Attribute/@name)"), pathContext.get()), xmlXPathFreeObject}; + ASSERT_NE(result, nullptr); + ASSERT_EQ("my_core_info"_xsv, result->stringval); + } + + { + auto result = raii{xmlXPathNodeEval(core, BAD_CAST("string(Attribute/my_core_info/@temperature)"), pathContext.get()), xmlXPathFreeObject}; + ASSERT_NE(result, nullptr); + ASSERT_EQ("38.222000"_xsv, result->stringval); + } + + { + auto result = raii{xmlXPathNodeEval(core, BAD_CAST("string(Attribute/my_core_info/@temp_unit)"), pathContext.get()), xmlXPathFreeObject}; + ASSERT_NE(result, nullptr); + ASSERT_EQ("C"_xsv, result->stringval); + } + + { + auto result = raii{xmlXPathNodeEval(core, BAD_CAST("string(Attribute/my_core_info/@frequency)"), pathContext.get()), xmlXPathFreeObject}; + ASSERT_NE(result, nullptr); + ASSERT_EQ("2000000000"_xsv, result->stringval); + } + + { + auto result = raii{xmlXPathNodeEval(core, BAD_CAST("string(Attribute/my_core_info/@freq_unit)"), pathContext.get()), xmlXPathFreeObject}; + ASSERT_NE(result, nullptr); + ASSERT_EQ("Hz"_xsv, result->stringval); + } + } +} From e65964ce3415fe9a757e3f1f0bee3ec1fe175d3a Mon Sep 17 00:00:00 2001 From: Jim Eckerlein Date: Wed, 8 Mar 2023 13:09:00 +0100 Subject: [PATCH 029/102] Add missing virtual destructors --- src/Topology.hpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Topology.hpp b/src/Topology.hpp index da498d1..bd49d06 100644 --- a/src/Topology.hpp +++ b/src/Topology.hpp @@ -58,6 +58,8 @@ class Component { Component(int _id, string _name, int _componentType); Component(Component * parent, int _id, string _name, int _componentType); + virtual ~Component() = default; + /** Inserts a Child component to this component (in the Component Tree). The child pointer will be inserted at the end of std::vector of children (retrievable through GetChildren(), GetChild(int _id) etc.) @@ -550,6 +552,8 @@ class Subdivision : public Component { Subdivision(Component * parent, int _id, string _name); Subdivision(Component * parent, int _id, int _componentType); Subdivision(Component * parent, int _id, string _name, int _componentType); + + ~Subdivision() override = default; void SetSubdivisionType(int subdivisionType); int GetSubdivisionType(); From 36931898d08fdace765e8fcc49329d68b8b369fb Mon Sep 17 00:00:00 2001 From: Jim Eckerlein Date: Wed, 8 Mar 2023 13:09:30 +0100 Subject: [PATCH 030/102] Test hwloc --- test/CMakeLists.txt | 2 +- test/hwloc.cpp | 71 ++++++++ test/resources/skylake_hwloc.xml | 298 +++++++++++++++++++++++++++++++ 3 files changed, 370 insertions(+), 1 deletion(-) create mode 100644 test/hwloc.cpp create mode 100644 test/resources/skylake_hwloc.xml diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 1160909..1e25dc7 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -1,6 +1,6 @@ add_subdirectory(googletest) -add_executable(test test.cpp topology.cpp datapath.cpp export.cpp) +add_executable(test test.cpp topology.cpp datapath.cpp export.cpp hwloc.cpp) target_link_libraries(test PRIVATE sys-sage gtest gmock) include_directories(../src) # The include path is not set in the sys-sage target because CMAKE_INCLUDE_CURRENT_DIR is used instead target_compile_definitions(test PRIVATE SYS_SAGE_TEST_RESOURCE_DIR="${CMAKE_CURRENT_SOURCE_DIR}/resources") diff --git a/test/hwloc.cpp b/test/hwloc.cpp new file mode 100644 index 0000000..181ba7d --- /dev/null +++ b/test/hwloc.cpp @@ -0,0 +1,71 @@ +#include "gtest/gtest.h" + +#include "sys-sage.hpp" + +TEST(Hwloc, parseHwlocOutput) +{ + Topology topo; + Node node{&topo}; + ASSERT_EQ(0, parseHwlocOutput(&node, SYS_SAGE_TEST_RESOURCE_DIR "/skylake_hwloc.xml")); + + { + std::vector components; + topo.GetSubcomponentsByType(&components, SYS_SAGE_COMPONENT_CHIP); + EXPECT_EQ(2, components.size()); + } + { + std::vector components; + topo.GetSubcomponentsByType(&components, SYS_SAGE_COMPONENT_NUMA); + EXPECT_EQ(4, components.size()); + } + { + std::vector components; + topo.GetSubcomponentsByType(&components, SYS_SAGE_COMPONENT_CACHE); + EXPECT_EQ(50, components.size()); + } + { + std::vector components; + topo.GetSubcomponentsByType(&components, SYS_SAGE_COMPONENT_CORE); + EXPECT_EQ(24, components.size()); + } + { + std::vector components; + topo.GetSubcomponentsByType(&components, SYS_SAGE_COMPONENT_THREAD); + EXPECT_EQ(24, components.size()); + } + + auto chip = dynamic_cast(node.GetChildByType(SYS_SAGE_COMPONENT_CHIP)); + ASSERT_NE(nullptr, chip); + EXPECT_EQ("GenuineIntel", chip->GetVendor()); + EXPECT_EQ("Intel(R) Xeon(R) Silver 4116 CPU @ 2.10GHz", chip->GetModel()); + + auto cacheL3 = dynamic_cast(chip->GetChildByType(SYS_SAGE_COMPONENT_CACHE)); + ASSERT_NE(nullptr, cacheL3); + ASSERT_EQ(3, cacheL3->GetCacheLevel()); + ASSERT_EQ(17301504, cacheL3->GetCacheSize()); + ASSERT_EQ(11, cacheL3->GetCacheAssociativityWays()); + ASSERT_EQ(64, cacheL3->GetCacheLineSize()); + + auto numa = dynamic_cast(cacheL3->GetChildByType(SYS_SAGE_COMPONENT_NUMA)); + ASSERT_NE(nullptr, numa); + + auto cacheL2 = dynamic_cast(numa->GetChildByType(SYS_SAGE_COMPONENT_CACHE)); + ASSERT_NE(nullptr, cacheL2); + ASSERT_EQ(2, cacheL2->GetCacheLevel()); + ASSERT_EQ(1048576, cacheL2->GetCacheSize()); + ASSERT_EQ(16, cacheL2->GetCacheAssociativityWays()); + ASSERT_EQ(64, cacheL2->GetCacheLineSize()); + + auto cacheL1 = dynamic_cast(cacheL2->GetChildByType(SYS_SAGE_COMPONENT_CACHE)); + ASSERT_NE(nullptr, cacheL1); + ASSERT_EQ(1, cacheL1->GetCacheLevel()); + ASSERT_EQ(32768, cacheL1->GetCacheSize()); + ASSERT_EQ(8, cacheL1->GetCacheAssociativityWays()); + ASSERT_EQ(64, cacheL1->GetCacheLineSize()); + + auto core = dynamic_cast(cacheL1->GetChildByType(SYS_SAGE_COMPONENT_CORE)); + ASSERT_NE(nullptr, core); + + auto thread = dynamic_cast(core->GetChildByType(SYS_SAGE_COMPONENT_THREAD)); + ASSERT_NE(nullptr, thread); +} diff --git a/test/resources/skylake_hwloc.xml b/test/resources/skylake_hwloc.xml new file mode 100644 index 0000000..12ae1cd --- /dev/null +++ b/test/resources/skylake_hwloc.xml @@ -0,0 +1,298 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 0 1 2 3 + 10 21 31 31 21 10 31 31 31 31 + 10 21 31 31 21 10 + + From 69bf163aec643b4238f418de5a66b1d35d560cb3 Mon Sep 17 00:00:00 2001 From: Jim Eckerlein Date: Wed, 8 Mar 2023 13:45:28 +0100 Subject: [PATCH 031/102] Add missing virtual destructors --- src/Topology.hpp | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/src/Topology.hpp b/src/Topology.hpp index bd49d06..f94a83c 100644 --- a/src/Topology.hpp +++ b/src/Topology.hpp @@ -318,6 +318,8 @@ class Topology : public Component { \n componentType=>SYS_SAGE_COMPONENT_TOPOLOGY */ Topology(); + + ~Topology() override = default; private: }; @@ -343,6 +345,8 @@ class Node : public Component { */ Node(int _id); Node(Component* parent, int _id); + + ~Node() override = default; #ifdef CPUINFO public: int RefreshCpuCoreFrequency(bool keep_history = false); @@ -376,6 +380,9 @@ class Memory : public Component { Memory(Component * parent); Memory(Component * parent, string _name); Memory(Component * parent, string _name, long long _size); + + ~Memory() override = default; + long long GetSize(); void SetSize(long long _size); /** @@ -402,6 +409,9 @@ class Storage : public Component { */ Storage(); Storage(Component * parent); + + ~Storage() override = default; + long long GetSize() { return size; }; void SetSize(long long _size) { size = _size; }; /** @@ -440,6 +450,8 @@ class Chip : public Component { Chip(Component * parent, int _id, string _name); Chip(Component * parent, int _id, string _name, int _type); + ~Chip() override = default; + void SetVendor(string _vendor); string GetVendor(); void SetModel(string _model); @@ -487,6 +499,8 @@ class Cache : public Component { Cache(Component * parent, int _id, int _cache_level, unsigned long long _cache_size, int _associativity, int _cache_line_size); Cache(Component * parent, int _id, string _cache_type, unsigned long long _cache_size, int _associativity, int _cache_line_size); + ~Cache() override = default; + /** @returns cache level of this cache */ @@ -597,6 +611,9 @@ class Numa : public Subdivision { Numa(Component * parent); Numa(Component * parent, int _id); Numa(Component * parent, int _id, long long _size); + + ~Numa() override = default; + /** Get size of the Numa memory segment. @returns size of the Numa memory segment. @@ -636,6 +653,9 @@ class Core : public Component { Core(Component * parent); Core(Component * parent, int _id); Core(Component * parent, int _id, string _name); + + ~Core() override = default; + private: #ifdef CPUINFO @@ -673,6 +693,8 @@ class Thread : public Component { Thread(Component * parent, int _id); Thread(Component * parent, int _id, string _name); + ~Thread() override = default; + #ifdef CPUINFO //defined in cpuinfo.cpp public: int RefreshFreq(bool keep_history = false); From 2711e95aef7cf6ec5f06b60796d95c78e3ba4bd3 Mon Sep 17 00:00:00 2001 From: Jim Eckerlein Date: Wed, 8 Mar 2023 13:51:22 +0100 Subject: [PATCH 032/102] Test GPU topology --- test/CMakeLists.txt | 2 +- test/gpu-topo.cpp | 56 ++++++++++++++++++++++++++++++ test/hwloc.cpp | 26 +++++++------- test/resources/pascal_gpu_topo.csv | 12 +++++++ 4 files changed, 82 insertions(+), 14 deletions(-) create mode 100644 test/gpu-topo.cpp create mode 100644 test/resources/pascal_gpu_topo.csv diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 1e25dc7..872d19f 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -1,6 +1,6 @@ add_subdirectory(googletest) -add_executable(test test.cpp topology.cpp datapath.cpp export.cpp hwloc.cpp) +add_executable(test test.cpp topology.cpp datapath.cpp export.cpp hwloc.cpp gpu-topo.cpp) target_link_libraries(test PRIVATE sys-sage gtest gmock) include_directories(../src) # The include path is not set in the sys-sage target because CMAKE_INCLUDE_CURRENT_DIR is used instead target_compile_definitions(test PRIVATE SYS_SAGE_TEST_RESOURCE_DIR="${CMAKE_CURRENT_SOURCE_DIR}/resources") diff --git a/test/gpu-topo.cpp b/test/gpu-topo.cpp new file mode 100644 index 0000000..8fd0b2b --- /dev/null +++ b/test/gpu-topo.cpp @@ -0,0 +1,56 @@ +#include "gtest/gtest.h" + +#include "sys-sage.hpp" + +TEST(GpuTopo, parseGpuTopo) +{ + Topology topo; + Chip gpu{&topo}; + ASSERT_EQ(0, parseGpuTopo(&gpu, SYS_SAGE_TEST_RESOURCE_DIR "/pascal_gpu_topo.csv")); + + { + std::vector components; + topo.GetSubcomponentsByType(&components, SYS_SAGE_COMPONENT_MEMORY); + EXPECT_EQ(1, components.size()); + } + { + std::vector components; + topo.GetSubcomponentsByType(&components, SYS_SAGE_COMPONENT_SUBDIVISION); + EXPECT_EQ(30, components.size()); + } + { + std::vector components; + topo.GetSubcomponentsByType(&components, SYS_SAGE_COMPONENT_CACHE); + EXPECT_EQ(151, components.size()); + } + { + std::vector components; + topo.GetSubcomponentsByType(&components, SYS_SAGE_COMPONENT_THREAD); + EXPECT_EQ(3840, components.size()); + } + + EXPECT_EQ("Nvidia", gpu.GetVendor()); + EXPECT_EQ("Quadro P6000", gpu.GetModel()); + + auto memory = dynamic_cast(gpu.GetChildByType(SYS_SAGE_COMPONENT_MEMORY)); + ASSERT_NE(nullptr, memory); + EXPECT_EQ(25637224578, memory->GetSize()); + EXPECT_EQ(3840, memory->GetDataPaths(SYS_SAGE_DATAPATH_OUTGOING)->size()); + + auto cacheL2 = dynamic_cast(memory->GetChildByType(SYS_SAGE_COMPONENT_CACHE)); + ASSERT_NE(nullptr, cacheL2); + EXPECT_EQ(3145728, cacheL2->GetCacheSize()); + EXPECT_EQ(32, cacheL2->GetCacheLineSize()); + + auto subdivision = dynamic_cast(cacheL2->GetChildByType(SYS_SAGE_COMPONENT_SUBDIVISION)); + ASSERT_NE(nullptr, subdivision); + EXPECT_EQ(SYS_SAGE_SUBDIVISION_TYPE_GPU_SM, subdivision->GetSubdivisionType()); + + auto cacheL1 = dynamic_cast(subdivision->GetChildByType(SYS_SAGE_COMPONENT_CACHE)); + ASSERT_NE(nullptr, cacheL1); + EXPECT_EQ(24588, cacheL1->GetCacheSize()); + EXPECT_EQ(32, cacheL1->GetCacheLineSize()); + + auto thread = dynamic_cast(cacheL1->GetChildByType(SYS_SAGE_COMPONENT_THREAD)); + ASSERT_NE(nullptr, thread); +} diff --git a/test/hwloc.cpp b/test/hwloc.cpp index 181ba7d..c35f91d 100644 --- a/test/hwloc.cpp +++ b/test/hwloc.cpp @@ -41,31 +41,31 @@ TEST(Hwloc, parseHwlocOutput) auto cacheL3 = dynamic_cast(chip->GetChildByType(SYS_SAGE_COMPONENT_CACHE)); ASSERT_NE(nullptr, cacheL3); - ASSERT_EQ(3, cacheL3->GetCacheLevel()); - ASSERT_EQ(17301504, cacheL3->GetCacheSize()); - ASSERT_EQ(11, cacheL3->GetCacheAssociativityWays()); - ASSERT_EQ(64, cacheL3->GetCacheLineSize()); + EXPECT_EQ(3, cacheL3->GetCacheLevel()); + EXPECT_EQ(17301504, cacheL3->GetCacheSize()); + EXPECT_EQ(11, cacheL3->GetCacheAssociativityWays()); + EXPECT_EQ(64, cacheL3->GetCacheLineSize()); auto numa = dynamic_cast(cacheL3->GetChildByType(SYS_SAGE_COMPONENT_NUMA)); ASSERT_NE(nullptr, numa); auto cacheL2 = dynamic_cast(numa->GetChildByType(SYS_SAGE_COMPONENT_CACHE)); ASSERT_NE(nullptr, cacheL2); - ASSERT_EQ(2, cacheL2->GetCacheLevel()); - ASSERT_EQ(1048576, cacheL2->GetCacheSize()); - ASSERT_EQ(16, cacheL2->GetCacheAssociativityWays()); - ASSERT_EQ(64, cacheL2->GetCacheLineSize()); + EXPECT_EQ(2, cacheL2->GetCacheLevel()); + EXPECT_EQ(1048576, cacheL2->GetCacheSize()); + EXPECT_EQ(16, cacheL2->GetCacheAssociativityWays()); + EXPECT_EQ(64, cacheL2->GetCacheLineSize()); auto cacheL1 = dynamic_cast(cacheL2->GetChildByType(SYS_SAGE_COMPONENT_CACHE)); ASSERT_NE(nullptr, cacheL1); - ASSERT_EQ(1, cacheL1->GetCacheLevel()); - ASSERT_EQ(32768, cacheL1->GetCacheSize()); - ASSERT_EQ(8, cacheL1->GetCacheAssociativityWays()); - ASSERT_EQ(64, cacheL1->GetCacheLineSize()); + EXPECT_EQ(1, cacheL1->GetCacheLevel()); + EXPECT_EQ(32768, cacheL1->GetCacheSize()); + EXPECT_EQ(8, cacheL1->GetCacheAssociativityWays()); + EXPECT_EQ(64, cacheL1->GetCacheLineSize()); auto core = dynamic_cast(cacheL1->GetChildByType(SYS_SAGE_COMPONENT_CORE)); ASSERT_NE(nullptr, core); auto thread = dynamic_cast(core->GetChildByType(SYS_SAGE_COMPONENT_THREAD)); ASSERT_NE(nullptr, thread); -} +} \ No newline at end of file diff --git a/test/resources/pascal_gpu_topo.csv b/test/resources/pascal_gpu_topo.csv new file mode 100644 index 0000000..f73c119 --- /dev/null +++ b/test/resources/pascal_gpu_topo.csv @@ -0,0 +1,12 @@ +GPU_INFORMATION; GPU_vendor; "Nvidia"; GPU_name; "Quadro P6000" +COMPUTE_RESOURCE_INFORMATION; CUDA_compute_capability; "6.10"; Number_of_streaming_multiprocessors; 30; Number_of_cores_in_GPU; 3840; Number_of_cores_per_SM; 128 +REGISTER_INFORMATION; Registers_per_thread_block; 65536; "32-bit registers"; Registers_per_SM; 65536; "32-bit registers" +ADDITIONAL_INFORMATION; Memory_Clock_Frequency; 4.513; "GHz"; Memory_Bus_Width; 384; "bit"; GPU_Clock_Rate; 1.645; "GHz" +L1_DATA_CACHE; Size; 24.011719; KiB; "="; Cache_Line_Size; 32; "B"Load_Latency; 92; "cycles"; Load_Latency; 61; "nanoseconds"; Shared_On; "SM-level"; Share_Cache_With_Texture; 1; Share_Cache_With_Read-Only; 1; Share_Cache_With_ConstantL1; 0; Caches_Per_SM; 2 +L2_DATA_CACHE; Size; 3.000; MiB; "="; Cache_Line_Size; 32; "B"; Load_Latency; 244; "cycles"; Load_Latency; 159; "nanoseconds"; Shared_On; "GPU-level" +TEXTURE_CACHE; Size; 24.011719; KiB; "="; Cache_Line_Size; 32; "B"; Load_Latency; 85; "cycles"; Load_Latency; 51; "nanoseconds"; Shared_On; "SM-level"; Share_Cache_With_L1_Data; 1; Share_Cache_With_Read-Only; 1; Caches_Per_SM; 2 +READ-ONLY_CACHE; Size; 24.011719; KiB; "="; Cache_Line_Size; 32; "B"; Load_Latency; 94; "cycles"; Load_Latency; 62; "nanoseconds"; Shared_On; "SM-level"; Share_Cache_With_L1_Data; 1; Share_Cache_With_Texture; 1; Caches_Per_SM; 2 +CONSTANT_L1_CACHE; Size; 2.093750; KiB; "="; Cache_Line_Size; 64; "B"; Load_Latency; 33; "cycles"; Load_Latency; 22; "nanoseconds"; Shared_On; "SM-level"; Share_Cache_With_L1_Data; 0; Caches_Per_SM; 1 +CONST_L1_5_CACHE; Size; 30.468750; KiB; "="; Cache_Line_Size; 256; "B"; Load_Latency; 94; "cycles"; Load_Latency; 63; "nanoseconds"; Shared_On; "SM-level" +MAIN_MEMORY; Size; 23.876526; GiB; "="; Load_Latency; 412; "cycles"; Load_Latency; 164; "nanoseconds"; Shared_On; "GPU-level" +SHARED_MEMORY; Size; 96.000000; KiB; "="; Load_Latency; 31; "cycles"; Load_Latency; 21; "nanoseconds"; Shared_On; "SM-level" From f769fb212d250ff35b3a536c546cc40e2311fbd3 Mon Sep 17 00:00:00 2001 From: Jim Eckerlein Date: Wed, 8 Mar 2023 14:25:24 +0100 Subject: [PATCH 033/102] Test parseCapsNumaBenchmark --- src/parsers/caps-numa-benchmark.cpp | 2 +- src/parsers/caps-numa-benchmark.hpp | 2 +- test/CMakeLists.txt | 2 +- test/caps-numa-benchmark.cpp | 86 +++++++++++++++++++ .../resources/skylake_caps_numa_benchmark.csv | 17 ++++ 5 files changed, 106 insertions(+), 3 deletions(-) create mode 100644 test/caps-numa-benchmark.cpp create mode 100644 test/resources/skylake_caps_numa_benchmark.csv diff --git a/src/parsers/caps-numa-benchmark.cpp b/src/parsers/caps-numa-benchmark.cpp index 2ad8757..baaabbe 100644 --- a/src/parsers/caps-numa-benchmark.cpp +++ b/src/parsers/caps-numa-benchmark.cpp @@ -7,7 +7,7 @@ using namespace std; -int parseCapsNumaBenchmark(Component* rootComponent, string benchmarkPath, string delim = ";") +int parseCapsNumaBenchmark(Component* rootComponent, string benchmarkPath, string delim) { CSVReader reader(benchmarkPath, delim); vector > benchmarkData; diff --git a/src/parsers/caps-numa-benchmark.hpp b/src/parsers/caps-numa-benchmark.hpp index b44581a..0e3dafb 100644 --- a/src/parsers/caps-numa-benchmark.hpp +++ b/src/parsers/caps-numa-benchmark.hpp @@ -4,7 +4,7 @@ #include "Topology.hpp" #include "DataPath.hpp" -int parseCapsNumaBenchmark(Component* rootComponent, string benchmarkPath, string delim); +int parseCapsNumaBenchmark(Component* rootComponent, string benchmarkPath, string delim = ";"); class CSVReader { diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 872d19f..f5be70d 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -1,6 +1,6 @@ add_subdirectory(googletest) -add_executable(test test.cpp topology.cpp datapath.cpp export.cpp hwloc.cpp gpu-topo.cpp) +add_executable(test test.cpp topology.cpp datapath.cpp export.cpp hwloc.cpp gpu-topo.cpp caps-numa-benchmark.cpp) target_link_libraries(test PRIVATE sys-sage gtest gmock) include_directories(../src) # The include path is not set in the sys-sage target because CMAKE_INCLUDE_CURRENT_DIR is used instead target_compile_definitions(test PRIVATE SYS_SAGE_TEST_RESOURCE_DIR="${CMAKE_CURRENT_SOURCE_DIR}/resources") diff --git a/test/caps-numa-benchmark.cpp b/test/caps-numa-benchmark.cpp new file mode 100644 index 0000000..53ba686 --- /dev/null +++ b/test/caps-numa-benchmark.cpp @@ -0,0 +1,86 @@ +#include "gtest/gtest.h" + +#include "sys-sage.hpp" + +TEST(CapsNumaBenchmark, parseCapsNumaBenchmark) +{ + Topology topo; + Node node{&topo}; + + parseHwlocOutput(&node, SYS_SAGE_TEST_RESOURCE_DIR "/skylake_hwloc.xml"); + + ASSERT_EQ(0, parseCapsNumaBenchmark(&node, SYS_SAGE_TEST_RESOURCE_DIR "/skylake_caps_numa_benchmark.csv")); + + std::vector numas; + node.GetSubcomponentsByType(&numas, SYS_SAGE_COMPONENT_NUMA); + ASSERT_EQ(4, numas.size()); + + for (const auto &numa : numas) + { + ASSERT_EQ(4, numa->GetDataPaths(SYS_SAGE_DATAPATH_INCOMING)->size()); + for (const auto &dp : *numa->GetDataPaths(SYS_SAGE_DATAPATH_INCOMING)) + { + EXPECT_EQ(SYS_SAGE_DATAPATH_TYPE_PHYSICAL, dp->GetDpType()); + EXPECT_EQ(SYS_SAGE_DATAPATH_ORIENTED, dp->GetOriented()); + } + + ASSERT_EQ(4, numa->GetDataPaths(SYS_SAGE_DATAPATH_OUTGOING)->size()); + for (const auto &dp : *numa->GetDataPaths(SYS_SAGE_DATAPATH_OUTGOING)) + { + EXPECT_EQ(SYS_SAGE_DATAPATH_TYPE_PHYSICAL, dp->GetDpType()); + EXPECT_EQ(SYS_SAGE_DATAPATH_ORIENTED, dp->GetOriented()); + } + } + + for (size_t i = 0; i < 4; ++i) + { + for (size_t k = 0; k < 4; ++k) + { + auto dp1 = (*numas[i]->GetDataPaths(SYS_SAGE_DATAPATH_INCOMING))[k]; + auto dp2 = (*numas[k]->GetDataPaths(SYS_SAGE_DATAPATH_OUTGOING))[i]; + EXPECT_EQ(dp1->GetBw(), dp2->GetBw()); + EXPECT_EQ(dp1->GetLatency(), dp2->GetLatency()); + } + } + + auto dp = [&numas](size_t i, size_t k) + { + return (*numas[i]->GetDataPaths(SYS_SAGE_DATAPATH_OUTGOING))[k]; + }; + + EXPECT_EQ(8621, dp(0, 0)->GetBw()); + EXPECT_EQ(8502, dp(1, 0)->GetBw()); + EXPECT_EQ(6467, dp(2, 0)->GetBw()); + EXPECT_EQ(6476, dp(3, 0)->GetBw()); + EXPECT_EQ(244, dp(0, 0)->GetLatency()); + EXPECT_EQ(195, dp(1, 0)->GetLatency()); + EXPECT_EQ(307, dp(2, 0)->GetLatency()); + EXPECT_EQ(313, dp(3, 0)->GetLatency()); + + EXPECT_EQ(8237, dp(0, 1)->GetBw()); + EXPECT_EQ(8663, dp(1, 1)->GetBw()); + EXPECT_EQ(6291, dp(2, 1)->GetBw()); + EXPECT_EQ(6267, dp(3, 1)->GetBw()); + EXPECT_EQ(203, dp(0, 1)->GetLatency()); + EXPECT_EQ(237, dp(1, 1)->GetLatency()); + EXPECT_EQ(315, dp(2, 1)->GetLatency()); + EXPECT_EQ(319, dp(3, 1)->GetLatency()); + + EXPECT_EQ(6439, dp(0, 2)->GetBw()); + EXPECT_EQ(6609, dp(1, 2)->GetBw()); + EXPECT_EQ(8539, dp(2, 2)->GetBw()); + EXPECT_EQ(8412, dp(3, 2)->GetBw()); + EXPECT_EQ(302, dp(0, 2)->GetLatency()); + EXPECT_EQ(313, dp(1, 2)->GetLatency()); + EXPECT_EQ(237, dp(2, 2)->GetLatency()); + EXPECT_EQ(210, dp(3, 2)->GetLatency()); + + EXPECT_EQ(6315, dp(0, 3)->GetBw()); + EXPECT_EQ(6324, dp(1, 3)->GetBw()); + EXPECT_EQ(8177, dp(2, 3)->GetBw()); + EXPECT_EQ(8466, dp(3, 3)->GetBw()); + EXPECT_EQ(309, dp(0, 3)->GetLatency()); + EXPECT_EQ(316, dp(1, 3)->GetLatency()); + EXPECT_EQ(211, dp(2, 3)->GetLatency()); + EXPECT_EQ(246, dp(3, 3)->GetLatency()); +} diff --git a/test/resources/skylake_caps_numa_benchmark.csv b/test/resources/skylake_caps_numa_benchmark.csv new file mode 100644 index 0000000..77afa08 --- /dev/null +++ b/test/resources/skylake_caps_numa_benchmark.csv @@ -0,0 +1,17 @@ +src_numa;target_numa;mem_size;arrsz;timer_ovh;ldlat(ns);bw(MB/s); +0; 0; 24904642560; 3113080320; 34; 244; 8621 +0; 1; 25365467136; 3170683392; 39; 203; 8237 +0; 2; 25365463040; 3170682880; 34; 302; 6439 +0; 3; 25364619264; 3170577408; 39; 309; 6315 +1; 0; 24904642560; 3113080320; 34; 195; 8502 +1; 1; 25365467136; 3170683392; 34; 237; 8663 +1; 2; 25365463040; 3170682880; 34; 313; 6609 +1; 3; 25364619264; 3170577408; 44; 316; 6324 +2; 0; 24904642560; 3113080320; 35; 307; 6467 +2; 1; 25365467136; 3170683392; 39; 315; 6291 +2; 2; 25365463040; 3170682880; 39; 237; 8539 +2; 3; 25364619264; 3170577408; 34; 211; 8177 +3; 0; 24904642560; 3113080320; 38; 313; 6476 +3; 1; 25365467136; 3170683392; 34; 319; 6267 +3; 2; 25365463040; 3170682880; 39; 210; 8412 +3; 3; 25364619264; 3170577408; 39; 246; 8466 From 0aa3120fac65a3e55ed375ddf19abd21b144ca68 Mon Sep 17 00:00:00 2001 From: Jim Eckerlein Date: Wed, 8 Mar 2023 14:35:20 +0100 Subject: [PATCH 034/102] Rename test xml file --- .gitignore | 2 +- test/export.cpp | 16 ++++++++-------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/.gitignore b/.gitignore index 6351f8b..4463745 100644 --- a/.gitignore +++ b/.gitignore @@ -8,4 +8,4 @@ install/* .vscode -test_export.xml +test.xml diff --git a/test/export.cpp b/test/export.cpp index 6fc7d9f..d411449 100644 --- a/test/export.cpp +++ b/test/export.cpp @@ -118,8 +118,8 @@ void validate(std::string_view path) TEST(Export, MinimalTopology) { auto topo = new Component{42, "a name", SYS_SAGE_COMPONENT_NONE}; - exportToXml(topo, "test_export.xml"); - validate("test_export.xml"); + exportToXml(topo, "test.xml"); + validate("test.xml"); } TEST(Export, SampleOutput) @@ -150,13 +150,13 @@ TEST(Export, SingleComponent) auto topo = new Topology; auto memory = new Memory{topo, "A single memory component", 16}; (void)memory; - exportToXml(topo, "test_export.xml"); + exportToXml(topo, "test.xml"); } { - validate("test_export.xml"); + validate("test.xml"); - auto doc = raii{xmlParseFile("test_export.xml"), xmlFreeDoc}; + auto doc = raii{xmlParseFile("test.xml"), xmlFreeDoc}; ASSERT_NE(doc, nullptr); auto pathContext = raii{xmlXPathNewContext(doc.get()), xmlXPathFreeContext}; @@ -263,14 +263,14 @@ TEST(Export, CustomAttributes) return 1; }; - std::string output_name = "test_export.xml"; + std::string output_name = "test.xml"; exportToXml(&topo, output_name, print_my_attribs, print_my_custom_attribs); } { - validate("test_export.xml"); + validate("test.xml"); - auto doc = raii{xmlParseFile("test_export.xml"), xmlFreeDoc}; + auto doc = raii{xmlParseFile("test.xml"), xmlFreeDoc}; ASSERT_NE(doc, nullptr); auto pathContext = raii{xmlXPathNewContext(doc.get()), xmlXPathFreeContext}; From 0a1a35cb88433a27baa73a3d0bca9c4485334dea Mon Sep 17 00:00:00 2001 From: Jim Eckerlein Date: Wed, 8 Mar 2023 17:44:11 +0100 Subject: [PATCH 035/102] Use ut instead of gtest --- .gitmodules | 6 +- test/CMakeLists.txt | 8 +- test/caps-numa-benchmark.cpp | 133 +++++---- test/datapath.cpp | 222 +++++++------- test/export.cpp | 346 +++++++++------------- test/googletest | 1 - test/gpu-topo.cpp | 65 ++--- test/hwloc.cpp | 87 +++--- test/test.cpp | 12 +- test/topology.cpp | 549 ++++++++++++++++++----------------- test/ut | 1 + 11 files changed, 681 insertions(+), 749 deletions(-) delete mode 160000 test/googletest create mode 160000 test/ut diff --git a/.gitmodules b/.gitmodules index e5203c4..17106e2 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,6 +1,6 @@ [submodule "data-sources/mt4g"] path = data-sources/mt4g url = https://github.com/caps-tum/mt4g.git -[submodule "test/googletest"] - path = test/googletest - url = git@github.com:google/googletest.git +[submodule "test/ut"] + path = test/ut + url = git@github.com:boost-ext/ut.git diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index f5be70d..4c85b01 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -1,6 +1,6 @@ -add_subdirectory(googletest) - -add_executable(test test.cpp topology.cpp datapath.cpp export.cpp hwloc.cpp gpu-topo.cpp caps-numa-benchmark.cpp) -target_link_libraries(test PRIVATE sys-sage gtest gmock) include_directories(../src) # The include path is not set in the sys-sage target because CMAKE_INCLUDE_CURRENT_DIR is used instead + +add_subdirectory(ut) +add_executable(test test.cpp topology.cpp datapath.cpp hwloc.cpp gpu-topo.cpp caps-numa-benchmark.cpp export.cpp) +target_link_libraries(test PRIVATE ut sys-sage) target_compile_definitions(test PRIVATE SYS_SAGE_TEST_RESOURCE_DIR="${CMAKE_CURRENT_SOURCE_DIR}/resources") diff --git a/test/caps-numa-benchmark.cpp b/test/caps-numa-benchmark.cpp index 53ba686..d49d8da 100644 --- a/test/caps-numa-benchmark.cpp +++ b/test/caps-numa-benchmark.cpp @@ -1,86 +1,99 @@ -#include "gtest/gtest.h" +#include #include "sys-sage.hpp" -TEST(CapsNumaBenchmark, parseCapsNumaBenchmark) +using namespace boost::ut; + +static suite<"caps-numa-benchmark"> _ = [] { Topology topo; Node node{&topo}; - parseHwlocOutput(&node, SYS_SAGE_TEST_RESOURCE_DIR "/skylake_hwloc.xml"); + expect(that % (0 == parseHwlocOutput(&node, SYS_SAGE_TEST_RESOURCE_DIR "/skylake_hwloc.xml")) >> fatal) + << "Parse hwloc XML file"; - ASSERT_EQ(0, parseCapsNumaBenchmark(&node, SYS_SAGE_TEST_RESOURCE_DIR "/skylake_caps_numa_benchmark.csv")); + expect(that % (0 == parseCapsNumaBenchmark(&node, SYS_SAGE_TEST_RESOURCE_DIR "/skylake_caps_numa_benchmark.csv")) >> fatal) + << "Parse benchmark CSV file"; std::vector numas; node.GetSubcomponentsByType(&numas, SYS_SAGE_COMPONENT_NUMA); - ASSERT_EQ(4, numas.size()); + expect(that % (4 == numas.size()) >> fatal); - for (const auto &numa : numas) + "Number, type, and orientation of data paths"_test = [&] { - ASSERT_EQ(4, numa->GetDataPaths(SYS_SAGE_DATAPATH_INCOMING)->size()); - for (const auto &dp : *numa->GetDataPaths(SYS_SAGE_DATAPATH_INCOMING)) + for (const auto &numa : numas) { - EXPECT_EQ(SYS_SAGE_DATAPATH_TYPE_PHYSICAL, dp->GetDpType()); - EXPECT_EQ(SYS_SAGE_DATAPATH_ORIENTED, dp->GetOriented()); - } + expect(that % (4 == numa->GetDataPaths(SYS_SAGE_DATAPATH_INCOMING)->size()) >> fatal); + for (const auto &dp : *numa->GetDataPaths(SYS_SAGE_DATAPATH_INCOMING)) + { + expect(that % SYS_SAGE_DATAPATH_TYPE_PHYSICAL == dp->GetDpType()); + expect(that % SYS_SAGE_DATAPATH_ORIENTED == dp->GetOriented()); + } - ASSERT_EQ(4, numa->GetDataPaths(SYS_SAGE_DATAPATH_OUTGOING)->size()); - for (const auto &dp : *numa->GetDataPaths(SYS_SAGE_DATAPATH_OUTGOING)) - { - EXPECT_EQ(SYS_SAGE_DATAPATH_TYPE_PHYSICAL, dp->GetDpType()); - EXPECT_EQ(SYS_SAGE_DATAPATH_ORIENTED, dp->GetOriented()); + expect(that % (4 == numa->GetDataPaths(SYS_SAGE_DATAPATH_OUTGOING)->size()) >> fatal); + for (const auto &dp : *numa->GetDataPaths(SYS_SAGE_DATAPATH_OUTGOING)) + { + expect(that % SYS_SAGE_DATAPATH_TYPE_PHYSICAL == dp->GetDpType()); + expect(that % SYS_SAGE_DATAPATH_ORIENTED == dp->GetOriented()); + } } - } + }; - for (size_t i = 0; i < 4; ++i) + "Anti-symmetry of data paths"_test = [&] { - for (size_t k = 0; k < 4; ++k) + for (size_t i = 0; i < 4; ++i) { - auto dp1 = (*numas[i]->GetDataPaths(SYS_SAGE_DATAPATH_INCOMING))[k]; - auto dp2 = (*numas[k]->GetDataPaths(SYS_SAGE_DATAPATH_OUTGOING))[i]; - EXPECT_EQ(dp1->GetBw(), dp2->GetBw()); - EXPECT_EQ(dp1->GetLatency(), dp2->GetLatency()); + for (size_t k = 0; k < 4; ++k) + { + auto dp1 = (*numas[i]->GetDataPaths(SYS_SAGE_DATAPATH_INCOMING))[k]; + auto dp2 = (*numas[k]->GetDataPaths(SYS_SAGE_DATAPATH_OUTGOING))[i]; + expect(that % dp1->GetBw() == dp2->GetBw()); + expect(that % dp1->GetLatency() == dp2->GetLatency()); + } } - } + }; - auto dp = [&numas](size_t i, size_t k) + "Bandwidth and latency of data paths"_test = [&] { - return (*numas[i]->GetDataPaths(SYS_SAGE_DATAPATH_OUTGOING))[k]; - }; + auto dp = [&numas](size_t i, size_t k) + { + return (*numas[i]->GetDataPaths(SYS_SAGE_DATAPATH_OUTGOING))[k]; + }; - EXPECT_EQ(8621, dp(0, 0)->GetBw()); - EXPECT_EQ(8502, dp(1, 0)->GetBw()); - EXPECT_EQ(6467, dp(2, 0)->GetBw()); - EXPECT_EQ(6476, dp(3, 0)->GetBw()); - EXPECT_EQ(244, dp(0, 0)->GetLatency()); - EXPECT_EQ(195, dp(1, 0)->GetLatency()); - EXPECT_EQ(307, dp(2, 0)->GetLatency()); - EXPECT_EQ(313, dp(3, 0)->GetLatency()); + expect(that % 8621 == dp(0, 0)->GetBw()); + expect(that % 8502 == dp(1, 0)->GetBw()); + expect(that % 6467 == dp(2, 0)->GetBw()); + expect(that % 6476 == dp(3, 0)->GetBw()); + expect(that % 244 == dp(0, 0)->GetLatency()); + expect(that % 195 == dp(1, 0)->GetLatency()); + expect(that % 307 == dp(2, 0)->GetLatency()); + expect(that % 313 == dp(3, 0)->GetLatency()); - EXPECT_EQ(8237, dp(0, 1)->GetBw()); - EXPECT_EQ(8663, dp(1, 1)->GetBw()); - EXPECT_EQ(6291, dp(2, 1)->GetBw()); - EXPECT_EQ(6267, dp(3, 1)->GetBw()); - EXPECT_EQ(203, dp(0, 1)->GetLatency()); - EXPECT_EQ(237, dp(1, 1)->GetLatency()); - EXPECT_EQ(315, dp(2, 1)->GetLatency()); - EXPECT_EQ(319, dp(3, 1)->GetLatency()); + expect(that % 8237 == dp(0, 1)->GetBw()); + expect(that % 8663 == dp(1, 1)->GetBw()); + expect(that % 6291 == dp(2, 1)->GetBw()); + expect(that % 6267 == dp(3, 1)->GetBw()); + expect(that % 203 == dp(0, 1)->GetLatency()); + expect(that % 237 == dp(1, 1)->GetLatency()); + expect(that % 315 == dp(2, 1)->GetLatency()); + expect(that % 319 == dp(3, 1)->GetLatency()); - EXPECT_EQ(6439, dp(0, 2)->GetBw()); - EXPECT_EQ(6609, dp(1, 2)->GetBw()); - EXPECT_EQ(8539, dp(2, 2)->GetBw()); - EXPECT_EQ(8412, dp(3, 2)->GetBw()); - EXPECT_EQ(302, dp(0, 2)->GetLatency()); - EXPECT_EQ(313, dp(1, 2)->GetLatency()); - EXPECT_EQ(237, dp(2, 2)->GetLatency()); - EXPECT_EQ(210, dp(3, 2)->GetLatency()); + expect(that % 6439 == dp(0, 2)->GetBw()); + expect(that % 6609 == dp(1, 2)->GetBw()); + expect(that % 8539 == dp(2, 2)->GetBw()); + expect(that % 8412 == dp(3, 2)->GetBw()); + expect(that % 302 == dp(0, 2)->GetLatency()); + expect(that % 313 == dp(1, 2)->GetLatency()); + expect(that % 237 == dp(2, 2)->GetLatency()); + expect(that % 210 == dp(3, 2)->GetLatency()); - EXPECT_EQ(6315, dp(0, 3)->GetBw()); - EXPECT_EQ(6324, dp(1, 3)->GetBw()); - EXPECT_EQ(8177, dp(2, 3)->GetBw()); - EXPECT_EQ(8466, dp(3, 3)->GetBw()); - EXPECT_EQ(309, dp(0, 3)->GetLatency()); - EXPECT_EQ(316, dp(1, 3)->GetLatency()); - EXPECT_EQ(211, dp(2, 3)->GetLatency()); - EXPECT_EQ(246, dp(3, 3)->GetLatency()); -} + expect(that % 6315 == dp(0, 3)->GetBw()); + expect(that % 6324 == dp(1, 3)->GetBw()); + expect(that % 8177 == dp(2, 3)->GetBw()); + expect(that % 8466 == dp(3, 3)->GetBw()); + expect(that % 309 == dp(0, 3)->GetLatency()); + expect(that % 316 == dp(1, 3)->GetLatency()); + expect(that % 211 == dp(2, 3)->GetLatency()); + expect(that % 246 == dp(3, 3)->GetLatency()); + }; +}; diff --git a/test/datapath.cpp b/test/datapath.cpp index a35d92e..e840037 100644 --- a/test/datapath.cpp +++ b/test/datapath.cpp @@ -1,120 +1,136 @@ -#include "gtest/gtest.h" +#include #include "sys-sage.hpp" -TEST(DataPath, Constructors) +using namespace boost::ut; + +static suite<"data-path"> _ = [] { - Component a, b; - { - DataPath dp{&a, &b, SYS_SAGE_DATAPATH_ORIENTED, SYS_SAGE_DATAPATH_TYPE_PHYSICAL}; - EXPECT_EQ(&a, dp.GetSource()); - EXPECT_EQ(&b, dp.GetTarget()); - EXPECT_EQ(SYS_SAGE_DATAPATH_ORIENTED, dp.GetOriented()); - EXPECT_EQ(SYS_SAGE_DATAPATH_TYPE_PHYSICAL, dp.GetDpType()); - } + "Constructors"_test = [] { - DataPath dp{&a, &b, SYS_SAGE_DATAPATH_ORIENTED, 5.0, 42.0}; - EXPECT_EQ(&a, dp.GetSource()); - EXPECT_EQ(&b, dp.GetTarget()); - EXPECT_EQ(SYS_SAGE_DATAPATH_ORIENTED, dp.GetOriented()); - EXPECT_EQ(SYS_SAGE_DATAPATH_TYPE_NONE, dp.GetDpType()); - EXPECT_EQ(5.0, dp.GetBw()); - EXPECT_EQ(42.0, dp.GetLatency()); - } + "Constructor #1"_test = [] + { + Component a, b; + DataPath dp{&a, &b, SYS_SAGE_DATAPATH_ORIENTED, SYS_SAGE_DATAPATH_TYPE_PHYSICAL}; + expect(that % &a == dp.GetSource()); + expect(that % &b == dp.GetTarget()); + expect(that % SYS_SAGE_DATAPATH_ORIENTED == dp.GetOriented()); + expect(that % SYS_SAGE_DATAPATH_TYPE_PHYSICAL == dp.GetDpType()); + }; + "Constructor #2"_test = [] + { + Component a, b; + DataPath dp{&a, &b, SYS_SAGE_DATAPATH_ORIENTED, 5.0, 42.0}; + expect(that % &a == dp.GetSource()); + expect(that % &b == dp.GetTarget()); + expect(that % SYS_SAGE_DATAPATH_ORIENTED == dp.GetOriented()); + expect(that % SYS_SAGE_DATAPATH_TYPE_NONE == dp.GetDpType()); + expect(that % 5.0 == dp.GetBw()); + expect(that % 42.0 == dp.GetLatency()); + }; + "Constructor #3"_test = [] + { + Component a, b; + DataPath dp{&a, &b, SYS_SAGE_DATAPATH_ORIENTED, SYS_SAGE_DATAPATH_TYPE_PHYSICAL, 5.0, 42.0}; + expect(that % &a == dp.GetSource()); + expect(that % &b == dp.GetTarget()); + expect(that % SYS_SAGE_DATAPATH_ORIENTED == dp.GetOriented()); + expect(that % SYS_SAGE_DATAPATH_TYPE_PHYSICAL == dp.GetDpType()); + expect(that % 5.0 == dp.GetBw()); + expect(that % 42.0 == dp.GetLatency()); + }; + }; + + "Unidirectional data path"_test = [] { - DataPath dp{&a, &b, SYS_SAGE_DATAPATH_ORIENTED, SYS_SAGE_DATAPATH_TYPE_PHYSICAL, 5.0, 42.0}; - EXPECT_EQ(&a, dp.GetSource()); - EXPECT_EQ(&b, dp.GetTarget()); - EXPECT_EQ(SYS_SAGE_DATAPATH_ORIENTED, dp.GetOriented()); - EXPECT_EQ(SYS_SAGE_DATAPATH_TYPE_PHYSICAL, dp.GetDpType()); - EXPECT_EQ(5.0, dp.GetBw()); - EXPECT_EQ(42.0, dp.GetLatency()); - } -} - -TEST(DataPath, UnidirectionalDataPath) -{ - Component a, b; - DataPath dp{&a, &b, SYS_SAGE_DATAPATH_ORIENTED, SYS_SAGE_DATAPATH_TYPE_PHYSICAL}; - - ASSERT_NE(nullptr, a.GetDataPaths(SYS_SAGE_DATAPATH_INCOMING)); - ASSERT_NE(nullptr, a.GetDataPaths(SYS_SAGE_DATAPATH_OUTGOING)); - EXPECT_TRUE(a.GetDataPaths(SYS_SAGE_DATAPATH_INCOMING)->empty()); - EXPECT_EQ((std::vector{&dp}), *a.GetDataPaths(SYS_SAGE_DATAPATH_OUTGOING)); + Component a, b; + DataPath dp{&a, &b, SYS_SAGE_DATAPATH_ORIENTED, SYS_SAGE_DATAPATH_TYPE_PHYSICAL}; - ASSERT_NE(nullptr, b.GetDataPaths(SYS_SAGE_DATAPATH_INCOMING)); - ASSERT_NE(nullptr, b.GetDataPaths(SYS_SAGE_DATAPATH_OUTGOING)); - EXPECT_EQ((std::vector{&dp}), *b.GetDataPaths(SYS_SAGE_DATAPATH_INCOMING)); - EXPECT_TRUE(b.GetDataPaths(SYS_SAGE_DATAPATH_OUTGOING)->empty()); -} + expect(that % (nullptr != a.GetDataPaths(SYS_SAGE_DATAPATH_INCOMING)) >> fatal); + expect(that % (nullptr != a.GetDataPaths(SYS_SAGE_DATAPATH_OUTGOING)) >> fatal); + expect(that % a.GetDataPaths(SYS_SAGE_DATAPATH_INCOMING)->empty()); + expect(that % (std::vector{&dp}) == *a.GetDataPaths(SYS_SAGE_DATAPATH_OUTGOING)); -TEST(DataPath, BidirectionalDataPath) -{ - Component a, b; - DataPath dp{&a, &b, SYS_SAGE_DATAPATH_BIDIRECTIONAL, SYS_SAGE_DATAPATH_TYPE_PHYSICAL}; + expect(that % (nullptr != b.GetDataPaths(SYS_SAGE_DATAPATH_INCOMING)) >> fatal); + expect(that % (nullptr != b.GetDataPaths(SYS_SAGE_DATAPATH_OUTGOING)) >> fatal); + expect(that % (std::vector{&dp}) == *b.GetDataPaths(SYS_SAGE_DATAPATH_INCOMING)); + expect(that % b.GetDataPaths(SYS_SAGE_DATAPATH_OUTGOING)->empty()); + }; - ASSERT_NE(nullptr, a.GetDataPaths(SYS_SAGE_DATAPATH_INCOMING)); - ASSERT_NE(nullptr, a.GetDataPaths(SYS_SAGE_DATAPATH_OUTGOING)); - EXPECT_EQ((std::vector{&dp}), *a.GetDataPaths(SYS_SAGE_DATAPATH_INCOMING)); - EXPECT_EQ((std::vector{&dp}), *a.GetDataPaths(SYS_SAGE_DATAPATH_OUTGOING)); + "Bidirectional data path"_test = [] + { + Component a, b; + DataPath dp{&a, &b, SYS_SAGE_DATAPATH_BIDIRECTIONAL, SYS_SAGE_DATAPATH_TYPE_PHYSICAL}; - ASSERT_NE(nullptr, b.GetDataPaths(SYS_SAGE_DATAPATH_INCOMING)); - ASSERT_NE(nullptr, b.GetDataPaths(SYS_SAGE_DATAPATH_OUTGOING)); - EXPECT_EQ((std::vector{&dp}), *b.GetDataPaths(SYS_SAGE_DATAPATH_INCOMING)); - EXPECT_EQ((std::vector{&dp}), *b.GetDataPaths(SYS_SAGE_DATAPATH_OUTGOING)); -} + expect(that % nullptr != a.GetDataPaths(SYS_SAGE_DATAPATH_INCOMING) >> fatal); + expect(that % (nullptr != a.GetDataPaths(SYS_SAGE_DATAPATH_OUTGOING)) >> fatal); + expect(that % (std::vector{&dp}) == *a.GetDataPaths(SYS_SAGE_DATAPATH_INCOMING)); + expect(that % (std::vector{&dp}) == *a.GetDataPaths(SYS_SAGE_DATAPATH_OUTGOING)); -TEST(DataPath, GetDpByType) -{ - Component a, b; - DataPath dp1{&a, &b, SYS_SAGE_DATAPATH_ORIENTED, SYS_SAGE_DATAPATH_TYPE_LOGICAL}; - DataPath dp2{&a, &b, SYS_SAGE_DATAPATH_ORIENTED, SYS_SAGE_DATAPATH_TYPE_PHYSICAL}; - DataPath dp3{&a, &b, SYS_SAGE_DATAPATH_ORIENTED, SYS_SAGE_DATAPATH_TYPE_PHYSICAL}; - DataPath dp4{&b, &a, SYS_SAGE_DATAPATH_ORIENTED, SYS_SAGE_DATAPATH_TYPE_PHYSICAL}; - - EXPECT_EQ(&dp1, a.GetDpByType(SYS_SAGE_DATAPATH_TYPE_LOGICAL, SYS_SAGE_DATAPATH_OUTGOING)); - EXPECT_EQ(&dp2, a.GetDpByType(SYS_SAGE_DATAPATH_TYPE_PHYSICAL, SYS_SAGE_DATAPATH_OUTGOING)); - EXPECT_EQ(nullptr, a.GetDpByType(SYS_SAGE_DATAPATH_TYPE_L3CAT, SYS_SAGE_DATAPATH_OUTGOING)); - EXPECT_EQ(&dp4, a.GetDpByType(SYS_SAGE_DATAPATH_TYPE_PHYSICAL, SYS_SAGE_DATAPATH_INCOMING)); - EXPECT_EQ(&dp4, b.GetDpByType(SYS_SAGE_DATAPATH_TYPE_PHYSICAL, SYS_SAGE_DATAPATH_OUTGOING)); - EXPECT_EQ(&dp4, b.GetDpByType(SYS_SAGE_DATAPATH_TYPE_PHYSICAL, SYS_SAGE_DATAPATH_INCOMING | SYS_SAGE_DATAPATH_OUTGOING)); -} - -TEST(DataPath, GetAllDpByType) -{ - Component a, b; - DataPath dp1{&a, &b, SYS_SAGE_DATAPATH_ORIENTED, SYS_SAGE_DATAPATH_TYPE_LOGICAL}; - DataPath dp2{&a, &b, SYS_SAGE_DATAPATH_ORIENTED, SYS_SAGE_DATAPATH_TYPE_PHYSICAL}; - DataPath dp3{&a, &b, SYS_SAGE_DATAPATH_ORIENTED, SYS_SAGE_DATAPATH_TYPE_PHYSICAL}; - DataPath dp4{&b, &a, SYS_SAGE_DATAPATH_ORIENTED, SYS_SAGE_DATAPATH_TYPE_PHYSICAL}; + expect(that % (nullptr != b.GetDataPaths(SYS_SAGE_DATAPATH_INCOMING)) >> fatal); + expect(that % (nullptr != b.GetDataPaths(SYS_SAGE_DATAPATH_OUTGOING)) >> fatal); + expect(that % (std::vector{&dp}) == *b.GetDataPaths(SYS_SAGE_DATAPATH_INCOMING)); + expect(that % (std::vector{&dp}) == *b.GetDataPaths(SYS_SAGE_DATAPATH_OUTGOING)); + }; + "Get data path by type"_test = [] { - std::vector v; - a.GetAllDpByType(&v, SYS_SAGE_DATAPATH_TYPE_LOGICAL, SYS_SAGE_DATAPATH_INCOMING); - EXPECT_TRUE(v.empty()); - } - + Component a, b; + DataPath dp1{&a, &b, SYS_SAGE_DATAPATH_ORIENTED, SYS_SAGE_DATAPATH_TYPE_LOGICAL}; + DataPath dp2{&a, &b, SYS_SAGE_DATAPATH_ORIENTED, SYS_SAGE_DATAPATH_TYPE_PHYSICAL}; + DataPath dp3{&a, &b, SYS_SAGE_DATAPATH_ORIENTED, SYS_SAGE_DATAPATH_TYPE_PHYSICAL}; + DataPath dp4{&b, &a, SYS_SAGE_DATAPATH_ORIENTED, SYS_SAGE_DATAPATH_TYPE_PHYSICAL}; + + expect(that % &dp1 == a.GetDpByType(SYS_SAGE_DATAPATH_TYPE_LOGICAL, SYS_SAGE_DATAPATH_OUTGOING)); + expect(that % &dp2 == a.GetDpByType(SYS_SAGE_DATAPATH_TYPE_PHYSICAL, SYS_SAGE_DATAPATH_OUTGOING)); + expect(that % nullptr == a.GetDpByType(SYS_SAGE_DATAPATH_TYPE_L3CAT, SYS_SAGE_DATAPATH_OUTGOING)); + expect(that % &dp4 == a.GetDpByType(SYS_SAGE_DATAPATH_TYPE_PHYSICAL, SYS_SAGE_DATAPATH_INCOMING)); + expect(that % &dp4 == b.GetDpByType(SYS_SAGE_DATAPATH_TYPE_PHYSICAL, SYS_SAGE_DATAPATH_OUTGOING)); + expect(that % &dp4 == b.GetDpByType(SYS_SAGE_DATAPATH_TYPE_PHYSICAL, SYS_SAGE_DATAPATH_INCOMING | SYS_SAGE_DATAPATH_OUTGOING)); + }; + + "Get all data paths by type"_test = [] { - std::vector v; - a.GetAllDpByType(&v, SYS_SAGE_DATAPATH_TYPE_PHYSICAL, SYS_SAGE_DATAPATH_INCOMING); - EXPECT_EQ((std::vector{&dp4}), v); - } + Component a, b; + DataPath dp1{&a, &b, SYS_SAGE_DATAPATH_ORIENTED, SYS_SAGE_DATAPATH_TYPE_LOGICAL}; + DataPath dp2{&a, &b, SYS_SAGE_DATAPATH_ORIENTED, SYS_SAGE_DATAPATH_TYPE_PHYSICAL}; + DataPath dp3{&a, &b, SYS_SAGE_DATAPATH_ORIENTED, SYS_SAGE_DATAPATH_TYPE_PHYSICAL}; + DataPath dp4{&b, &a, SYS_SAGE_DATAPATH_ORIENTED, SYS_SAGE_DATAPATH_TYPE_PHYSICAL}; - { std::vector v; - a.GetAllDpByType(&v, SYS_SAGE_DATAPATH_TYPE_LOGICAL, SYS_SAGE_DATAPATH_OUTGOING); - EXPECT_EQ((std::vector{&dp1}), v); - } - { - std::vector v; - a.GetAllDpByType(&v, SYS_SAGE_DATAPATH_TYPE_PHYSICAL, SYS_SAGE_DATAPATH_OUTGOING); - EXPECT_EQ((std::vector{&dp2, &dp3}), v); - } - - { - std::vector v; - a.GetAllDpByType(&v, SYS_SAGE_DATAPATH_TYPE_PHYSICAL, SYS_SAGE_DATAPATH_INCOMING | SYS_SAGE_DATAPATH_OUTGOING); - EXPECT_EQ((std::vector{&dp2, &dp3, &dp4}), v); - } -} + "Get all incoming logical data paths"_test = [&]() + { + a.GetAllDpByType(&v, SYS_SAGE_DATAPATH_TYPE_LOGICAL, SYS_SAGE_DATAPATH_INCOMING); + expect(that % v.empty()); + }; + + "Get all incoming physical data paths"_test = [&]() + { + std::vector v; + a.GetAllDpByType(&v, SYS_SAGE_DATAPATH_TYPE_PHYSICAL, SYS_SAGE_DATAPATH_INCOMING); + expect(std::vector{&dp4} == v); + }; + + "Get all outgoing logical data paths"_test = [&]() + { + std::vector v; + a.GetAllDpByType(&v, SYS_SAGE_DATAPATH_TYPE_LOGICAL, SYS_SAGE_DATAPATH_OUTGOING); + expect(that % std::vector{&dp1} == v); + }; + + "Get all outgoing physical data paths"_test = [&]() + { + std::vector v; + a.GetAllDpByType(&v, SYS_SAGE_DATAPATH_TYPE_PHYSICAL, SYS_SAGE_DATAPATH_OUTGOING); + expect(that % std::vector{&dp2, &dp3} == v); + }; + + "Get all physical data paths"_test = [&]() + { + std::vector v; + a.GetAllDpByType(&v, SYS_SAGE_DATAPATH_TYPE_PHYSICAL, SYS_SAGE_DATAPATH_INCOMING | SYS_SAGE_DATAPATH_OUTGOING); + expect(that % std::vector{&dp2, &dp3, &dp4} == v); + }; + }; +}; diff --git a/test/export.cpp b/test/export.cpp index d411449..1bc7519 100644 --- a/test/export.cpp +++ b/test/export.cpp @@ -1,4 +1,4 @@ -#include "gtest/gtest.h" +#include #include #include @@ -24,47 +24,37 @@ XmlStringView operator""_xsv(const char *string, size_t len) template using raii = std::unique_ptr; +using namespace boost::ut; + /** * Validates XML output of sys-sage using an XML schema file. */ void validate(std::string_view path) { auto parser = raii{xmlSchemaNewParserCtxt(SYS_SAGE_TEST_RESOURCE_DIR "/schema.xml"), xmlSchemaFreeParserCtxt}; - ASSERT_NE(parser, nullptr); + expect(that % (parser != nullptr) >> fatal); auto schema = raii{xmlSchemaParse(parser.get()), xmlSchemaFree}; - ASSERT_NE(schema, nullptr); + expect(that % (schema != nullptr) >> fatal); auto validator = raii{xmlSchemaNewValidCtxt(schema.get()), xmlSchemaFreeValidCtxt}; xmlSchemaSetValidErrors(validator.get(), (xmlSchemaValidityErrorFunc)fprintf, (xmlSchemaValidityWarningFunc)fprintf, stdout); auto doc = raii{xmlParseFile(path.data()), xmlFreeDoc}; - if (doc == nullptr) - { - std::string message{"Cannot open "}; - message += path; - message += " for validation"; - throw std::runtime_error{message}; - } + expect(that % (doc != nullptr) >> fatal); int code = xmlSchemaValidateDoc(validator.get(), doc.get()); - if (code != 0) - { - std::string message{"XML validation of "}; - message += path; - message += " failed"; - throw std::runtime_error{message}; - } + expect(that % (code == 0) >> fatal); auto pathContext = raii{xmlXPathNewContext(doc.get()), xmlXPathFreeContext}; - ASSERT_NE(pathContext, nullptr); + expect(that % (pathContext != nullptr) >> fatal); - // Validate that attributes either have child nodes or a value attribute + "Attributes either have child nodes or a value attribute"_test = [&] { auto attributeNodes = raii{xmlXPathEvalExpression(BAD_CAST("//Attribute"), pathContext.get()), xmlXPathFreeObject}; - ASSERT_NE(attributeNodes->nodesetval, nullptr); - ASSERT_EQ(attributeNodes->type, XPATH_NODESET); + expect(that % (attributeNodes->nodesetval != nullptr) >> fatal); + expect(that % (attributeNodes->type == XPATH_NODESET) >> fatal); for (int i = 0; i < attributeNodes->nodesetval->nodeNr; ++i) { xmlNode *node = attributeNodes->nodesetval->nodeTab[i]; @@ -76,12 +66,12 @@ void validate(std::string_view path) bool hasNeither = !(hasChildren || hasValueAttribute); bool hasEitherChildrenOrValueAttribute = hasChildren != hasValueAttribute; - EXPECT_TRUE(hasEitherChildrenOrValueAttribute || hasNeither) + expect(hasEitherChildrenOrValueAttribute || hasNeither) << path << ':' << node->line << " must have either child nodes or a value attribute"; } - } + }; - // Validate that all component addresses are unique and that all data path endpoints exist + "All component addresses are unique and that all data path endpoints exist"_test = [&] { auto componentAddrs = raii{xmlXPathEvalExpression(BAD_CAST("/sys-sage/components//*/@addr"), pathContext.get()), xmlXPathFreeObject}; auto dataPathEndpoints = raii{ @@ -96,7 +86,7 @@ void validate(std::string_view path) { auto node = componentAddrs->nodesetval->nodeTab[i]; XmlStringView addr = node->children->content; - EXPECT_FALSE(addrs.contains(addr)) + expect(!addrs.contains(addr)) << path << ':' << node->children->line << " The addr attribute must be unique for each component"; addrs.insert(addr); } @@ -108,232 +98,168 @@ void validate(std::string_view path) { auto endpoint = dataPathEndpoints->nodesetval->nodeTab[i]; XmlStringView addr = endpoint->children->content; - EXPECT_TRUE(addrs.contains(addr)) + expect(addrs.contains(addr)) << path << ':' << endpoint->children->line << " The data path endpoint must be an existing component address"; } } - } -} - -TEST(Export, MinimalTopology) -{ - auto topo = new Component{42, "a name", SYS_SAGE_COMPONENT_NONE}; - exportToXml(topo, "test.xml"); - validate("test.xml"); -} - -TEST(Export, SampleOutput) -{ - validate(SYS_SAGE_TEST_RESOURCE_DIR "/sys-sage_sample_output.xml"); -} - -TEST(Export, SampleOutputWithAttributes) -{ - validate(SYS_SAGE_TEST_RESOURCE_DIR "/sys-sage_custom_attributes.xml"); + }; } xmlNode *getSingleNodeByPath(xmlChar *path, xmlXPathContext *context) { auto result = raii{xmlXPathEvalExpression(path, context), xmlXPathFreeObject}; - if (result->nodesetval == nullptr || result->type != XPATH_NODESET || result->nodesetval->nodeNr != 1) - { - std::string message{"Invalid query with path "}; - message += reinterpret_cast(path); - throw std::runtime_error{message}; - } + expect(that % result->nodesetval != nullptr && result->type == XPATH_NODESET && result->nodesetval->nodeNr == 1) + << "Invalid query path " << reinterpret_cast(path); return result->nodesetval->nodeTab[0]; } -TEST(Export, SingleComponent) +static suite<"export"> _ = [] { + "Minimal topology"_test = [] { - auto topo = new Topology; - auto memory = new Memory{topo, "A single memory component", 16}; - (void)memory; + auto topo = new Component{42, "a name", SYS_SAGE_COMPONENT_NONE}; exportToXml(topo, "test.xml"); - } - - { validate("test.xml"); + }; - auto doc = raii{xmlParseFile("test.xml"), xmlFreeDoc}; - ASSERT_NE(doc, nullptr); - - auto pathContext = raii{xmlXPathNewContext(doc.get()), xmlXPathFreeContext}; - ASSERT_NE(pathContext, nullptr); + "Sample output"_test = [] + { + validate(SYS_SAGE_TEST_RESOURCE_DIR "/sys-sage_sample_output.xml"); + }; - xmlNode *topo = nullptr; - ASSERT_NO_THROW(topo = getSingleNodeByPath(BAD_CAST("/sys-sage/components/Topology"), pathContext.get())); + "Sample output with attributes"_test = [] + { + validate(SYS_SAGE_TEST_RESOURCE_DIR "/sys-sage_custom_attributes.xml"); + }; + "Single component"_test = [] + { { - auto result = raii{xmlXPathNodeEval(topo, BAD_CAST("string(@id)"), pathContext.get()), xmlXPathFreeObject}; - ASSERT_NE(result, nullptr); - ASSERT_EQ("0"_xsv, result->stringval); + auto topo = new Topology; + new Memory{topo, "A single memory component", 16}; + exportToXml(topo, "test.xml"); } { - auto result = raii{xmlXPathNodeEval(topo, BAD_CAST("string(@name)"), pathContext.get()), xmlXPathFreeObject}; - ASSERT_NE(result, nullptr); - ASSERT_EQ("sys-sage Topology"_xsv, result->stringval); - } + validate("test.xml"); - xmlNode *memory = nullptr; - ASSERT_NO_THROW(memory = getSingleNodeByPath(BAD_CAST("/sys-sage/components/Topology/Memory"), pathContext.get())); + auto doc = raii{xmlParseFile("test.xml"), xmlFreeDoc}; + expect(that % (doc != nullptr) >> fatal); - { - auto result = raii{xmlXPathNodeEval(memory, BAD_CAST("string(@id)"), pathContext.get()), xmlXPathFreeObject}; - ASSERT_NE(result, nullptr); - ASSERT_EQ("0"_xsv, result->stringval); - } + auto pathContext = raii{xmlXPathNewContext(doc.get()), xmlXPathFreeContext}; + expect(that % (pathContext != nullptr) >> fatal); - { - auto result = raii{xmlXPathNodeEval(memory, BAD_CAST("string(@name)"), pathContext.get()), xmlXPathFreeObject}; - ASSERT_NE(result, nullptr); - ASSERT_EQ("A single memory component"_xsv, result->stringval); - } + xmlNode *topo = getSingleNodeByPath(BAD_CAST("/sys-sage/components/Topology"), pathContext.get()); + xmlNode *memory = getSingleNodeByPath(BAD_CAST("/sys-sage/components/Topology/Memory"), pathContext.get()); - { - auto result = raii{xmlXPathNodeEval(memory, BAD_CAST("string(@size)"), pathContext.get()), xmlXPathFreeObject}; - ASSERT_NE(result, nullptr); - ASSERT_EQ("16"_xsv, result->stringval); + for (const auto &[node, xpath, value] : std::vector{ + std::tuple{topo, "string(@id)", "0"}, + std::tuple{topo, "string(@name)", "sys-sage Topology"}, + std::tuple{memory, "string(@id)", "0"}, + std::tuple{memory, "string(@name)", "A single memory component"}, + std::tuple{memory, "string(@size)", "16"}, + }) + { + auto result = raii{xmlXPathNodeEval(node, BAD_CAST(xpath), pathContext.get()), xmlXPathFreeObject}; + expect((result != nullptr) and that % XmlStringView{BAD_CAST(value)} == XmlStringView{result->stringval}); + } } - } -} + }; -TEST(Export, CustomAttributes) -{ + "Custom attributes"_test = [] { - Topology topo; - Node node{&topo, 1}; - - std::string codename = "marsupial"; - std::string foo = "foo"; - int rackNo = 15; - node.attrib["codename"] = reinterpret_cast(&codename); - node.attrib["rack_no"] = reinterpret_cast(&rackNo); - node.attrib["unknown_will_not_be_printed"] = reinterpret_cast(&foo); - - struct My_core_attributes { - double temperature; - int frequency; - }; + Topology topo; + Node node{&topo, 1}; - My_core_attributes attrib{.temperature = 38.222, .frequency = 2000000000}; - Core c1{&node, 1}; - c1.attrib["my_core_info"] = reinterpret_cast(&attrib); + std::string codename = "marsupial"; + std::string foo = "foo"; + int rackNo = 15; + node.attrib["codename"] = reinterpret_cast(&codename); + node.attrib["rack_no"] = reinterpret_cast(&rackNo); + node.attrib["unknown_will_not_be_printed"] = reinterpret_cast(&foo); - auto print_my_attribs = [](string key, void *value, string *ret_value_str) -> int - { - if (key == "codename" || key == "info") + struct My_core_attributes { - *ret_value_str = *(string *)value; - return 1; - } - else if (key == "rack_no") - { - *ret_value_str = std::to_string(*(int *)value); - return 1; - } + double temperature; + int frequency; + }; - return 0; - }; + My_core_attributes attrib{.temperature = 38.222, .frequency = 2000000000}; + Core c1{&node, 1}; + c1.attrib["my_core_info"] = reinterpret_cast(&attrib); - auto print_my_custom_attribs = [](string key, void *value, xmlNode *xml) -> int - { - if (key != "my_core_info") + auto print_my_attribs = [](string key, void *value, string *ret_value_str) -> int { - return 0; - } - - auto custom = reinterpret_cast(value); - auto temperatur = std::to_string(custom->temperature); - auto frequency = std::to_string(custom->frequency); - xmlNode *attribNode = xmlNewNode(nullptr, BAD_CAST(key.c_str())); - xmlNewProp(attribNode, BAD_CAST("temperature"), BAD_CAST(temperatur.c_str())); - xmlNewProp(attribNode, BAD_CAST("temp_unit"), BAD_CAST("C")); - xmlNewProp(attribNode, BAD_CAST("frequency"), BAD_CAST(frequency.c_str())); - xmlNewProp(attribNode, BAD_CAST("freq_unit"), BAD_CAST("Hz")); - - xmlNode *attrib = xmlNewNode(nullptr, BAD_CAST("Attribute")); - xmlNewProp(attrib, BAD_CAST("name"), BAD_CAST(key.c_str())); - xmlAddChild(xml, attrib); - xmlAddChild(attrib, attribNode); - - return 1; - }; - - std::string output_name = "test.xml"; - exportToXml(&topo, output_name, print_my_attribs, print_my_custom_attribs); - } - - { - validate("test.xml"); - - auto doc = raii{xmlParseFile("test.xml"), xmlFreeDoc}; - ASSERT_NE(doc, nullptr); - - auto pathContext = raii{xmlXPathNewContext(doc.get()), xmlXPathFreeContext}; - ASSERT_NE(pathContext, nullptr); - - xmlNode *node = nullptr; - ASSERT_NO_THROW(node = getSingleNodeByPath(BAD_CAST("/sys-sage/components/Topology/Node"), pathContext.get())); - - { - auto result = raii{xmlXPathNodeEval(node, BAD_CAST("string(Attribute[1]/@name)"), pathContext.get()), xmlXPathFreeObject}; - ASSERT_NE(result, nullptr); - ASSERT_EQ("codename"_xsv, result->stringval); - } - - { - auto result = raii{xmlXPathNodeEval(node, BAD_CAST("string(Attribute[1]/@value)"), pathContext.get()), xmlXPathFreeObject}; - ASSERT_NE(result, nullptr); - ASSERT_EQ("marsupial"_xsv, result->stringval); - } - - { - auto result = raii{xmlXPathNodeEval(node, BAD_CAST("string(Attribute[2]/@name)"), pathContext.get()), xmlXPathFreeObject}; - ASSERT_NE(result, nullptr); - ASSERT_EQ("rack_no"_xsv, result->stringval); - } - - { - auto result = raii{xmlXPathNodeEval(node, BAD_CAST("string(Attribute[2]/@value)"), pathContext.get()), xmlXPathFreeObject}; - ASSERT_NE(result, nullptr); - ASSERT_EQ("15"_xsv, result->stringval); - } + if (key == "codename" || key == "info") + { + *ret_value_str = *(string *)value; + return 1; + } + else if (key == "rack_no") + { + *ret_value_str = std::to_string(*(int *)value); + return 1; + } - xmlNode *core = nullptr; - ASSERT_NO_THROW(core = getSingleNodeByPath(BAD_CAST("/sys-sage/components/Topology/Node/Core"), pathContext.get())); - - { - auto result = raii{xmlXPathNodeEval(core, BAD_CAST("string(Attribute/@name)"), pathContext.get()), xmlXPathFreeObject}; - ASSERT_NE(result, nullptr); - ASSERT_EQ("my_core_info"_xsv, result->stringval); - } + return 0; + }; - { - auto result = raii{xmlXPathNodeEval(core, BAD_CAST("string(Attribute/my_core_info/@temperature)"), pathContext.get()), xmlXPathFreeObject}; - ASSERT_NE(result, nullptr); - ASSERT_EQ("38.222000"_xsv, result->stringval); - } + auto print_my_custom_attribs = [](string key, void *value, xmlNode *xml) -> int + { + if (key != "my_core_info") + { + return 0; + } + + auto custom = reinterpret_cast(value); + auto temperatur = std::to_string(custom->temperature); + auto frequency = std::to_string(custom->frequency); + xmlNode *attribNode = xmlNewNode(nullptr, BAD_CAST(key.c_str())); + xmlNewProp(attribNode, BAD_CAST("temperature"), BAD_CAST(temperatur.c_str())); + xmlNewProp(attribNode, BAD_CAST("temp_unit"), BAD_CAST("C")); + xmlNewProp(attribNode, BAD_CAST("frequency"), BAD_CAST(frequency.c_str())); + xmlNewProp(attribNode, BAD_CAST("freq_unit"), BAD_CAST("Hz")); + + xmlNode *attrib = xmlNewNode(nullptr, BAD_CAST("Attribute")); + xmlNewProp(attrib, BAD_CAST("name"), BAD_CAST(key.c_str())); + xmlAddChild(xml, attrib); + xmlAddChild(attrib, attribNode); - { - auto result = raii{xmlXPathNodeEval(core, BAD_CAST("string(Attribute/my_core_info/@temp_unit)"), pathContext.get()), xmlXPathFreeObject}; - ASSERT_NE(result, nullptr); - ASSERT_EQ("C"_xsv, result->stringval); - } + return 1; + }; - { - auto result = raii{xmlXPathNodeEval(core, BAD_CAST("string(Attribute/my_core_info/@frequency)"), pathContext.get()), xmlXPathFreeObject}; - ASSERT_NE(result, nullptr); - ASSERT_EQ("2000000000"_xsv, result->stringval); + std::string output_name = "test.xml"; + exportToXml(&topo, output_name, print_my_attribs, print_my_custom_attribs); } { - auto result = raii{xmlXPathNodeEval(core, BAD_CAST("string(Attribute/my_core_info/@freq_unit)"), pathContext.get()), xmlXPathFreeObject}; - ASSERT_NE(result, nullptr); - ASSERT_EQ("Hz"_xsv, result->stringval); + validate("test.xml"); + + auto doc = raii{xmlParseFile("test.xml"), xmlFreeDoc}; + expect(that % (doc != nullptr) >> fatal); + + auto pathContext = raii{xmlXPathNewContext(doc.get()), xmlXPathFreeContext}; + expect(that % (pathContext != nullptr) >> fatal); + + xmlNode *node = getSingleNodeByPath(BAD_CAST("/sys-sage/components/Topology/Node"), pathContext.get()); + xmlNode *core = getSingleNodeByPath(BAD_CAST("/sys-sage/components/Topology/Node/Core"), pathContext.get()); + + for (const auto &[node, xpath, value] : std::vector{ + std::tuple{node, "string(Attribute[1]/@name)", "codename"}, + std::tuple{node, "string(Attribute[1]/@value)", "marsupial"}, + std::tuple{node, "string(Attribute[2]/@name)", "rack_no"}, + std::tuple{node, "string(Attribute[2]/@value)", "15"}, + std::tuple{core, "string(Attribute/@name)", "my_core_info"}, + std::tuple{core, "string(Attribute/my_core_info/@temperature)", "38.222000"}, + std::tuple{core, "string(Attribute/my_core_info/@temp_unit)", "C"}, + std::tuple{core, "string(Attribute/my_core_info/@frequency)", "2000000000"}, + std::tuple{core, "string(Attribute/my_core_info/@freq_unit)", "Hz"}, + }) + { + auto result = raii{xmlXPathNodeEval(node, BAD_CAST(xpath), pathContext.get()), xmlXPathFreeObject}; + expect((result != nullptr) and that % XmlStringView{BAD_CAST(value)} == XmlStringView{result->stringval}); + } } - } -} + }; +}; diff --git a/test/googletest b/test/googletest deleted file mode 160000 index 7a7231c..0000000 --- a/test/googletest +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 7a7231c442484be389fdf01594310349ca0e42a8 diff --git a/test/gpu-topo.cpp b/test/gpu-topo.cpp index 8fd0b2b..4d310e8 100644 --- a/test/gpu-topo.cpp +++ b/test/gpu-topo.cpp @@ -1,56 +1,49 @@ -#include "gtest/gtest.h" +#include #include "sys-sage.hpp" -TEST(GpuTopo, parseGpuTopo) +using namespace boost::ut; + +static suite<"gpu-topo"> _ = [] { Topology topo; Chip gpu{&topo}; - ASSERT_EQ(0, parseGpuTopo(&gpu, SYS_SAGE_TEST_RESOURCE_DIR "/pascal_gpu_topo.csv")); - - { - std::vector components; - topo.GetSubcomponentsByType(&components, SYS_SAGE_COMPONENT_MEMORY); - EXPECT_EQ(1, components.size()); - } - { - std::vector components; - topo.GetSubcomponentsByType(&components, SYS_SAGE_COMPONENT_SUBDIVISION); - EXPECT_EQ(30, components.size()); - } - { - std::vector components; - topo.GetSubcomponentsByType(&components, SYS_SAGE_COMPONENT_CACHE); - EXPECT_EQ(151, components.size()); - } + expect(that % (0 == parseGpuTopo(&gpu, SYS_SAGE_TEST_RESOURCE_DIR "/pascal_gpu_topo.csv")) >> fatal); + + for (const auto &[type, count] : std::vector{ + std::tuple{SYS_SAGE_COMPONENT_MEMORY, 1}, + std::tuple{SYS_SAGE_COMPONENT_SUBDIVISION, 30}, + std::tuple{SYS_SAGE_COMPONENT_CACHE, 151}, + std::tuple{SYS_SAGE_COMPONENT_THREAD, 3840}, + }) { std::vector components; - topo.GetSubcomponentsByType(&components, SYS_SAGE_COMPONENT_THREAD); - EXPECT_EQ(3840, components.size()); + topo.GetSubcomponentsByType(&components, type); + expect(that % count == components.size()); } - EXPECT_EQ("Nvidia", gpu.GetVendor()); - EXPECT_EQ("Quadro P6000", gpu.GetModel()); + expect(that % "Nvidia"sv == gpu.GetVendor()); + expect(that % "Quadro P6000"sv == gpu.GetModel()); auto memory = dynamic_cast(gpu.GetChildByType(SYS_SAGE_COMPONENT_MEMORY)); - ASSERT_NE(nullptr, memory); - EXPECT_EQ(25637224578, memory->GetSize()); - EXPECT_EQ(3840, memory->GetDataPaths(SYS_SAGE_DATAPATH_OUTGOING)->size()); + expect(that % (nullptr != memory) >> fatal); + expect(that % 25637224578 == memory->GetSize()); + expect(that % 3840 == memory->GetDataPaths(SYS_SAGE_DATAPATH_OUTGOING)->size()); auto cacheL2 = dynamic_cast(memory->GetChildByType(SYS_SAGE_COMPONENT_CACHE)); - ASSERT_NE(nullptr, cacheL2); - EXPECT_EQ(3145728, cacheL2->GetCacheSize()); - EXPECT_EQ(32, cacheL2->GetCacheLineSize()); + expect(that % (nullptr != cacheL2) >> fatal); + expect(that % 3145728 == cacheL2->GetCacheSize()); + expect(that % 32 == cacheL2->GetCacheLineSize()); auto subdivision = dynamic_cast(cacheL2->GetChildByType(SYS_SAGE_COMPONENT_SUBDIVISION)); - ASSERT_NE(nullptr, subdivision); - EXPECT_EQ(SYS_SAGE_SUBDIVISION_TYPE_GPU_SM, subdivision->GetSubdivisionType()); + expect(that % (nullptr != subdivision) >> fatal); + expect(that % SYS_SAGE_SUBDIVISION_TYPE_GPU_SM == subdivision->GetSubdivisionType()); auto cacheL1 = dynamic_cast(subdivision->GetChildByType(SYS_SAGE_COMPONENT_CACHE)); - ASSERT_NE(nullptr, cacheL1); - EXPECT_EQ(24588, cacheL1->GetCacheSize()); - EXPECT_EQ(32, cacheL1->GetCacheLineSize()); + expect(that % (nullptr != cacheL1) >> fatal); + expect(that % 24588 == cacheL1->GetCacheSize()); + expect(that % 32 == cacheL1->GetCacheLineSize()); auto thread = dynamic_cast(cacheL1->GetChildByType(SYS_SAGE_COMPONENT_THREAD)); - ASSERT_NE(nullptr, thread); -} + expect(that % (nullptr != thread) >> fatal); +}; diff --git a/test/hwloc.cpp b/test/hwloc.cpp index c35f91d..406c58d 100644 --- a/test/hwloc.cpp +++ b/test/hwloc.cpp @@ -1,71 +1,60 @@ -#include "gtest/gtest.h" - #include "sys-sage.hpp" -TEST(Hwloc, parseHwlocOutput) +#include + +using namespace boost::ut; + +static suite<"hwloc"> _ = [] { Topology topo; Node node{&topo}; - ASSERT_EQ(0, parseHwlocOutput(&node, SYS_SAGE_TEST_RESOURCE_DIR "/skylake_hwloc.xml")); - - { - std::vector components; - topo.GetSubcomponentsByType(&components, SYS_SAGE_COMPONENT_CHIP); - EXPECT_EQ(2, components.size()); - } - { - std::vector components; - topo.GetSubcomponentsByType(&components, SYS_SAGE_COMPONENT_NUMA); - EXPECT_EQ(4, components.size()); - } - { - std::vector components; - topo.GetSubcomponentsByType(&components, SYS_SAGE_COMPONENT_CACHE); - EXPECT_EQ(50, components.size()); - } - { - std::vector components; - topo.GetSubcomponentsByType(&components, SYS_SAGE_COMPONENT_CORE); - EXPECT_EQ(24, components.size()); - } + expect(that % (0 == parseHwlocOutput(&node, SYS_SAGE_TEST_RESOURCE_DIR "/skylake_hwloc.xml")) >> fatal); + + for (const auto &[type, count] : std::vector{ + std::tuple{SYS_SAGE_COMPONENT_CHIP, 2}, + std::tuple{SYS_SAGE_COMPONENT_NUMA, 4}, + std::tuple{SYS_SAGE_COMPONENT_CACHE, 50}, + std::tuple{SYS_SAGE_COMPONENT_CORE, 24}, + std::tuple{SYS_SAGE_COMPONENT_THREAD, 24}, + }) { std::vector components; - topo.GetSubcomponentsByType(&components, SYS_SAGE_COMPONENT_THREAD); - EXPECT_EQ(24, components.size()); + topo.GetSubcomponentsByType(&components, type); + expect(that % count == components.size()); } auto chip = dynamic_cast(node.GetChildByType(SYS_SAGE_COMPONENT_CHIP)); - ASSERT_NE(nullptr, chip); - EXPECT_EQ("GenuineIntel", chip->GetVendor()); - EXPECT_EQ("Intel(R) Xeon(R) Silver 4116 CPU @ 2.10GHz", chip->GetModel()); + expect(that % (chip != nullptr) >> fatal); + expect(that % "GenuineIntel"sv == chip->GetVendor()); + expect(that % "Intel(R) Xeon(R) Silver 4116 CPU @ 2.10GHz"sv == chip->GetModel()); auto cacheL3 = dynamic_cast(chip->GetChildByType(SYS_SAGE_COMPONENT_CACHE)); - ASSERT_NE(nullptr, cacheL3); - EXPECT_EQ(3, cacheL3->GetCacheLevel()); - EXPECT_EQ(17301504, cacheL3->GetCacheSize()); - EXPECT_EQ(11, cacheL3->GetCacheAssociativityWays()); - EXPECT_EQ(64, cacheL3->GetCacheLineSize()); + expect(that % (cacheL3 != nullptr) >> fatal); + expect(that % 3 == cacheL3->GetCacheLevel()); + expect(that % 17301504 == cacheL3->GetCacheSize()); + expect(that % 11 == cacheL3->GetCacheAssociativityWays()); + expect(that % 64 == cacheL3->GetCacheLineSize()); auto numa = dynamic_cast(cacheL3->GetChildByType(SYS_SAGE_COMPONENT_NUMA)); - ASSERT_NE(nullptr, numa); + expect(that % (numa != nullptr) >> fatal); auto cacheL2 = dynamic_cast(numa->GetChildByType(SYS_SAGE_COMPONENT_CACHE)); - ASSERT_NE(nullptr, cacheL2); - EXPECT_EQ(2, cacheL2->GetCacheLevel()); - EXPECT_EQ(1048576, cacheL2->GetCacheSize()); - EXPECT_EQ(16, cacheL2->GetCacheAssociativityWays()); - EXPECT_EQ(64, cacheL2->GetCacheLineSize()); + expect(that % (cacheL2 != nullptr) >> fatal); + expect(that % 2 == cacheL2->GetCacheLevel()); + expect(that % 1048576 == cacheL2->GetCacheSize()); + expect(that % 16 == cacheL2->GetCacheAssociativityWays()); + expect(that % 64 == cacheL2->GetCacheLineSize()); auto cacheL1 = dynamic_cast(cacheL2->GetChildByType(SYS_SAGE_COMPONENT_CACHE)); - ASSERT_NE(nullptr, cacheL1); - EXPECT_EQ(1, cacheL1->GetCacheLevel()); - EXPECT_EQ(32768, cacheL1->GetCacheSize()); - EXPECT_EQ(8, cacheL1->GetCacheAssociativityWays()); - EXPECT_EQ(64, cacheL1->GetCacheLineSize()); + expect(that % (cacheL1 != nullptr) >> fatal); + expect(that % 1 == cacheL1->GetCacheLevel()); + expect(that % 32768 == cacheL1->GetCacheSize()); + expect(that % 8 == cacheL1->GetCacheAssociativityWays()); + expect(that % 64 == cacheL1->GetCacheLineSize()); auto core = dynamic_cast(cacheL1->GetChildByType(SYS_SAGE_COMPONENT_CORE)); - ASSERT_NE(nullptr, core); + expect(that % (core != nullptr) >> fatal); auto thread = dynamic_cast(core->GetChildByType(SYS_SAGE_COMPONENT_THREAD)); - ASSERT_NE(nullptr, thread); -} \ No newline at end of file + expect(that % (thread != nullptr) >> fatal); +}; diff --git a/test/test.cpp b/test/test.cpp index 38d57bb..237c8ce 100644 --- a/test/test.cpp +++ b/test/test.cpp @@ -1,11 +1 @@ -#include "sys-sage.hpp" - -#include "gtest/gtest.h" - -#include - -int main(int argc, char **argv) -{ - testing::InitGoogleTest(&argc, argv); - return RUN_ALL_TESTS(); -} +int main() {} diff --git a/test/topology.cpp b/test/topology.cpp index 4fcaab6..51929dc 100644 --- a/test/topology.cpp +++ b/test/topology.cpp @@ -1,302 +1,307 @@ -#include "gtest/gtest.h" +#include #include "sys-sage.hpp" -TEST(Topology, Node) -{ - Node node{42}; - EXPECT_EQ(42, node.GetId()); - EXPECT_EQ(SYS_SAGE_COMPONENT_NODE, node.GetComponentType()); - EXPECT_EQ("Node", node.GetComponentTypeStr()); - EXPECT_EQ(nullptr, node.GetParent()); - - Node root{0}; - node.SetParent(&root); - EXPECT_EQ(&root, node.GetParent()); -} - -TEST(Topology, Topology) -{ - Topology node; - EXPECT_EQ(0, node.GetId()); - EXPECT_EQ(SYS_SAGE_COMPONENT_TOPOLOGY, node.GetComponentType()); - EXPECT_EQ("Topology", node.GetComponentTypeStr()); -} +using namespace boost::ut; -TEST(Topology, Thread) -{ - Node root{0}; - Thread node{&root, 42, "foo"}; - EXPECT_EQ(&root, node.GetParent()); - EXPECT_EQ(42, node.GetId()); - EXPECT_EQ("foo", node.GetName()); - EXPECT_EQ(SYS_SAGE_COMPONENT_THREAD, node.GetComponentType()); - EXPECT_EQ("HW_thread", node.GetComponentTypeStr()); -} - -TEST(Topology, Core) -{ - Node root{0}; - Core node{&root, 42, "foo"}; - EXPECT_EQ(&root, node.GetParent()); - EXPECT_EQ(42, node.GetId()); - EXPECT_EQ("foo", node.GetName()); - EXPECT_EQ(SYS_SAGE_COMPONENT_CORE, node.GetComponentType()); - EXPECT_EQ("Core", node.GetComponentTypeStr()); -} - -TEST(Topology, Cache) -{ - Node root{0}; - Cache node{&root, 42, "3", 32, 2, 16}; - EXPECT_EQ(&root, node.GetParent()); - EXPECT_EQ(42, node.GetId()); - EXPECT_EQ("Cache", node.GetName()); - EXPECT_EQ("3", node.GetCacheName()); - EXPECT_EQ(3, node.GetCacheLevel()); - EXPECT_EQ(32, node.GetCacheSize()); - EXPECT_EQ(2, node.GetCacheAssociativityWays()); - EXPECT_EQ(16, node.GetCacheLineSize()); - EXPECT_EQ(SYS_SAGE_COMPONENT_CACHE, node.GetComponentType()); - EXPECT_EQ("Cache", node.GetComponentTypeStr()); - - node.SetCacheSize(16); - EXPECT_EQ(16, node.GetCacheSize()); - - node.SetCacheLineSize(8); - EXPECT_EQ(8, node.GetCacheLineSize()); -} - -TEST(Topology, Subdivision) -{ - Node root{0}; - Subdivision node{&root, 42, "foo"}; - EXPECT_EQ(&root, node.GetParent()); - EXPECT_EQ(42, node.GetId()); - EXPECT_EQ("foo", node.GetName()); - EXPECT_EQ(SYS_SAGE_COMPONENT_SUBDIVISION, node.GetComponentType()); - EXPECT_EQ("Subdivision", node.GetComponentTypeStr()); - - node.SetSubdivisionType(3); - EXPECT_EQ(3, node.GetSubdivisionType()); -} - -TEST(Topology, Numa) -{ - Node root{0}; - Numa node{&root, 42, 64}; - EXPECT_EQ(&root, node.GetParent()); - EXPECT_EQ(42, node.GetId()); - EXPECT_EQ("Numa", node.GetName()); - EXPECT_EQ(SYS_SAGE_COMPONENT_NUMA, node.GetComponentType()); - EXPECT_EQ("NUMA", node.GetComponentTypeStr()); - - node.SetSubdivisionType(3); - EXPECT_EQ(3, node.GetSubdivisionType()); -} - -TEST(Topology, Chip) -{ - Node root{0}; - Chip node{&root, 42, "foo", 5}; - EXPECT_EQ(&root, node.GetParent()); - EXPECT_EQ(42, node.GetId()); - EXPECT_EQ("foo", node.GetName()); - EXPECT_EQ(SYS_SAGE_COMPONENT_CHIP, node.GetComponentType()); - EXPECT_EQ("Chip", node.GetComponentTypeStr()); - EXPECT_EQ(5, node.GetChipType()); - - node.SetModel("model"); - EXPECT_EQ("model", node.GetModel()); - - node.SetVendor("vendor"); - EXPECT_EQ("vendor", node.GetVendor()); - - node.SetChipType(6); - EXPECT_EQ(6, node.GetChipType()); -} - -TEST(Topology, Memory) +static suite<"topology"> _ = [] { - Node root{0}; - Memory node{&root, "foo", 32}; - EXPECT_EQ(&root, node.GetParent()); - EXPECT_EQ(0, node.GetId()); - EXPECT_EQ("foo", node.GetName()); - EXPECT_EQ(32, node.GetSize()); - EXPECT_EQ(SYS_SAGE_COMPONENT_MEMORY, node.GetComponentType()); - EXPECT_EQ("Memory", node.GetComponentTypeStr()); - - node.SetSize(64); - EXPECT_EQ(64, node.GetSize()); -} - -TEST(Topology, Storage) -{ - Node root{0}; - Storage node{&root}; - EXPECT_EQ(&root, node.GetParent()); - EXPECT_EQ(SYS_SAGE_COMPONENT_STORAGE, node.GetComponentType()); - EXPECT_EQ("Storage", node.GetComponentTypeStr()); - - node.SetSize(64); - EXPECT_EQ(64, node.GetSize()); -} + "Node"_test = [] + { + Node node{42}; + expect(that % 42 == node.GetId()); + expect(that % SYS_SAGE_COMPONENT_NODE == node.GetComponentType()); + expect(that % "Node"sv == node.GetComponentTypeStr()); + expect(that % nullptr == node.GetParent()); + + Node root{0}; + node.SetParent(&root); + expect(that % &root == node.GetParent()); + }; + + "Topology"_test = [] + { + Topology node; + expect(that % 0 == node.GetId()); + expect(that % SYS_SAGE_COMPONENT_TOPOLOGY == node.GetComponentType()); + expect(that % "Topology"sv == node.GetComponentTypeStr()); + }; -TEST(Topology, ChildrenInsertionAndRemoval) -{ - Node a; - Node b; - Node c; - Node d; - - a.InsertChild(&b); - a.InsertChild(&c); - a.InsertChild(&d); - ASSERT_EQ(3, a.GetChildren()->size()); - - ASSERT_EQ(1, a.RemoveChild(&b)); - ASSERT_EQ(2, a.GetChildren()->size()); - ASSERT_EQ(std::find(a.GetChildren()->begin(), a.GetChildren()->end(), &b), a.GetChildren()->end()); - ASSERT_NE(std::find(a.GetChildren()->begin(), a.GetChildren()->end(), &c), a.GetChildren()->end()); - ASSERT_NE(std::find(a.GetChildren()->begin(), a.GetChildren()->end(), &d), a.GetChildren()->end()); -} - -TEST(Topology, GetChild) -{ - Node a{1}; - Node b{2}; - Node c{3}; - Node d{4}; + "Thread"_test = [] + { + Node root{0}; + Thread node{&root, 42, "foo"}; + expect(that % &root == node.GetParent()); + expect(that % 42 == node.GetId()); + expect(that % "foo"sv == node.GetName()); + expect(that % SYS_SAGE_COMPONENT_THREAD == node.GetComponentType()); + expect(that % "HW_thread"sv == node.GetComponentTypeStr()); + }; + + "Core"_test = [] + { + Node root{0}; + Core node{&root, 42, "foo"}; + expect(that % &root == node.GetParent()); + expect(that % 42 == node.GetId()); + expect(that % "foo"sv == node.GetName()); + expect(that % SYS_SAGE_COMPONENT_CORE == node.GetComponentType()); + expect(that % "Core"sv == node.GetComponentTypeStr()); + }; + + "Cache"_test = [] + { + Node root{0}; + Cache node{&root, 42, "3", 32, 2, 16}; + expect(that % &root == node.GetParent()); + expect(that % 42 == node.GetId()); + expect(that % "Cache"sv == node.GetName()); + expect(that % "3"sv == node.GetCacheName()); + expect(that % 3 == node.GetCacheLevel()); + expect(that % 32 == node.GetCacheSize()); + expect(that % 2 == node.GetCacheAssociativityWays()); + expect(that % 16 == node.GetCacheLineSize()); + expect(that % SYS_SAGE_COMPONENT_CACHE == node.GetComponentType()); + expect(that % "Cache"sv == node.GetComponentTypeStr()); + + node.SetCacheSize(16); + expect(that % 16 == node.GetCacheSize()); + + node.SetCacheLineSize(8); + expect(that % 8 == node.GetCacheLineSize()); + }; + + "Subdivision"_test = [] + { + Node root{0}; + Subdivision node{&root, 42, "foo"}; + expect(that % &root == node.GetParent()); + expect(that % 42 == node.GetId()); + expect(that % "foo"sv == node.GetName()); + expect(that % SYS_SAGE_COMPONENT_SUBDIVISION == node.GetComponentType()); + expect(that % "Subdivision"sv == node.GetComponentTypeStr()); + + node.SetSubdivisionType(3); + expect(that % 3 == node.GetSubdivisionType()); + }; + + "Numa"_test = [] + { + Node root{0}; + Numa node{&root, 42, 64}; + expect(that % &root == node.GetParent()); + expect(that % 42 == node.GetId()); + expect(that % "Numa"sv == node.GetName()); + expect(that % SYS_SAGE_COMPONENT_NUMA == node.GetComponentType()); + expect(that % "NUMA"sv == node.GetComponentTypeStr()); + + node.SetSubdivisionType(3); + expect(that % 3 == node.GetSubdivisionType()); + }; + + "Chip"_test = [] + { + Node root{0}; + Chip node{&root, 42, "foo", 5}; + expect(that % &root == node.GetParent()); + expect(that % 42 == node.GetId()); + expect(that % "foo"sv == node.GetName()); + expect(that % SYS_SAGE_COMPONENT_CHIP == node.GetComponentType()); + expect(that % "Chip"sv == node.GetComponentTypeStr()); + expect(that % 5 == node.GetChipType()); + + node.SetModel("model"); + expect(that % "model"sv == node.GetModel()); + + node.SetVendor("vendor"); + expect(that % "vendor"sv == node.GetVendor()); + + node.SetChipType(6); + expect(that % 6 == node.GetChipType()); + }; + + "Memory"_test = [] + { + Node root{0}; + Memory node{&root, "foo", 32}; + expect(that % &root == node.GetParent()); + expect(that % 0 == node.GetId()); + expect(that % "foo"sv == node.GetName()); + expect(that % 32 == node.GetSize()); + expect(that % SYS_SAGE_COMPONENT_MEMORY == node.GetComponentType()); + expect(that % "Memory"sv == node.GetComponentTypeStr()); + + node.SetSize(64); + expect(that % 64 == node.GetSize()); + }; + + "Storage"_test = [] + { + Node root{0}; + Storage node{&root}; + expect(that % &root == node.GetParent()); + expect(that % SYS_SAGE_COMPONENT_STORAGE == node.GetComponentType()); + expect(that % "Storage"sv == node.GetComponentTypeStr()); - a.InsertChild(&b); - a.InsertChild(&c); - b.InsertChild(&d); + node.SetSize(64); + expect(that % 64 == node.GetSize()); + }; - EXPECT_EQ(a.GetChild(2), &b); - EXPECT_EQ(a.GetChild(3), &c); - EXPECT_EQ(a.GetChild(4), nullptr); -} + "Children insertion and removal"_test = [] + { + Node a; + Node b; + Node c; + Node d; -TEST(Topology, GetChildByType) -{ - Node a; - Memory b; - Memory c; - Chip d; + a.InsertChild(&b); + a.InsertChild(&c); + a.InsertChild(&d); + expect(that % 3 == a.GetChildren()->size()); + + expect(that % 1 == a.RemoveChild(&b)); + expect(that % (2 == a.GetChildren()->size()) >> fatal); + expect(that % (std::find(a.GetChildren()->begin(), a.GetChildren()->end(), &b) == a.GetChildren()->end())); + expect(that % (std::find(a.GetChildren()->begin(), a.GetChildren()->end(), &c) != a.GetChildren()->end())); + expect(that % (std::find(a.GetChildren()->begin(), a.GetChildren()->end(), &d) != a.GetChildren()->end())); + }; + + "Get child"_test = [] + { + Node a{1}; + Node b{2}; + Node c{3}; + Node d{4}; - a.InsertChild(&b); - a.InsertChild(&c); - a.InsertChild(&d); + a.InsertChild(&b); + a.InsertChild(&c); + b.InsertChild(&d); - EXPECT_EQ(a.GetChildByType(SYS_SAGE_COMPONENT_MEMORY), &b); - EXPECT_EQ(a.GetChildByType(SYS_SAGE_COMPONENT_CHIP), &d); - EXPECT_EQ(a.GetAllChildrenByType(SYS_SAGE_COMPONENT_MEMORY), (std::vector{&b, &c})); -} + expect(that % a.GetChild(2) == &b); + expect(that % a.GetChild(3) == &c); + expect(that % a.GetChild(4) == nullptr); + }; -TEST(Topology, CheckComponentTreeConsistency) -{ + "Get child by type"_test = [] { Node a; - Node b; - Node c; + Memory b; + Memory c; + Chip d; + a.InsertChild(&b); - b.InsertChild(&c); - EXPECT_EQ(0, a.CheckComponentTreeConsistency()); - } + a.InsertChild(&c); + a.InsertChild(&d); + + expect(that % a.GetChildByType(SYS_SAGE_COMPONENT_MEMORY) == &b); + expect(that % a.GetChildByType(SYS_SAGE_COMPONENT_CHIP) == &d); + expect(that % a.GetAllChildrenByType(SYS_SAGE_COMPONENT_MEMORY) == (std::vector{&b, &c})); + }; + + "Component tree consistency"_test = [] + { + { + Node a; + Node b; + Node c; + a.InsertChild(&b); + b.InsertChild(&c); + expect(that % 0 == a.CheckComponentTreeConsistency()); + } + { + Node a; + Node b; + Node c; + a.InsertChild(&b); + b.InsertChild(&c); + c.SetParent(&a); + expect(that % 1 == a.CheckComponentTreeConsistency()); + } + }; + + "Get deeper components"_test = [] { Node a; Node b; Node c; + Node d; + a.InsertChild(&b); - b.InsertChild(&c); - c.SetParent(&a); - EXPECT_EQ(1, a.CheckComponentTreeConsistency()); - } -} + a.InsertChild(&c); + c.InsertChild(&d); -TEST(Topology, GetComponentsNLevelsDeeper) -{ - Node a; - Node b; - Node c; - Node d; + std::vector array; + a.GetComponentsNLevelsDeeper(&array, 1); + expect(that % 2 == array.size()); + }; + + "Get subcomponents by type"_test = [] + { + Node a; + Chip b; + Memory c; + Chip d; - a.InsertChild(&b); - a.InsertChild(&c); - c.InsertChild(&d); + a.InsertChild(&b); + a.InsertChild(&c); + c.InsertChild(&d); - std::vector array; - a.GetComponentsNLevelsDeeper(&array, 1); - EXPECT_EQ(2, array.size()); -} + std::vector array; + a.GetSubcomponentsByType(&array, SYS_SAGE_COMPONENT_CHIP); + expect(that % 2 == array.size()); + }; -TEST(Topology, GetSubcomponentsByType) -{ - Node a; - Chip b; - Memory c; - Chip d; + "Get total number of threads"_test = [] + { + Node a; + Thread b; + Thread c; + Node d; + Thread e; + Node f; - a.InsertChild(&b); - a.InsertChild(&c); - c.InsertChild(&d); + a.InsertChild(&b); + a.InsertChild(&c); + a.InsertChild(&d); + d.InsertChild(&e); + d.InsertChild(&f); - std::vector array; - a.GetSubcomponentsByType(&array, SYS_SAGE_COMPONENT_CHIP); - EXPECT_EQ(2, array.size()); -} + expect(that % 3 == a.GetNumThreads()); + }; -TEST(Topology, GetNumThreads) -{ - Node a; - Thread b; - Thread c; - Node d; - Thread e; - Node f; - - a.InsertChild(&b); - a.InsertChild(&c); - a.InsertChild(&d); - d.InsertChild(&e); - d.InsertChild(&f); - - EXPECT_EQ(3, a.GetNumThreads()); -} - -TEST(Topology, GetSubtreeNodeList) -{ - Node a; - Node b; - Node c; - Node d; + "Linearize subtree"_test = [] + { + Node a; + Node b; + Node c; + Node d; + + a.InsertChild(&b); + b.InsertChild(&d); + a.InsertChild(&c); - a.InsertChild(&b); - b.InsertChild(&d); - a.InsertChild(&c); + std::vector array; + a.GetSubtreeNodeList(&array); + expect(that % array == (std::vector{&a, &b, &d, &c})); + }; - std::vector array; - a.GetSubtreeNodeList(&array); - EXPECT_EQ(array, (std::vector{&a, &b, &d, &c})); -} + "Tree depth"_test = [] + { + Node a; + Node b; + Node c; + Node d; + Node e; + Node f; + Node g; -TEST(Topology, GetTopoTreeDepth) -{ - Node a; - Node b; - Node c; - Node d; - Node e; - Node f; - Node g; - - a.InsertChild(&b); - b.InsertChild(&c); - a.InsertChild(&d); - d.InsertChild(&e); - e.InsertChild(&f); - a.InsertChild(&g); - - EXPECT_EQ(3, a.GetTopoTreeDepth()); -} + a.InsertChild(&b); + b.InsertChild(&c); + a.InsertChild(&d); + d.InsertChild(&e); + e.InsertChild(&f); + a.InsertChild(&g); + + expect(that % 3 == a.GetTopoTreeDepth()); + }; +}; diff --git a/test/ut b/test/ut new file mode 160000 index 0000000..c0319c7 --- /dev/null +++ b/test/ut @@ -0,0 +1 @@ +Subproject commit c0319c73e954dcd35159e8005dbbd76b33d9eed7 From ff5c058f8301f56269579c809acb85fbb3d8464f Mon Sep 17 00:00:00 2001 From: Jim Eckerlein Date: Fri, 10 Mar 2023 15:28:42 +0100 Subject: [PATCH 036/102] Fix gcc warnings --- test/datapath.cpp | 2 +- test/gpu-topo.cpp | 4 ++-- test/hwloc.cpp | 2 +- test/topology.cpp | 8 ++++---- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/test/datapath.cpp b/test/datapath.cpp index e840037..0b6483b 100644 --- a/test/datapath.cpp +++ b/test/datapath.cpp @@ -62,7 +62,7 @@ static suite<"data-path"> _ = [] Component a, b; DataPath dp{&a, &b, SYS_SAGE_DATAPATH_BIDIRECTIONAL, SYS_SAGE_DATAPATH_TYPE_PHYSICAL}; - expect(that % nullptr != a.GetDataPaths(SYS_SAGE_DATAPATH_INCOMING) >> fatal); + expect(that % (nullptr != a.GetDataPaths(SYS_SAGE_DATAPATH_INCOMING)) >> fatal); expect(that % (nullptr != a.GetDataPaths(SYS_SAGE_DATAPATH_OUTGOING)) >> fatal); expect(that % (std::vector{&dp}) == *a.GetDataPaths(SYS_SAGE_DATAPATH_INCOMING)); expect(that % (std::vector{&dp}) == *a.GetDataPaths(SYS_SAGE_DATAPATH_OUTGOING)); diff --git a/test/gpu-topo.cpp b/test/gpu-topo.cpp index 4d310e8..4504be5 100644 --- a/test/gpu-topo.cpp +++ b/test/gpu-topo.cpp @@ -19,7 +19,7 @@ static suite<"gpu-topo"> _ = [] { std::vector components; topo.GetSubcomponentsByType(&components, type); - expect(that % count == components.size()); + expect(that % _u(count) == components.size()); } expect(that % "Nvidia"sv == gpu.GetVendor()); @@ -28,7 +28,7 @@ static suite<"gpu-topo"> _ = [] auto memory = dynamic_cast(gpu.GetChildByType(SYS_SAGE_COMPONENT_MEMORY)); expect(that % (nullptr != memory) >> fatal); expect(that % 25637224578 == memory->GetSize()); - expect(that % 3840 == memory->GetDataPaths(SYS_SAGE_DATAPATH_OUTGOING)->size()); + expect(that % 3840_u == memory->GetDataPaths(SYS_SAGE_DATAPATH_OUTGOING)->size()); auto cacheL2 = dynamic_cast(memory->GetChildByType(SYS_SAGE_COMPONENT_CACHE)); expect(that % (nullptr != cacheL2) >> fatal); diff --git a/test/hwloc.cpp b/test/hwloc.cpp index 406c58d..5b7bd6a 100644 --- a/test/hwloc.cpp +++ b/test/hwloc.cpp @@ -20,7 +20,7 @@ static suite<"hwloc"> _ = [] { std::vector components; topo.GetSubcomponentsByType(&components, type); - expect(that % count == components.size()); + expect(that % _u(count) == components.size()); } auto chip = dynamic_cast(node.GetChildByType(SYS_SAGE_COMPONENT_CHIP)); diff --git a/test/topology.cpp b/test/topology.cpp index 51929dc..6d5422a 100644 --- a/test/topology.cpp +++ b/test/topology.cpp @@ -157,10 +157,10 @@ static suite<"topology"> _ = [] a.InsertChild(&b); a.InsertChild(&c); a.InsertChild(&d); - expect(that % 3 == a.GetChildren()->size()); + expect(that % 3_u == a.GetChildren()->size()); expect(that % 1 == a.RemoveChild(&b)); - expect(that % (2 == a.GetChildren()->size()) >> fatal); + expect(that % (2_u == a.GetChildren()->size()) >> fatal); expect(that % (std::find(a.GetChildren()->begin(), a.GetChildren()->end(), &b) == a.GetChildren()->end())); expect(that % (std::find(a.GetChildren()->begin(), a.GetChildren()->end(), &c) != a.GetChildren()->end())); expect(that % (std::find(a.GetChildren()->begin(), a.GetChildren()->end(), &d) != a.GetChildren()->end())); @@ -232,7 +232,7 @@ static suite<"topology"> _ = [] std::vector array; a.GetComponentsNLevelsDeeper(&array, 1); - expect(that % 2 == array.size()); + expect(that % 2_u == array.size()); }; "Get subcomponents by type"_test = [] @@ -248,7 +248,7 @@ static suite<"topology"> _ = [] std::vector array; a.GetSubcomponentsByType(&array, SYS_SAGE_COMPONENT_CHIP); - expect(that % 2 == array.size()); + expect(that % 2_u == array.size()); }; "Get total number of threads"_test = [] From 668f4d4f50963a02b850d60f0b178d7bd6a9b966 Mon Sep 17 00:00:00 2001 From: Jim Eckerlein Date: Fri, 10 Mar 2023 17:33:55 +0100 Subject: [PATCH 037/102] Use docker to run tests --- docker-compose.yaml | 14 ++++++++++++++ test/Dockerfile | 9 +++++++++ 2 files changed, 23 insertions(+) create mode 100644 docker-compose.yaml create mode 100644 test/Dockerfile diff --git a/docker-compose.yaml b/docker-compose.yaml new file mode 100644 index 0000000..2165da7 --- /dev/null +++ b/docker-compose.yaml @@ -0,0 +1,14 @@ +version: '3' +services: + test: + build: + context: test + dockerfile: Dockerfile + volumes: + - .:/sys-sage + entrypoint: ["/bin/sh","-c"] + command: + - | + cmake -S /sys-sage -B /build -DCMAKE_BUILD_TYPE=Debug -DTESTS=ON + cmake --build build --target test + ./build/test/test diff --git a/test/Dockerfile b/test/Dockerfile new file mode 100644 index 0000000..fd66869 --- /dev/null +++ b/test/Dockerfile @@ -0,0 +1,9 @@ +FROM ubuntu:22.10 + +RUN apt-get update + +# Install build tools +RUN apt-get install -yy g++ cmake git + +# Install dependencies +RUN apt-get install -yy libxml2-dev From ad533239b512f0ca556c21c0d2569ae4de949b37 Mon Sep 17 00:00:00 2001 From: Jim Eckerlein Date: Fri, 10 Mar 2023 17:55:29 +0100 Subject: [PATCH 038/102] Add readme for running tests --- README.md | 4 ++++ test/README.md | 14 ++++++++++++++ 2 files changed, 18 insertions(+) create mode 100644 test/README.md diff --git a/README.md b/README.md index b7296cc..2603846 100644 --- a/README.md +++ b/README.md @@ -33,6 +33,10 @@ cmake .. make all install ``` +### Testing + +Please refer to the [Testing Guide](test/README.md) for more information. + ### About sys-sage has been created by Stepan Vanecek (stepan.vanecek@tum.de) and the [CAPS TUM](https://www.ce.cit.tum.de/en/caps/homepage/). Please contact us in case of questions, bug reporting etc. diff --git a/test/README.md b/test/README.md new file mode 100644 index 0000000..f94f38e --- /dev/null +++ b/test/README.md @@ -0,0 +1,14 @@ +# Testing + +1. Install [Docker](https://docs.docker.com/engine/install/) +2. Launch a terminal and change to the project root +3. Type `docker compose run test` which will build the Docker image, instantiate a container, compile the code, and run all the tests + +During the image build process a few dependecies are fetched and installed via the apt package manager *inside the container* while the host system will remain untouched. + +The sys-sage repository is mounted into the container, i.e. changes made to files are immediately visible to the container. + +Otherwise useful Docker commands: +- `docker compose build`: Just rebuild the Docker image, i.e. reinstalls dependencies. +- `docker compose build --no-cache`: Enforce a clean rebuild of the Docker image. +- `docker compose run test "cat /proc/cpuinfo"`: Run a command inside the container. From 3adc772ca30a678985958e7fe1931526b7bf8bd7 Mon Sep 17 00:00:00 2001 From: Jim Eckerlein Date: Fri, 10 Mar 2023 18:17:11 +0100 Subject: [PATCH 039/102] Add cpuinfo tests --- test/CMakeLists.txt | 2 +- test/README.md | 2 +- test/cpuinfo.cpp | 19 +++++++++++++++++++ 3 files changed, 21 insertions(+), 2 deletions(-) create mode 100644 test/cpuinfo.cpp diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 4c85b01..96631db 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -1,6 +1,6 @@ include_directories(../src) # The include path is not set in the sys-sage target because CMAKE_INCLUDE_CURRENT_DIR is used instead add_subdirectory(ut) -add_executable(test test.cpp topology.cpp datapath.cpp hwloc.cpp gpu-topo.cpp caps-numa-benchmark.cpp export.cpp) +add_executable(test test.cpp topology.cpp datapath.cpp hwloc.cpp gpu-topo.cpp caps-numa-benchmark.cpp cpuinfo.cpp export.cpp) target_link_libraries(test PRIVATE ut sys-sage) target_compile_definitions(test PRIVATE SYS_SAGE_TEST_RESOURCE_DIR="${CMAKE_CURRENT_SOURCE_DIR}/resources") diff --git a/test/README.md b/test/README.md index f94f38e..c616b49 100644 --- a/test/README.md +++ b/test/README.md @@ -2,7 +2,7 @@ 1. Install [Docker](https://docs.docker.com/engine/install/) 2. Launch a terminal and change to the project root -3. Type `docker compose run test` which will build the Docker image, instantiate a container, compile the code, and run all the tests +3. Type `docker compose up` which will build the Docker image, instantiate a container, compile the code, and run all the tests During the image build process a few dependecies are fetched and installed via the apt package manager *inside the container* while the host system will remain untouched. diff --git a/test/cpuinfo.cpp b/test/cpuinfo.cpp new file mode 100644 index 0000000..1cd9b22 --- /dev/null +++ b/test/cpuinfo.cpp @@ -0,0 +1,19 @@ +#include + +#include "sys-sage.hpp" + +using namespace boost::ut; + +#if CPUINFO + +static suite<"cpuinfo"> _ = [] +{ + Core core; + Thread thread{&core}; + + core.SetFreq(42.0); + expect(that % 42.0 == core.GetFreq()); + expect(that % 42.0 == thread.GetFreq()); +}; + +#endif From 2ad888530e82cfc904f0617ae30c5425ea6b32c2 Mon Sep 17 00:00:00 2001 From: Jim Eckerlein Date: Fri, 10 Mar 2023 18:31:15 +0100 Subject: [PATCH 040/102] Add get-parent-by-type test --- test/topology.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/test/topology.cpp b/test/topology.cpp index 6d5422a..7354b76 100644 --- a/test/topology.cpp +++ b/test/topology.cpp @@ -198,6 +198,14 @@ static suite<"topology"> _ = [] expect(that % a.GetAllChildrenByType(SYS_SAGE_COMPONENT_MEMORY) == (std::vector{&b, &c})); }; + "Get parent by type"_test = [] + { + Cache a; + Core b{&a}; + Thread c{&b}; + expect(that % &a == c.FindParentByType(SYS_SAGE_COMPONENT_CACHE)); + }; + "Component tree consistency"_test = [] { { From a01a85836e1fd327c923679e21830433c8c16e86 Mon Sep 17 00:00:00 2001 From: Jim Eckerlein Date: Fri, 10 Mar 2023 19:51:29 +0100 Subject: [PATCH 041/102] Add cmake option for sanitizers --- CMakeLists.txt | 1 + docker-compose.yaml | 2 +- test/CMakeLists.txt | 5 +++++ 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index fd3222d..9561e10 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -49,6 +49,7 @@ option(DS_HWLOC "Build and install data source hwloc (Retrieves hwloc topology i option(DS_MT4G "Build and install data source mt4g (Compute and memory topology of NVidia GPUs)" OFF) option(DS_NUMA "Build and install data source caps-numa-benchmark" OFF) option(TESTS "Build tests" OFF) +option(TESTS_ENABLE_SANITIZERS "Build tests with enabled sanitizers" OFF) if(CAT_AWARE) add_definitions(-DCAT_AWARE ) diff --git a/docker-compose.yaml b/docker-compose.yaml index 2165da7..dae1675 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -9,6 +9,6 @@ services: entrypoint: ["/bin/sh","-c"] command: - | - cmake -S /sys-sage -B /build -DCMAKE_BUILD_TYPE=Debug -DTESTS=ON + cmake -S /sys-sage -B /build -DCMAKE_BUILD_TYPE=Debug -DTESTS=ON -DTESTS_ENABLE_SANITIZERS=OFF cmake --build build --target test ./build/test/test diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 96631db..6e859ac 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -4,3 +4,8 @@ add_subdirectory(ut) add_executable(test test.cpp topology.cpp datapath.cpp hwloc.cpp gpu-topo.cpp caps-numa-benchmark.cpp cpuinfo.cpp export.cpp) target_link_libraries(test PRIVATE ut sys-sage) target_compile_definitions(test PRIVATE SYS_SAGE_TEST_RESOURCE_DIR="${CMAKE_CURRENT_SOURCE_DIR}/resources") + +if(${TESTS_ENABLE_SANITIZERS}) + target_compile_options(test PRIVATE -fsanitize=address -fsanitize=leak -g3) + target_link_options(test PRIVATE -fsanitize=address -fsanitize=leak) +endif() From 09eba4b46ad094f3a3f669ba103347111d914ccf Mon Sep 17 00:00:00 2001 From: Jim Eckerlein Date: Mon, 20 Mar 2023 17:13:04 +0100 Subject: [PATCH 042/102] Add example workflow --- .github/workflows/test.yml | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 .github/workflows/test.yml diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..143243b --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,7 @@ +name: test +on: [push] +jobs: + build: + runs-on: [self-hosted] + steps: + - run: echo "Hello world" From add6d6759cdbb31203b17041aab85504d98e84c8 Mon Sep 17 00:00:00 2001 From: Jim Eckerlein Date: Tue, 4 Apr 2023 14:00:11 +0200 Subject: [PATCH 043/102] Use GitHub runner --- .github/workflows/test.yml | 2 +- docker-compose.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 143243b..b8163b6 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -2,6 +2,6 @@ name: test on: [push] jobs: build: - runs-on: [self-hosted] + runs-on: [ubuntu-latest] steps: - run: echo "Hello world" diff --git a/docker-compose.yaml b/docker-compose.yaml index dae1675..7de044d 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -6,7 +6,7 @@ services: dockerfile: Dockerfile volumes: - .:/sys-sage - entrypoint: ["/bin/sh","-c"] + entrypoint: [ "/bin/sh", "-c" ] command: - | cmake -S /sys-sage -B /build -DCMAKE_BUILD_TYPE=Debug -DTESTS=ON -DTESTS_ENABLE_SANITIZERS=OFF From eba96e6d78e1bf5c47e4f50b5d164fc327c43f6a Mon Sep 17 00:00:00 2001 From: Jim Eckerlein Date: Tue, 4 Apr 2023 14:01:48 +0200 Subject: [PATCH 044/102] Run tests in runner --- .github/workflows/test.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index b8163b6..2f05e10 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -4,4 +4,6 @@ jobs: build: runs-on: [ubuntu-latest] steps: - - run: echo "Hello world" + - run: cmake -S /sys-sage -B /build -DCMAKE_BUILD_TYPE=Debug -DTESTS=ON -DTESTS_ENABLE_SANITIZERS=OFF + - run: cmake --build build --target test + - run: ./build/test/test From 691915480847c21114f5b3a28c958f682a87431c Mon Sep 17 00:00:00 2001 From: Jim Eckerlein Date: Tue, 4 Apr 2023 14:04:42 +0200 Subject: [PATCH 045/102] Fix workflow --- .github/workflows/test.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 2f05e10..8939a3d 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -4,6 +4,7 @@ jobs: build: runs-on: [ubuntu-latest] steps: - - run: cmake -S /sys-sage -B /build -DCMAKE_BUILD_TYPE=Debug -DTESTS=ON -DTESTS_ENABLE_SANITIZERS=OFF + - run: mkdir -p build + - run: cmake -S . -B build -DCMAKE_BUILD_TYPE=Debug -DTESTS=ON -DTESTS_ENABLE_SANITIZERS=OFF - run: cmake --build build --target test - run: ./build/test/test From 63a6e6ca279cb6e535518658e31cfcc26063b289 Mon Sep 17 00:00:00 2001 From: Jim Eckerlein Date: Tue, 4 Apr 2023 14:08:15 +0200 Subject: [PATCH 046/102] ls --- .github/workflows/test.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 8939a3d..21877f8 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -4,6 +4,8 @@ jobs: build: runs-on: [ubuntu-latest] steps: + - run: pwd + - run: ls - run: mkdir -p build - run: cmake -S . -B build -DCMAKE_BUILD_TYPE=Debug -DTESTS=ON -DTESTS_ENABLE_SANITIZERS=OFF - run: cmake --build build --target test From a77b7d9a670207f162105bf6f545b23805e92960 Mon Sep 17 00:00:00 2001 From: Jim Eckerlein Date: Tue, 4 Apr 2023 14:09:01 +0200 Subject: [PATCH 047/102] ls --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 21877f8..b27fd1e 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -5,7 +5,7 @@ jobs: runs-on: [ubuntu-latest] steps: - run: pwd - - run: ls + - run: ls .. - run: mkdir -p build - run: cmake -S . -B build -DCMAKE_BUILD_TYPE=Debug -DTESTS=ON -DTESTS_ENABLE_SANITIZERS=OFF - run: cmake --build build --target test From e5b85cb27be7fedfe5f7823b7cb17d5c86ebc554 Mon Sep 17 00:00:00 2001 From: Jim Eckerlein Date: Tue, 4 Apr 2023 14:13:08 +0200 Subject: [PATCH 048/102] Add git checkout --- .github/workflows/test.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index b27fd1e..4b713e9 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -4,7 +4,12 @@ jobs: build: runs-on: [ubuntu-latest] steps: + - name: Git checkout + uses: actions/checkout@v3 + with: + submodules: recursive - run: pwd + - run: ls - run: ls .. - run: mkdir -p build - run: cmake -S . -B build -DCMAKE_BUILD_TYPE=Debug -DTESTS=ON -DTESTS_ENABLE_SANITIZERS=OFF From ec2093b85c6cd36e2b215d8ee21654a1591750f9 Mon Sep 17 00:00:00 2001 From: Jim Eckerlein Date: Tue, 4 Apr 2023 14:30:48 +0200 Subject: [PATCH 049/102] Try to use second job --- .github/workflows/test.yml | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 4b713e9..9a08bb8 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -7,11 +7,14 @@ jobs: - name: Git checkout uses: actions/checkout@v3 with: - submodules: recursive - - run: pwd - - run: ls - - run: ls .. + submodules: true - run: mkdir -p build - run: cmake -S . -B build -DCMAKE_BUILD_TYPE=Debug -DTESTS=ON -DTESTS_ENABLE_SANITIZERS=OFF - run: cmake --build build --target test - run: ./build/test/test + test: + needs: build + runs-on: [ubuntu-latest] + steps: + - run: pwd + - run: ls From 6d74f840ca5d8977c6d22660aa044a51955c0c1f Mon Sep 17 00:00:00 2001 From: Jim Eckerlein Date: Tue, 4 Apr 2023 14:55:54 +0200 Subject: [PATCH 050/102] Use artifacts --- .github/workflows/test.yml | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 9a08bb8..0c55592 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -11,10 +11,17 @@ jobs: - run: mkdir -p build - run: cmake -S . -B build -DCMAKE_BUILD_TYPE=Debug -DTESTS=ON -DTESTS_ENABLE_SANITIZERS=OFF - run: cmake --build build --target test - - run: ./build/test/test + # - run: ./build/test/test + - uses: actions/upload-artifact@v3 + with: + name: sys-sage + path: build test: needs: build runs-on: [ubuntu-latest] steps: + - uses: actions/download-artifact@v3 + with: + name: sys-sage - run: pwd - run: ls From bcbf5ee08b269b0365bf745047500a8bb19f7971 Mon Sep 17 00:00:00 2001 From: Jim Eckerlein Date: Tue, 4 Apr 2023 15:04:49 +0200 Subject: [PATCH 051/102] Test in separate job --- .github/workflows/test.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 0c55592..4e4d90e 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -11,7 +11,6 @@ jobs: - run: mkdir -p build - run: cmake -S . -B build -DCMAKE_BUILD_TYPE=Debug -DTESTS=ON -DTESTS_ENABLE_SANITIZERS=OFF - run: cmake --build build --target test - # - run: ./build/test/test - uses: actions/upload-artifact@v3 with: name: sys-sage @@ -23,5 +22,4 @@ jobs: - uses: actions/download-artifact@v3 with: name: sys-sage - - run: pwd - - run: ls + - run: ./test/test From bf4c6edad292b52ce073434a53dd87a48a982e99 Mon Sep 17 00:00:00 2001 From: Jim Eckerlein Date: Tue, 4 Apr 2023 15:11:55 +0200 Subject: [PATCH 052/102] Rename CMake options --- .github/workflows/test.yml | 22 +++++++++++----------- CMakeLists.txt | 6 +++--- docker-compose.yaml | 2 +- test/CMakeLists.txt | 6 +++--- 4 files changed, 18 insertions(+), 18 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 4e4d90e..1874a65 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,7 +1,7 @@ name: test on: [push] jobs: - build: + test: runs-on: [ubuntu-latest] steps: - name: Git checkout @@ -9,17 +9,17 @@ jobs: with: submodules: true - run: mkdir -p build - - run: cmake -S . -B build -DCMAKE_BUILD_TYPE=Debug -DTESTS=ON -DTESTS_ENABLE_SANITIZERS=OFF + - run: cmake -S . -B build -DCMAKE_BUILD_TYPE=Debug -DTEST=ON - run: cmake --build build --target test - - uses: actions/upload-artifact@v3 - with: - name: sys-sage - path: build - test: - needs: build + - run: ./build/test/test + asan: runs-on: [ubuntu-latest] steps: - - uses: actions/download-artifact@v3 + - name: Git checkout + uses: actions/checkout@v3 with: - name: sys-sage - - run: ./test/test + submodules: true + - run: mkdir -p build + - run: cmake -S . -B build -DCMAKE_BUILD_TYPE=Debug -DTEST=ON -DTEST_ASAN=ON + - run: cmake --build build --target test + - run: ./build/test/test diff --git a/CMakeLists.txt b/CMakeLists.txt index 9561e10..c422e25 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -48,8 +48,8 @@ option(DATA_SOURCES "Build and install all data sources" OFF) option(DS_HWLOC "Build and install data source hwloc (Retrieves hwloc topology information)" OFF) option(DS_MT4G "Build and install data source mt4g (Compute and memory topology of NVidia GPUs)" OFF) option(DS_NUMA "Build and install data source caps-numa-benchmark" OFF) -option(TESTS "Build tests" OFF) -option(TESTS_ENABLE_SANITIZERS "Build tests with enabled sanitizers" OFF) +option(TEST "Build tests" OFF) +option(TEST_ASAN "Build tests with enabled address sanitizers" OFF) if(CAT_AWARE) add_definitions(-DCAT_AWARE ) @@ -70,6 +70,6 @@ add_subdirectory(src) add_subdirectory(examples) add_subdirectory(data-sources) -if(${TESTS}) +if(${TEST}) add_subdirectory(test) endif() diff --git a/docker-compose.yaml b/docker-compose.yaml index 7de044d..baf7436 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -9,6 +9,6 @@ services: entrypoint: [ "/bin/sh", "-c" ] command: - | - cmake -S /sys-sage -B /build -DCMAKE_BUILD_TYPE=Debug -DTESTS=ON -DTESTS_ENABLE_SANITIZERS=OFF + cmake -S /sys-sage -B /build -DCMAKE_BUILD_TYPE=Debug -DTEST=ON cmake --build build --target test ./build/test/test diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 6e859ac..0017015 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -5,7 +5,7 @@ add_executable(test test.cpp topology.cpp datapath.cpp hwloc.cpp gpu-topo.cpp ca target_link_libraries(test PRIVATE ut sys-sage) target_compile_definitions(test PRIVATE SYS_SAGE_TEST_RESOURCE_DIR="${CMAKE_CURRENT_SOURCE_DIR}/resources") -if(${TESTS_ENABLE_SANITIZERS}) - target_compile_options(test PRIVATE -fsanitize=address -fsanitize=leak -g3) - target_link_options(test PRIVATE -fsanitize=address -fsanitize=leak) +if(${TEST_ASAN}) + target_compile_options(test PRIVATE -fsanitize=address -g3) + target_link_options(test PRIVATE -fsanitize=address) endif() From 9b660424d3aa104743f37ebb77d483359fbd06e3 Mon Sep 17 00:00:00 2001 From: Jim Eckerlein Date: Tue, 4 Apr 2023 15:18:45 +0200 Subject: [PATCH 053/102] Only run ASan if the test succeded --- .github/workflows/test.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 1874a65..613c1f0 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -14,6 +14,7 @@ jobs: - run: ./build/test/test asan: runs-on: [ubuntu-latest] + needs: test steps: - name: Git checkout uses: actions/checkout@v3 From aeb4d0027371e04742e0d79431481c269f094e9e Mon Sep 17 00:00:00 2001 From: Jim Eckerlein Date: Tue, 4 Apr 2023 15:32:55 +0200 Subject: [PATCH 054/102] Use clang in workflow --- .github/workflows/test.yml | 3 +++ test/CMakeLists.txt | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 613c1f0..33fd07d 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,5 +1,8 @@ name: test on: [push] +env: + CXX: clang + CC: clang jobs: test: runs-on: [ubuntu-latest] diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 0017015..64e064b 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -6,6 +6,6 @@ target_link_libraries(test PRIVATE ut sys-sage) target_compile_definitions(test PRIVATE SYS_SAGE_TEST_RESOURCE_DIR="${CMAKE_CURRENT_SOURCE_DIR}/resources") if(${TEST_ASAN}) - target_compile_options(test PRIVATE -fsanitize=address -g3) - target_link_options(test PRIVATE -fsanitize=address) + target_compile_options(test PRIVATE -fsanitize=address -O0 -g3) + target_link_options(test PRIVATE -fsanitize=address -O0) endif() From f86c52204715263169a9b40b0141c93708174be6 Mon Sep 17 00:00:00 2001 From: Jim Eckerlein Date: Tue, 4 Apr 2023 15:57:05 +0200 Subject: [PATCH 055/102] Use clang++ --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 33fd07d..a5ec772 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,7 +1,7 @@ name: test on: [push] env: - CXX: clang + CXX: clang++ CC: clang jobs: test: From 4d56379dc026b7e82f73325efe5fbae32de06939 Mon Sep 17 00:00:00 2001 From: Jim Eckerlein Date: Tue, 4 Apr 2023 16:06:28 +0200 Subject: [PATCH 056/102] Use composite action --- .github/actions/action.yml | 17 +++++++++++++++++ .github/workflows/test.yml | 18 +++--------------- test/CMakeLists.txt | 8 ++++++++ 3 files changed, 28 insertions(+), 15 deletions(-) create mode 100644 .github/actions/action.yml diff --git a/.github/actions/action.yml b/.github/actions/action.yml new file mode 100644 index 0000000..f7312af --- /dev/null +++ b/.github/actions/action.yml @@ -0,0 +1,17 @@ +name: Test +description: Builds and tests the library +inputs: + flags: + description: Configration flags + default: "" +runs: + using: composite + steps: + - name: Git checkout + uses: actions/checkout@v3 + with: + submodules: true + - run: mkdir -p build + - run: cmake -S . -B build -DCMAKE_BUILD_TYPE=Debug -DTEST=ON ${{ inputs.flags }} + - run: cmake --build build --target test + - run: ./build/test/test \ No newline at end of file diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index a5ec772..fe41fc0 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -7,23 +7,11 @@ jobs: test: runs-on: [ubuntu-latest] steps: - - name: Git checkout - uses: actions/checkout@v3 - with: - submodules: true - - run: mkdir -p build - - run: cmake -S . -B build -DCMAKE_BUILD_TYPE=Debug -DTEST=ON - - run: cmake --build build --target test - - run: ./build/test/test + - uses: ./.github/actions/action.yml asan: runs-on: [ubuntu-latest] needs: test steps: - - name: Git checkout - uses: actions/checkout@v3 + - uses: ./.github/actions/action.yml with: - submodules: true - - run: mkdir -p build - - run: cmake -S . -B build -DCMAKE_BUILD_TYPE=Debug -DTEST=ON -DTEST_ASAN=ON - - run: cmake --build build --target test - - run: ./build/test/test + flags: -DTEST_ASAN=ON diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 64e064b..215bfe5 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -9,3 +9,11 @@ if(${TEST_ASAN}) target_compile_options(test PRIVATE -fsanitize=address -O0 -g3) target_link_options(test PRIVATE -fsanitize=address -O0) endif() +if(${TEST_MSAN}) + target_compile_options(test PRIVATE -fsanitize=memory -O0 -g3) + target_link_options(test PRIVATE -fsanitize=memory -O0) +endif() +if(${TEST_TSAN}) + target_compile_options(test PRIVATE -fsanitize=thread -O0 -g3) + target_link_options(test PRIVATE -fsanitize=thread -O0) +endif() From e0771abc2d9f35399261daca0736025ada5cb062 Mon Sep 17 00:00:00 2001 From: Jim Eckerlein Date: Tue, 4 Apr 2023 16:08:32 +0200 Subject: [PATCH 057/102] Checkout before running sub-action --- .github/actions/action.yml | 4 ---- .github/workflows/test.yml | 8 ++++++++ 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/.github/actions/action.yml b/.github/actions/action.yml index f7312af..284db33 100644 --- a/.github/actions/action.yml +++ b/.github/actions/action.yml @@ -7,10 +7,6 @@ inputs: runs: using: composite steps: - - name: Git checkout - uses: actions/checkout@v3 - with: - submodules: true - run: mkdir -p build - run: cmake -S . -B build -DCMAKE_BUILD_TYPE=Debug -DTEST=ON ${{ inputs.flags }} - run: cmake --build build --target test diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index fe41fc0..6c027e2 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -7,11 +7,19 @@ jobs: test: runs-on: [ubuntu-latest] steps: + - name: Checkout + uses: actions/checkout@v3 + with: + submodules: true - uses: ./.github/actions/action.yml asan: runs-on: [ubuntu-latest] needs: test steps: + - name: Checkout + uses: actions/checkout@v3 + with: + submodules: true - uses: ./.github/actions/action.yml with: flags: -DTEST_ASAN=ON From 5908092b0c59450b4eb560c830c8d44753f4635c Mon Sep 17 00:00:00 2001 From: Jim Eckerlein Date: Tue, 4 Apr 2023 16:10:44 +0200 Subject: [PATCH 058/102] ls --- .github/workflows/test.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 6c027e2..e835aa1 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -11,6 +11,7 @@ jobs: uses: actions/checkout@v3 with: submodules: true + - run: ls -R - uses: ./.github/actions/action.yml asan: runs-on: [ubuntu-latest] From 984eb8e96f50da029a75386e8073d0a5ca05fbf1 Mon Sep 17 00:00:00 2001 From: Jim Eckerlein Date: Tue, 4 Apr 2023 16:11:49 +0200 Subject: [PATCH 059/102] ls -aR --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index e835aa1..d70499f 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -11,7 +11,7 @@ jobs: uses: actions/checkout@v3 with: submodules: true - - run: ls -R + - run: ls -aR - uses: ./.github/actions/action.yml asan: runs-on: [ubuntu-latest] From 2a87f31141a0a001d51890fc834a1d8931c7078f Mon Sep 17 00:00:00 2001 From: Jim Eckerlein Date: Tue, 4 Apr 2023 16:15:06 +0200 Subject: [PATCH 060/102] Fix directory structure --- .github/actions/{ => test}/action.yml | 2 -- .github/workflows/test.yml | 6 ++---- 2 files changed, 2 insertions(+), 6 deletions(-) rename .github/actions/{ => test}/action.yml (85%) diff --git a/.github/actions/action.yml b/.github/actions/test/action.yml similarity index 85% rename from .github/actions/action.yml rename to .github/actions/test/action.yml index 284db33..a672e16 100644 --- a/.github/actions/action.yml +++ b/.github/actions/test/action.yml @@ -1,5 +1,3 @@ -name: Test -description: Builds and tests the library inputs: flags: description: Configration flags diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index d70499f..e862c08 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,4 +1,3 @@ -name: test on: [push] env: CXX: clang++ @@ -11,8 +10,7 @@ jobs: uses: actions/checkout@v3 with: submodules: true - - run: ls -aR - - uses: ./.github/actions/action.yml + - uses: ./.github/actions/test asan: runs-on: [ubuntu-latest] needs: test @@ -21,6 +19,6 @@ jobs: uses: actions/checkout@v3 with: submodules: true - - uses: ./.github/actions/action.yml + - uses: ./.github/actions/test with: flags: -DTEST_ASAN=ON From 2d3ae32b1e13e576b2f80181a454a86cfa066d01 Mon Sep 17 00:00:00 2001 From: Jim Eckerlein Date: Tue, 4 Apr 2023 16:19:41 +0200 Subject: [PATCH 061/102] Fix missing shell property --- .github/actions/test/action.yml | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/.github/actions/test/action.yml b/.github/actions/test/action.yml index a672e16..440d976 100644 --- a/.github/actions/test/action.yml +++ b/.github/actions/test/action.yml @@ -1,11 +1,16 @@ inputs: - flags: - description: Configration flags - default: "" + flags: + description: Configration flags + default: "" runs: - using: composite - steps: - - run: mkdir -p build - - run: cmake -S . -B build -DCMAKE_BUILD_TYPE=Debug -DTEST=ON ${{ inputs.flags }} - - run: cmake --build build --target test - - run: ./build/test/test \ No newline at end of file + using: composite + steps: + - name: Configure + shell: bash + run: cmake -S . -B build -DCMAKE_BUILD_TYPE=Debug -DTEST=ON ${{ inputs.flags }} + - name: Build + shell: bash + run: cmake --build build --target test + - name: Execute + shell: bash + run: ./build/test/test \ No newline at end of file From e2e9adb58fa9119245f9a8f3748be463d29b6dd4 Mon Sep 17 00:00:00 2001 From: Jim Eckerlein Date: Tue, 4 Apr 2023 16:25:14 +0200 Subject: [PATCH 062/102] Do not use composite action GitHub merges all substeps into one big step --- .github/actions/test/action.yml | 16 -------- .github/workflows/test.yml | 66 +++++++++++++++++++++++++++++++-- 2 files changed, 63 insertions(+), 19 deletions(-) delete mode 100644 .github/actions/test/action.yml diff --git a/.github/actions/test/action.yml b/.github/actions/test/action.yml deleted file mode 100644 index 440d976..0000000 --- a/.github/actions/test/action.yml +++ /dev/null @@ -1,16 +0,0 @@ -inputs: - flags: - description: Configration flags - default: "" -runs: - using: composite - steps: - - name: Configure - shell: bash - run: cmake -S . -B build -DCMAKE_BUILD_TYPE=Debug -DTEST=ON ${{ inputs.flags }} - - name: Build - shell: bash - run: cmake --build build --target test - - name: Execute - shell: bash - run: ./build/test/test \ No newline at end of file diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index e862c08..937ecd5 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -10,7 +10,15 @@ jobs: uses: actions/checkout@v3 with: submodules: true - - uses: ./.github/actions/test + - name: Configure + shell: bash + run: cmake -S . -B build -DCMAKE_BUILD_TYPE=Debug -DTEST=ON + - name: Build + shell: bash + run: cmake --build build --target test + - name: Execute + shell: bash + run: ./build/test/test asan: runs-on: [ubuntu-latest] needs: test @@ -19,6 +27,58 @@ jobs: uses: actions/checkout@v3 with: submodules: true - - uses: ./.github/actions/test + - name: Checkout + uses: actions/checkout@v3 + with: + submodules: true + - name: Configure + shell: bash + run: cmake -S . -B build -DCMAKE_BUILD_TYPE=Debug -DTEST=ON -DTEST_ASAN=ON + - name: Build + shell: bash + run: cmake --build build --target test + - name: Execute + shell: bash + run: ./build/test/test + msan: + runs-on: [ubuntu-latest] + needs: test + steps: + - name: Checkout + uses: actions/checkout@v3 + with: + submodules: true + - name: Checkout + uses: actions/checkout@v3 with: - flags: -DTEST_ASAN=ON + submodules: true + - name: Configure + shell: bash + run: cmake -S . -B build -DCMAKE_BUILD_TYPE=Debug -DTEST=ON -DTEST_MSAN=ON + - name: Build + shell: bash + run: cmake --build build --target test + - name: Execute + shell: bash + run: ./build/test/test + tsan: + runs-on: [ubuntu-latest] + needs: test + steps: + - name: Checkout + uses: actions/checkout@v3 + with: + submodules: true + - name: Checkout + uses: actions/checkout@v3 + with: + submodules: true + - name: Configure + shell: bash + run: cmake -S . -B build -DCMAKE_BUILD_TYPE=Debug -DTEST=ON -DTEST_TSAN=ON + - name: Build + shell: bash + run: cmake --build build --target test + - name: Execute + shell: bash + run: ./build/test/test \ No newline at end of file From 3cc82cb7490b43a2de66c8a8abc930470a750535 Mon Sep 17 00:00:00 2001 From: Jim Eckerlein Date: Tue, 4 Apr 2023 16:33:42 +0200 Subject: [PATCH 063/102] Descriptions --- .github/workflows/test.yml | 24 ++++++++---------------- 1 file changed, 8 insertions(+), 16 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 937ecd5..c35342a 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -4,6 +4,7 @@ env: CC: clang jobs: test: + name: Unit Tests runs-on: [ubuntu-latest] steps: - name: Checkout @@ -16,17 +17,14 @@ jobs: - name: Build shell: bash run: cmake --build build --target test - - name: Execute + - name: Test shell: bash run: ./build/test/test asan: + name: Address Sanitizer runs-on: [ubuntu-latest] needs: test steps: - - name: Checkout - uses: actions/checkout@v3 - with: - submodules: true - name: Checkout uses: actions/checkout@v3 with: @@ -37,17 +35,14 @@ jobs: - name: Build shell: bash run: cmake --build build --target test - - name: Execute + - name: Test shell: bash run: ./build/test/test msan: + name: Memory Sanitizer runs-on: [ubuntu-latest] needs: test steps: - - name: Checkout - uses: actions/checkout@v3 - with: - submodules: true - name: Checkout uses: actions/checkout@v3 with: @@ -58,17 +53,14 @@ jobs: - name: Build shell: bash run: cmake --build build --target test - - name: Execute + - name: Test shell: bash run: ./build/test/test tsan: + name: Thread Sanitizer runs-on: [ubuntu-latest] needs: test steps: - - name: Checkout - uses: actions/checkout@v3 - with: - submodules: true - name: Checkout uses: actions/checkout@v3 with: @@ -79,6 +71,6 @@ jobs: - name: Build shell: bash run: cmake --build build --target test - - name: Execute + - name: Test shell: bash run: ./build/test/test \ No newline at end of file From cacc75b1591eae5e4fd6fd52f6df75c345f42ad3 Mon Sep 17 00:00:00 2001 From: Jim Eckerlein Date: Tue, 4 Apr 2023 16:37:20 +0200 Subject: [PATCH 064/102] Add ubsan job --- .github/workflows/test.yml | 18 ++++++++++++++++++ CMakeLists.txt | 3 +++ test/CMakeLists.txt | 4 ++++ 3 files changed, 25 insertions(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index c35342a..d351f33 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -71,6 +71,24 @@ jobs: - name: Build shell: bash run: cmake --build build --target test + - name: Test + shell: bash + run: ./build/test/test + ubsan: + name: Undefined Behaviour Sanitizer + runs-on: [ubuntu-latest] + needs: test + steps: + - name: Checkout + uses: actions/checkout@v3 + with: + submodules: true + - name: Configure + shell: bash + run: cmake -S . -B build -DCMAKE_BUILD_TYPE=Debug -DTEST=ON -DTEST_UBSAN=ON + - name: Build + shell: bash + run: cmake --build build --target test - name: Test shell: bash run: ./build/test/test \ No newline at end of file diff --git a/CMakeLists.txt b/CMakeLists.txt index c422e25..368949b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -50,6 +50,9 @@ option(DS_MT4G "Build and install data source mt4g (Compute and memory topology option(DS_NUMA "Build and install data source caps-numa-benchmark" OFF) option(TEST "Build tests" OFF) option(TEST_ASAN "Build tests with enabled address sanitizers" OFF) +option(TEST_MSAN "Build tests with enabled memory sanitizers" OFF) +option(TEST_TSAN "Build tests with enabled thread sanitizers" OFF) +option(TEST_UBSAN "Build tests with enabled undefined behaviour sanitizers" OFF) if(CAT_AWARE) add_definitions(-DCAT_AWARE ) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 215bfe5..b3b2331 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -17,3 +17,7 @@ if(${TEST_TSAN}) target_compile_options(test PRIVATE -fsanitize=thread -O0 -g3) target_link_options(test PRIVATE -fsanitize=thread -O0) endif() +if(${TEST_UBSAN}) + target_compile_options(test PRIVATE -fsanitize=undefined -O0 -g3) + target_link_options(test PRIVATE -fsanitize=undefined -O0) +endif() From a2e62448a59529e1d3b2cd03d4c7c1ed00475811 Mon Sep 17 00:00:00 2001 From: Jim Eckerlein Date: Tue, 4 Apr 2023 18:16:42 +0200 Subject: [PATCH 065/102] Initialize class field --- src/Topology.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Topology.hpp b/src/Topology.hpp index f94a83c..c139e9c 100644 --- a/src/Topology.hpp +++ b/src/Topology.hpp @@ -392,7 +392,7 @@ class Memory : public Component { xmlNodePtr CreateXmlSubtree(); private: long long size; /**< size/capacity of the memory element*/ - bool is_volatile; /**< is volatile? */ + bool is_volatile = false; /**< is volatile? */ }; /** From 6431595cd1829e4d3383241f19ee36e4c0d7d14e Mon Sep 17 00:00:00 2001 From: Jim Eckerlein Date: Tue, 4 Apr 2023 18:47:35 +0200 Subject: [PATCH 066/102] Use GCC sanitizers --- .github/workflows/test.yml | 18 ------------------ CMakeLists.txt | 1 - test/CMakeLists.txt | 4 ---- 3 files changed, 23 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index d351f33..8c812df 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -38,24 +38,6 @@ jobs: - name: Test shell: bash run: ./build/test/test - msan: - name: Memory Sanitizer - runs-on: [ubuntu-latest] - needs: test - steps: - - name: Checkout - uses: actions/checkout@v3 - with: - submodules: true - - name: Configure - shell: bash - run: cmake -S . -B build -DCMAKE_BUILD_TYPE=Debug -DTEST=ON -DTEST_MSAN=ON - - name: Build - shell: bash - run: cmake --build build --target test - - name: Test - shell: bash - run: ./build/test/test tsan: name: Thread Sanitizer runs-on: [ubuntu-latest] diff --git a/CMakeLists.txt b/CMakeLists.txt index 368949b..f3d8d71 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -50,7 +50,6 @@ option(DS_MT4G "Build and install data source mt4g (Compute and memory topology option(DS_NUMA "Build and install data source caps-numa-benchmark" OFF) option(TEST "Build tests" OFF) option(TEST_ASAN "Build tests with enabled address sanitizers" OFF) -option(TEST_MSAN "Build tests with enabled memory sanitizers" OFF) option(TEST_TSAN "Build tests with enabled thread sanitizers" OFF) option(TEST_UBSAN "Build tests with enabled undefined behaviour sanitizers" OFF) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index b3b2331..2a5511f 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -9,10 +9,6 @@ if(${TEST_ASAN}) target_compile_options(test PRIVATE -fsanitize=address -O0 -g3) target_link_options(test PRIVATE -fsanitize=address -O0) endif() -if(${TEST_MSAN}) - target_compile_options(test PRIVATE -fsanitize=memory -O0 -g3) - target_link_options(test PRIVATE -fsanitize=memory -O0) -endif() if(${TEST_TSAN}) target_compile_options(test PRIVATE -fsanitize=thread -O0 -g3) target_link_options(test PRIVATE -fsanitize=thread -O0) From 60dc6831ecb92efa91052557c564610ccacdc571 Mon Sep 17 00:00:00 2001 From: Jim Eckerlein Date: Tue, 4 Apr 2023 18:50:24 +0200 Subject: [PATCH 067/102] Use GCC on runners --- .github/workflows/test.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 8c812df..2499286 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,7 +1,4 @@ on: [push] -env: - CXX: clang++ - CC: clang jobs: test: name: Unit Tests From 6ab1e4a70a3f82c21a33c7f70772ceb03d34b47f Mon Sep 17 00:00:00 2001 From: Jim Eckerlein Date: Wed, 5 Apr 2023 20:34:21 +0200 Subject: [PATCH 068/102] Add coverage flag --- CMakeLists.txt | 1 + test/CMakeLists.txt | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index f3d8d71..6bf2ae0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -52,6 +52,7 @@ option(TEST "Build tests" OFF) option(TEST_ASAN "Build tests with enabled address sanitizers" OFF) option(TEST_TSAN "Build tests with enabled thread sanitizers" OFF) option(TEST_UBSAN "Build tests with enabled undefined behaviour sanitizers" OFF) +option(TEST_COVERAGE "Build tests with enabled coverage" OFF) if(CAT_AWARE) add_definitions(-DCAT_AWARE ) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 2a5511f..6e139b8 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -17,3 +17,9 @@ if(${TEST_UBSAN}) target_compile_options(test PRIVATE -fsanitize=undefined -O0 -g3) target_link_options(test PRIVATE -fsanitize=undefined -O0) endif() + +if(${TEST_COVERAGE}) + target_compile_options(sys-sage PRIVATE --coverage -O0 -g3) + target_link_options(sys-sage PRIVATE --coverage -O0 -g3) + # configure_file(coverage.sh.in ${CMAKE_CURRENT_SOURCE_DIR}/coverage.sh @ONLY) +endif() From 35412263f14a606b80c776021f34d263fe1dfd3f Mon Sep 17 00:00:00 2001 From: Jim Eckerlein Date: Sun, 9 Apr 2023 16:08:05 +0200 Subject: [PATCH 069/102] Remove shell property --- .github/workflows/test.yml | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 2499286..59c7eb9 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -9,13 +9,10 @@ jobs: with: submodules: true - name: Configure - shell: bash run: cmake -S . -B build -DCMAKE_BUILD_TYPE=Debug -DTEST=ON - name: Build - shell: bash run: cmake --build build --target test - name: Test - shell: bash run: ./build/test/test asan: name: Address Sanitizer @@ -27,13 +24,10 @@ jobs: with: submodules: true - name: Configure - shell: bash run: cmake -S . -B build -DCMAKE_BUILD_TYPE=Debug -DTEST=ON -DTEST_ASAN=ON - name: Build - shell: bash run: cmake --build build --target test - name: Test - shell: bash run: ./build/test/test tsan: name: Thread Sanitizer @@ -45,13 +39,10 @@ jobs: with: submodules: true - name: Configure - shell: bash run: cmake -S . -B build -DCMAKE_BUILD_TYPE=Debug -DTEST=ON -DTEST_TSAN=ON - name: Build - shell: bash run: cmake --build build --target test - name: Test - shell: bash run: ./build/test/test ubsan: name: Undefined Behaviour Sanitizer @@ -63,11 +54,8 @@ jobs: with: submodules: true - name: Configure - shell: bash run: cmake -S . -B build -DCMAKE_BUILD_TYPE=Debug -DTEST=ON -DTEST_UBSAN=ON - name: Build - shell: bash run: cmake --build build --target test - name: Test - shell: bash run: ./build/test/test \ No newline at end of file From 00fff75f8561d70b45d797f8e2b5397f71929b5a Mon Sep 17 00:00:00 2001 From: Jim Eckerlein Date: Sun, 9 Apr 2023 16:46:02 +0200 Subject: [PATCH 070/102] Try to use a reusable workflow --- .github/workflows/build.yml | 20 ++++++++++++++++++++ .github/workflows/test.yml | 29 ++++------------------------- 2 files changed, 24 insertions(+), 25 deletions(-) create mode 100644 .github/workflows/build.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..b5ff971 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,20 @@ +on: + workflow_call: + inputs: + flags: + type: string + default: '' +jobs: + build: + runs-on: [ubuntu-latest] + steps: + - name: Checkout + uses: actions/checkout@v3 + with: + submodules: true + - name: Configure + run: cmake -S . -B build -DCMAKE_BUILD_TYPE=Debug -DTEST=ON ${{ inputs.flags }} + - name: Build + run: cmake --build build --target test + - name: Test + run: ./build/test/test \ No newline at end of file diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 59c7eb9..db83629 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -2,33 +2,12 @@ on: [push] jobs: test: name: Unit Tests - runs-on: [ubuntu-latest] - steps: - - name: Checkout - uses: actions/checkout@v3 - with: - submodules: true - - name: Configure - run: cmake -S . -B build -DCMAKE_BUILD_TYPE=Debug -DTEST=ON - - name: Build - run: cmake --build build --target test - - name: Test - run: ./build/test/test + uses: ./.github/workflows/build.yml asan: name: Address Sanitizer - runs-on: [ubuntu-latest] - needs: test - steps: - - name: Checkout - uses: actions/checkout@v3 - with: - submodules: true - - name: Configure - run: cmake -S . -B build -DCMAKE_BUILD_TYPE=Debug -DTEST=ON -DTEST_ASAN=ON - - name: Build - run: cmake --build build --target test - - name: Test - run: ./build/test/test + uses: ./.github/workflows/build.yml + with: + flags: -DTEST_ASAN=ON tsan: name: Thread Sanitizer runs-on: [ubuntu-latest] From e75b9b7f7b2e6d888079a109ae0e2da55ad6526b Mon Sep 17 00:00:00 2001 From: Jim Eckerlein Date: Sun, 9 Apr 2023 16:47:19 +0200 Subject: [PATCH 071/102] Fix job dep --- .github/workflows/test.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index db83629..b1dcef0 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -5,6 +5,7 @@ jobs: uses: ./.github/workflows/build.yml asan: name: Address Sanitizer + needs: test uses: ./.github/workflows/build.yml with: flags: -DTEST_ASAN=ON From 888784a75953086fe53414fda54f81f287d6439a Mon Sep 17 00:00:00 2001 From: Jim Eckerlein Date: Sun, 9 Apr 2023 16:51:42 +0200 Subject: [PATCH 072/102] Clean up CI --- .github/workflows/build.yml | 20 ------------------- .github/workflows/ci.yml | 24 +++++++++++++++++++++++ .github/workflows/test.yml | 38 +++++++++---------------------------- 3 files changed, 33 insertions(+), 49 deletions(-) delete mode 100644 .github/workflows/build.yml create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml deleted file mode 100644 index b5ff971..0000000 --- a/.github/workflows/build.yml +++ /dev/null @@ -1,20 +0,0 @@ -on: - workflow_call: - inputs: - flags: - type: string - default: '' -jobs: - build: - runs-on: [ubuntu-latest] - steps: - - name: Checkout - uses: actions/checkout@v3 - with: - submodules: true - - name: Configure - run: cmake -S . -B build -DCMAKE_BUILD_TYPE=Debug -DTEST=ON ${{ inputs.flags }} - - name: Build - run: cmake --build build --target test - - name: Test - run: ./build/test/test \ No newline at end of file diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..0f8ff45 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,24 @@ +name: CI +on: [push] +jobs: + test: + name: Unit Tests + uses: ./.github/workflows/test.yml + asan: + name: Address Sanitizer + needs: test + uses: ./.github/workflows/test.yml + with: + flags: -DTEST_ASAN=ON + tsan: + name: Thread Sanitizer + needs: test + uses: ./.github/workflows/test.yml + with: + flags: -DTEST_TSAN=ON + ubsan: + name: Thread Sanitizer + needs: test + uses: ./.github/workflows/test.yml + with: + flags: -DTEST_UBSAN=ON diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index b1dcef0..e501f96 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,40 +1,20 @@ -on: [push] +name: Test +on: + workflow_call: + inputs: + flags: + type: string + default: '' jobs: - test: - name: Unit Tests - uses: ./.github/workflows/build.yml - asan: - name: Address Sanitizer - needs: test - uses: ./.github/workflows/build.yml - with: - flags: -DTEST_ASAN=ON - tsan: - name: Thread Sanitizer + build: runs-on: [ubuntu-latest] - needs: test steps: - name: Checkout uses: actions/checkout@v3 with: submodules: true - name: Configure - run: cmake -S . -B build -DCMAKE_BUILD_TYPE=Debug -DTEST=ON -DTEST_TSAN=ON - - name: Build - run: cmake --build build --target test - - name: Test - run: ./build/test/test - ubsan: - name: Undefined Behaviour Sanitizer - runs-on: [ubuntu-latest] - needs: test - steps: - - name: Checkout - uses: actions/checkout@v3 - with: - submodules: true - - name: Configure - run: cmake -S . -B build -DCMAKE_BUILD_TYPE=Debug -DTEST=ON -DTEST_UBSAN=ON + run: cmake -S . -B build -DCMAKE_BUILD_TYPE=Debug -DTEST=ON ${{ inputs.flags }} - name: Build run: cmake --build build --target test - name: Test From 625e8e219ba0ec23240ddfe68d3a99906cf0cf90 Mon Sep 17 00:00:00 2001 From: Jim Eckerlein Date: Sun, 9 Apr 2023 16:56:05 +0200 Subject: [PATCH 073/102] Clean up CI --- .github/workflows/ci.yml | 1 - .github/workflows/test.yml | 4 ++-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0f8ff45..1eb74b6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,4 +1,3 @@ -name: CI on: [push] jobs: test: diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index e501f96..71e6714 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,4 +1,3 @@ -name: Test on: workflow_call: inputs: @@ -6,7 +5,8 @@ on: type: string default: '' jobs: - build: + test: + name: Test runs-on: [ubuntu-latest] steps: - name: Checkout From 877e4278508b4b2669cf576316ccf37fa3985b4e Mon Sep 17 00:00:00 2001 From: Jim Eckerlein Date: Sun, 9 Apr 2023 17:01:41 +0200 Subject: [PATCH 074/102] Fix label --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1eb74b6..4db97da 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -16,7 +16,7 @@ jobs: with: flags: -DTEST_TSAN=ON ubsan: - name: Thread Sanitizer + name: Undefined Behaviour Sanitizer needs: test uses: ./.github/workflows/test.yml with: From 59092d9598490164ca7b377fcb49e13d5b51c685 Mon Sep 17 00:00:00 2001 From: Jim Eckerlein Date: Sun, 9 Apr 2023 20:24:37 +0200 Subject: [PATCH 075/102] Documentation coverage --- docs/.gitignore | 1 + docs/Doxyfile | 2 +- docs/doc-coverage.info | 2571 +++++++++++++++++++++++++++++++++++++ docs/show_undocumented.py | 26 + src/xml_dump.hpp | 6 +- 5 files changed, 2602 insertions(+), 4 deletions(-) create mode 100644 docs/doc-coverage.info create mode 100755 docs/show_undocumented.py diff --git a/docs/.gitignore b/docs/.gitignore index 067823c..d284e0e 100644 --- a/docs/.gitignore +++ b/docs/.gitignore @@ -1,2 +1,3 @@ html/* latex/* +xml/* diff --git a/docs/Doxyfile b/docs/Doxyfile index 3f59be5..129b59e 100644 --- a/docs/Doxyfile +++ b/docs/Doxyfile @@ -2134,7 +2134,7 @@ MAN_LINKS = NO # captures the structure of the code including all documentation. # The default value is: NO. -GENERATE_XML = NO +GENERATE_XML = YES # The XML_OUTPUT tag is used to specify where the XML pages will be put. If a # relative path is entered the value of OUTPUT_DIRECTORY will be put in front of diff --git a/docs/doc-coverage.info b/docs/doc-coverage.info new file mode 100644 index 0000000..fc2f6f5 --- /dev/null +++ b/docs/doc-coverage.info @@ -0,0 +1,2571 @@ +{ + "total": { + "documented_symbol_count": 119, + "symbol_count": 352, + "coverage_rate": 0.3380681818181818 + }, + "kinds": { + "variable": { + "documented_symbol_count": 24, + "symbol_count": 56, + "coverage_rate": 0.42857142857142855 + }, + "function": { + "documented_symbol_count": 78, + "symbol_count": 209, + "coverage_rate": 0.37320574162679426 + }, + "class": { + "documented_symbol_count": 12, + "symbol_count": 15, + "coverage_rate": 0.8 + }, + "struct": { + "documented_symbol_count": 0, + "symbol_count": 1, + "coverage_rate": 0.0 + }, + "namespace": { + "documented_symbol_count": 0, + "symbol_count": 2, + "coverage_rate": 0.0 + }, + "file": { + "documented_symbol_count": 0, + "symbol_count": 28, + "coverage_rate": 0.0 + }, + "define": { + "documented_symbol_count": 1, + "symbol_count": 37, + "coverage_rate": 0.02702702702702703 + }, + "page": { + "documented_symbol_count": 4, + "symbol_count": 4, + "coverage_rate": 1.0 + } + }, + "files": { + "/Users/jim/tum/sys-sage/src/Topology.hpp": [ + { + "symbol": "string Cache::cache_type", + "documented": true, + "kind": "variable", + "line": 529, + "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" + }, + { + "symbol": "long long Cache::cache_size", + "documented": true, + "kind": "variable", + "line": 530, + "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" + }, + { + "symbol": "int Cache::cache_associativity_ways", + "documented": true, + "kind": "variable", + "line": 531, + "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" + }, + { + "symbol": "int Cache::cache_line_size", + "documented": true, + "kind": "variable", + "line": 532, + "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" + }, + { + "symbol": "Cache::Cache", + "documented": true, + "kind": "function", + "line": 484, + "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" + }, + { + "symbol": "Cache::Cache", + "documented": true, + "kind": "function", + "line": 493, + "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" + }, + { + "symbol": "Cache::Cache", + "documented": false, + "kind": "function", + "line": 494, + "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" + }, + { + "symbol": "Cache::Cache", + "documented": false, + "kind": "function", + "line": 495, + "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" + }, + { + "symbol": "Cache::Cache", + "documented": false, + "kind": "function", + "line": 496, + "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" + }, + { + "symbol": "Cache::Cache", + "documented": false, + "kind": "function", + "line": 497, + "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" + }, + { + "symbol": "Cache::Cache", + "documented": false, + "kind": "function", + "line": 498, + "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" + }, + { + "symbol": "Cache::Cache", + "documented": false, + "kind": "function", + "line": 499, + "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" + }, + { + "symbol": "Cache::Cache", + "documented": false, + "kind": "function", + "line": 500, + "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" + }, + { + "symbol": "Cache::~Cache", + "documented": false, + "kind": "function", + "line": 502, + "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" + }, + { + "symbol": "int Cache::GetCacheLevel", + "documented": true, + "kind": "function", + "line": 507, + "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" + }, + { + "symbol": "string Cache::GetCacheName", + "documented": false, + "kind": "function", + "line": 508, + "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" + }, + { + "symbol": "long long Cache::GetCacheSize", + "documented": true, + "kind": "function", + "line": 512, + "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" + }, + { + "symbol": "void Cache::SetCacheSize", + "documented": false, + "kind": "function", + "line": 513, + "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" + }, + { + "symbol": "int Cache::GetCacheAssociativityWays", + "documented": true, + "kind": "function", + "line": 517, + "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" + }, + { + "symbol": "int Cache::GetCacheLineSize", + "documented": true, + "kind": "function", + "line": 521, + "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" + }, + { + "symbol": "void Cache::SetCacheLineSize", + "documented": false, + "kind": "function", + "line": 522, + "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" + }, + { + "symbol": "xmlNodePtr Cache::CreateXmlSubtree", + "documented": true, + "kind": "function", + "line": 527, + "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" + }, + { + "symbol": "Cache", + "documented": true, + "kind": "class", + "line": 476, + "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" + }, + { + "symbol": "string Chip::vendor", + "documented": false, + "kind": "variable", + "line": 467, + "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" + }, + { + "symbol": "string Chip::model", + "documented": false, + "kind": "variable", + "line": 468, + "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" + }, + { + "symbol": "int Chip::type", + "documented": false, + "kind": "variable", + "line": 469, + "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" + }, + { + "symbol": "Chip::Chip", + "documented": true, + "kind": "function", + "line": 438, + "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" + }, + { + "symbol": "Chip::Chip", + "documented": true, + "kind": "function", + "line": 445, + "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" + }, + { + "symbol": "Chip::Chip", + "documented": false, + "kind": "function", + "line": 446, + "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" + }, + { + "symbol": "Chip::Chip", + "documented": false, + "kind": "function", + "line": 447, + "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" + }, + { + "symbol": "Chip::Chip", + "documented": false, + "kind": "function", + "line": 448, + "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" + }, + { + "symbol": "Chip::Chip", + "documented": false, + "kind": "function", + "line": 449, + "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" + }, + { + "symbol": "Chip::Chip", + "documented": false, + "kind": "function", + "line": 450, + "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" + }, + { + "symbol": "Chip::Chip", + "documented": false, + "kind": "function", + "line": 451, + "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" + }, + { + "symbol": "Chip::~Chip", + "documented": false, + "kind": "function", + "line": 453, + "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" + }, + { + "symbol": "void Chip::SetVendor", + "documented": false, + "kind": "function", + "line": 455, + "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" + }, + { + "symbol": "string Chip::GetVendor", + "documented": false, + "kind": "function", + "line": 456, + "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" + }, + { + "symbol": "void Chip::SetModel", + "documented": false, + "kind": "function", + "line": 457, + "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" + }, + { + "symbol": "string Chip::GetModel", + "documented": false, + "kind": "function", + "line": 458, + "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" + }, + { + "symbol": "void Chip::SetChipType", + "documented": false, + "kind": "function", + "line": 459, + "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" + }, + { + "symbol": "int Chip::GetChipType", + "documented": false, + "kind": "function", + "line": 460, + "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" + }, + { + "symbol": "xmlNodePtr Chip::CreateXmlSubtree", + "documented": true, + "kind": "function", + "line": 465, + "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" + }, + { + "symbol": "Chip", + "documented": true, + "kind": "class", + "line": 430, + "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" + }, + { + "symbol": "map Component::attrib", + "documented": true, + "kind": "variable", + "line": 277, + "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" + }, + { + "symbol": "int Component::id", + "documented": true, + "kind": "variable", + "line": 280, + "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" + }, + { + "symbol": "int Component::depth", + "documented": true, + "kind": "variable", + "line": 281, + "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" + }, + { + "symbol": "string Component::name", + "documented": true, + "kind": "variable", + "line": 282, + "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" + }, + { + "symbol": "int Component::count", + "documented": true, + "kind": "variable", + "line": 283, + "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" + }, + { + "symbol": "const int Component::componentType", + "documented": true, + "kind": "variable", + "line": 299, + "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" + }, + { + "symbol": "vector Component::children", + "documented": true, + "kind": "variable", + "line": 300, + "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" + }, + { + "symbol": "Component* Component::parent", + "documented": true, + "kind": "variable", + "line": 301, + "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" + }, + { + "symbol": "vector Component::dp_incoming", + "documented": true, + "kind": "variable", + "line": 302, + "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" + }, + { + "symbol": "vector Component::dp_outgoing", + "documented": true, + "kind": "variable", + "line": 303, + "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" + }, + { + "symbol": "Component::Component", + "documented": true, + "kind": "function", + "line": 50, + "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" + }, + { + "symbol": "Component::Component", + "documented": false, + "kind": "function", + "line": 51, + "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" + }, + { + "symbol": "Component::Component", + "documented": true, + "kind": "function", + "line": 58, + "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" + }, + { + "symbol": "Component::Component", + "documented": false, + "kind": "function", + "line": 59, + "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" + }, + { + "symbol": "virtual Component::~Component", + "documented": false, + "kind": "function", + "line": 61, + "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" + }, + { + "symbol": "void Component::InsertChild", + "documented": true, + "kind": "function", + "line": 70, + "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" + }, + { + "symbol": "int Component::RemoveChild", + "documented": true, + "kind": "function", + "line": 75, + "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" + }, + { + "symbol": "void Component::SetParent", + "documented": true, + "kind": "function", + "line": 81, + "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" + }, + { + "symbol": "void Component::PrintSubtree", + "documented": true, + "kind": "function", + "line": 86, + "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" + }, + { + "symbol": "void Component::PrintSubtree", + "documented": true, + "kind": "function", + "line": 92, + "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" + }, + { + "symbol": "void Component::PrintAllDataPathsInSubtree", + "documented": true, + "kind": "function", + "line": 97, + "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" + }, + { + "symbol": "string Component::GetName", + "documented": true, + "kind": "function", + "line": 104, + "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" + }, + { + "symbol": "int Component::GetId", + "documented": true, + "kind": "function", + "line": 110, + "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" + }, + { + "symbol": "int Component::GetComponentType", + "documented": true, + "kind": "function", + "line": 127, + "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" + }, + { + "symbol": "string Component::GetComponentTypeStr", + "documented": true, + "kind": "function", + "line": 144, + "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" + }, + { + "symbol": "vector< Component * > * Component::GetChildren", + "documented": true, + "kind": "function", + "line": 149, + "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" + }, + { + "symbol": "Component * Component::GetParent", + "documented": true, + "kind": "function", + "line": 153, + "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" + }, + { + "symbol": "Component * Component::GetChild", + "documented": true, + "kind": "function", + "line": 158, + "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" + }, + { + "symbol": "Component * Component::GetChildByType", + "documented": false, + "kind": "function", + "line": 159, + "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" + }, + { + "symbol": "vector< Component * > Component::GetAllChildrenByType", + "documented": false, + "kind": "function", + "line": 160, + "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" + }, + { + "symbol": "Component * Component::FindSubcomponentById", + "documented": true, + "kind": "function", + "line": 169, + "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" + }, + { + "symbol": "void Component::FindAllSubcomponentsByType", + "documented": false, + "kind": "function", + "line": 170, + "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" + }, + { + "symbol": "Component * Component::FindParentByType", + "documented": true, + "kind": "function", + "line": 176, + "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" + }, + { + "symbol": "int Component::GetNumThreads", + "documented": true, + "kind": "function", + "line": 180, + "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" + }, + { + "symbol": "int Component::GetTopoTreeDepth", + "documented": true, + "kind": "function", + "line": 186, + "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" + }, + { + "symbol": "void Component::GetComponentsNLevelsDeeper", + "documented": true, + "kind": "function", + "line": 195, + "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" + }, + { + "symbol": "void Component::GetSubcomponentsByType", + "documented": true, + "kind": "function", + "line": 205, + "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" + }, + { + "symbol": "void Component::GetSubtreeNodeList", + "documented": true, + "kind": "function", + "line": 213, + "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" + }, + { + "symbol": "vector< DataPath * > * Component::GetDataPaths", + "documented": true, + "kind": "function", + "line": 222, + "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" + }, + { + "symbol": "void Component::AddDataPath", + "documented": true, + "kind": "function", + "line": 230, + "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" + }, + { + "symbol": "DataPath * Component::GetDpByType", + "documented": true, + "kind": "function", + "line": 238, + "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" + }, + { + "symbol": "void Component::GetAllDpByType", + "documented": true, + "kind": "function", + "line": 248, + "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" + }, + { + "symbol": "int Component::CheckComponentTreeConsistency", + "documented": false, + "kind": "function", + "line": 249, + "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" + }, + { + "symbol": "int Component::GetTopologySize", + "documented": true, + "kind": "function", + "line": 256, + "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" + }, + { + "symbol": "int Component::GetTopologySize", + "documented": true, + "kind": "function", + "line": 266, + "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" + }, + { + "symbol": "xmlNodePtr Component::CreateXmlSubtree", + "documented": true, + "kind": "function", + "line": 272, + "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" + }, + { + "symbol": "Component", + "documented": true, + "kind": "class", + "line": 41, + "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" + }, + { + "symbol": "Core::Core", + "documented": true, + "kind": "function", + "line": 644, + "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" + }, + { + "symbol": "Core::Core", + "documented": true, + "kind": "function", + "line": 651, + "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" + }, + { + "symbol": "Core::Core", + "documented": false, + "kind": "function", + "line": 652, + "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" + }, + { + "symbol": "Core::Core", + "documented": false, + "kind": "function", + "line": 653, + "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" + }, + { + "symbol": "Core::Core", + "documented": false, + "kind": "function", + "line": 654, + "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" + }, + { + "symbol": "Core::Core", + "documented": false, + "kind": "function", + "line": 655, + "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" + }, + { + "symbol": "Core::~Core", + "documented": false, + "kind": "function", + "line": 657, + "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" + }, + { + "symbol": "Core", + "documented": true, + "kind": "class", + "line": 636, + "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" + }, + { + "symbol": "long long Memory::size", + "documented": true, + "kind": "variable", + "line": 394, + "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" + }, + { + "symbol": "bool Memory::is_volatile", + "documented": true, + "kind": "variable", + "line": 395, + "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" + }, + { + "symbol": "Memory::Memory", + "documented": true, + "kind": "function", + "line": 379, + "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" + }, + { + "symbol": "Memory::Memory", + "documented": false, + "kind": "function", + "line": 380, + "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" + }, + { + "symbol": "Memory::Memory", + "documented": false, + "kind": "function", + "line": 381, + "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" + }, + { + "symbol": "Memory::Memory", + "documented": false, + "kind": "function", + "line": 382, + "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" + }, + { + "symbol": "Memory::~Memory", + "documented": false, + "kind": "function", + "line": 384, + "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" + }, + { + "symbol": "long long Memory::GetSize", + "documented": false, + "kind": "function", + "line": 386, + "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" + }, + { + "symbol": "void Memory::SetSize", + "documented": false, + "kind": "function", + "line": 387, + "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" + }, + { + "symbol": "xmlNodePtr Memory::CreateXmlSubtree", + "documented": true, + "kind": "function", + "line": 392, + "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" + }, + { + "symbol": "Memory", + "documented": true, + "kind": "class", + "line": 371, + "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" + }, + { + "symbol": "Node::Node", + "documented": true, + "kind": "function", + "line": 338, + "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" + }, + { + "symbol": "Node::Node", + "documented": false, + "kind": "function", + "line": 339, + "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" + }, + { + "symbol": "Node::Node", + "documented": true, + "kind": "function", + "line": 346, + "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" + }, + { + "symbol": "Node::Node", + "documented": false, + "kind": "function", + "line": 347, + "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" + }, + { + "symbol": "Node::~Node", + "documented": false, + "kind": "function", + "line": 349, + "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" + }, + { + "symbol": "Node", + "documented": true, + "kind": "class", + "line": 330, + "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" + }, + { + "symbol": "long long Numa::size", + "documented": true, + "kind": "variable", + "line": 629, + "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" + }, + { + "symbol": "Numa::Numa", + "documented": true, + "kind": "function", + "line": 595, + "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" + }, + { + "symbol": "Numa::Numa", + "documented": true, + "kind": "function", + "line": 602, + "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" + }, + { + "symbol": "Numa::Numa", + "documented": true, + "kind": "function", + "line": 610, + "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" + }, + { + "symbol": "Numa::Numa", + "documented": false, + "kind": "function", + "line": 611, + "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" + }, + { + "symbol": "Numa::Numa", + "documented": false, + "kind": "function", + "line": 612, + "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" + }, + { + "symbol": "Numa::Numa", + "documented": false, + "kind": "function", + "line": 613, + "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" + }, + { + "symbol": "Numa::~Numa", + "documented": false, + "kind": "function", + "line": 615, + "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" + }, + { + "symbol": "long long Numa::GetSize", + "documented": true, + "kind": "function", + "line": 621, + "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" + }, + { + "symbol": "xmlNodePtr Numa::CreateXmlSubtree", + "documented": true, + "kind": "function", + "line": 627, + "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" + }, + { + "symbol": "Numa", + "documented": true, + "kind": "class", + "line": 587, + "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" + }, + { + "symbol": "long long Storage::size", + "documented": true, + "kind": "variable", + "line": 423, + "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" + }, + { + "symbol": "Storage::Storage", + "documented": true, + "kind": "function", + "line": 410, + "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" + }, + { + "symbol": "Storage::Storage", + "documented": false, + "kind": "function", + "line": 411, + "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" + }, + { + "symbol": "Storage::~Storage", + "documented": false, + "kind": "function", + "line": 413, + "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" + }, + { + "symbol": "long long Storage::GetSize", + "documented": false, + "kind": "function", + "line": 415, + "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" + }, + { + "symbol": "void Storage::SetSize", + "documented": false, + "kind": "function", + "line": 416, + "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" + }, + { + "symbol": "xmlNodePtr Storage::CreateXmlSubtree", + "documented": true, + "kind": "function", + "line": 421, + "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" + }, + { + "symbol": "Storage", + "documented": true, + "kind": "class", + "line": 402, + "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" + }, + { + "symbol": "int Subdivision::type", + "documented": true, + "kind": "variable", + "line": 580, + "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" + }, + { + "symbol": "Subdivision::Subdivision", + "documented": true, + "kind": "function", + "line": 547, + "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" + }, + { + "symbol": "Subdivision::Subdivision", + "documented": true, + "kind": "function", + "line": 554, + "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" + }, + { + "symbol": "Subdivision::Subdivision", + "documented": false, + "kind": "function", + "line": 555, + "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" + }, + { + "symbol": "Subdivision::Subdivision", + "documented": false, + "kind": "function", + "line": 556, + "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" + }, + { + "symbol": "Subdivision::Subdivision", + "documented": true, + "kind": "function", + "line": 563, + "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" + }, + { + "symbol": "Subdivision::Subdivision", + "documented": false, + "kind": "function", + "line": 564, + "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" + }, + { + "symbol": "Subdivision::Subdivision", + "documented": false, + "kind": "function", + "line": 565, + "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" + }, + { + "symbol": "Subdivision::Subdivision", + "documented": false, + "kind": "function", + "line": 566, + "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" + }, + { + "symbol": "Subdivision::Subdivision", + "documented": false, + "kind": "function", + "line": 567, + "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" + }, + { + "symbol": "Subdivision::Subdivision", + "documented": false, + "kind": "function", + "line": 568, + "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" + }, + { + "symbol": "Subdivision::~Subdivision", + "documented": false, + "kind": "function", + "line": 570, + "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" + }, + { + "symbol": "void Subdivision::SetSubdivisionType", + "documented": false, + "kind": "function", + "line": 572, + "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" + }, + { + "symbol": "int Subdivision::GetSubdivisionType", + "documented": false, + "kind": "function", + "line": 573, + "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" + }, + { + "symbol": "xmlNodePtr Subdivision::CreateXmlSubtree", + "documented": true, + "kind": "function", + "line": 578, + "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" + }, + { + "symbol": "Subdivision", + "documented": true, + "kind": "class", + "line": 539, + "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" + }, + { + "symbol": "Thread::Thread", + "documented": true, + "kind": "function", + "line": 683, + "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" + }, + { + "symbol": "Thread::Thread", + "documented": true, + "kind": "function", + "line": 690, + "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" + }, + { + "symbol": "Thread::Thread", + "documented": false, + "kind": "function", + "line": 691, + "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" + }, + { + "symbol": "Thread::Thread", + "documented": false, + "kind": "function", + "line": 692, + "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" + }, + { + "symbol": "Thread::Thread", + "documented": false, + "kind": "function", + "line": 693, + "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" + }, + { + "symbol": "Thread::Thread", + "documented": false, + "kind": "function", + "line": 694, + "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" + }, + { + "symbol": "Thread::~Thread", + "documented": false, + "kind": "function", + "line": 696, + "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" + }, + { + "symbol": "Thread", + "documented": true, + "kind": "class", + "line": 675, + "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" + }, + { + "symbol": "Topology::Topology", + "documented": true, + "kind": "function", + "line": 320, + "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" + }, + { + "symbol": "Topology::~Topology", + "documented": false, + "kind": "function", + "line": 322, + "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" + }, + { + "symbol": "Topology", + "documented": true, + "kind": "class", + "line": 312, + "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" + }, + { + "symbol": "SYS_SAGE_COMPONENT_NONE", + "documented": false, + "kind": "define", + "line": 13, + "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" + }, + { + "symbol": "SYS_SAGE_COMPONENT_THREAD", + "documented": false, + "kind": "define", + "line": 14, + "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" + }, + { + "symbol": "SYS_SAGE_COMPONENT_CORE", + "documented": false, + "kind": "define", + "line": 15, + "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" + }, + { + "symbol": "SYS_SAGE_COMPONENT_CACHE", + "documented": false, + "kind": "define", + "line": 16, + "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" + }, + { + "symbol": "SYS_SAGE_COMPONENT_SUBDIVISION", + "documented": false, + "kind": "define", + "line": 17, + "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" + }, + { + "symbol": "SYS_SAGE_COMPONENT_NUMA", + "documented": false, + "kind": "define", + "line": 18, + "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" + }, + { + "symbol": "SYS_SAGE_COMPONENT_CHIP", + "documented": false, + "kind": "define", + "line": 19, + "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" + }, + { + "symbol": "SYS_SAGE_COMPONENT_MEMORY", + "documented": false, + "kind": "define", + "line": 20, + "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" + }, + { + "symbol": "SYS_SAGE_COMPONENT_STORAGE", + "documented": false, + "kind": "define", + "line": 21, + "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" + }, + { + "symbol": "SYS_SAGE_COMPONENT_NODE", + "documented": false, + "kind": "define", + "line": 22, + "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" + }, + { + "symbol": "SYS_SAGE_COMPONENT_TOPOLOGY", + "documented": false, + "kind": "define", + "line": 23, + "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" + }, + { + "symbol": "SYS_SAGE_SUBDIVISION_TYPE_NONE", + "documented": false, + "kind": "define", + "line": 25, + "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" + }, + { + "symbol": "SYS_SAGE_SUBDIVISION_TYPE_GPU_SM", + "documented": false, + "kind": "define", + "line": 26, + "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" + }, + { + "symbol": "SYS_SAGE_CHIP_TYPE_NONE", + "documented": false, + "kind": "define", + "line": 28, + "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" + }, + { + "symbol": "SYS_SAGE_CHIP_TYPE_CPU", + "documented": false, + "kind": "define", + "line": 29, + "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" + }, + { + "symbol": "SYS_SAGE_CHIP_TYPE_CPU_SOCKET", + "documented": false, + "kind": "define", + "line": 30, + "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" + }, + { + "symbol": "SYS_SAGE_CHIP_TYPE_GPU", + "documented": false, + "kind": "define", + "line": 31, + "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" + }, + { + "symbol": "Topology.hpp", + "documented": false, + "kind": "file", + "line": 1, + "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" + } + ], + "/Users/jim/tum/sys-sage/src/parsers/caps-numa-benchmark.hpp": [ + { + "symbol": "std::string CSVReader::benchmarkPath", + "documented": false, + "kind": "variable", + "line": 11, + "file": "/Users/jim/tum/sys-sage/src/parsers/caps-numa-benchmark.hpp" + }, + { + "symbol": "std::string CSVReader::delimiter", + "documented": false, + "kind": "variable", + "line": 12, + "file": "/Users/jim/tum/sys-sage/src/parsers/caps-numa-benchmark.hpp" + }, + { + "symbol": "CSVReader::CSVReader", + "documented": false, + "kind": "function", + "line": 14, + "file": "/Users/jim/tum/sys-sage/src/parsers/caps-numa-benchmark.hpp" + }, + { + "symbol": "int CSVReader::getData", + "documented": false, + "kind": "function", + "line": 16, + "file": "/Users/jim/tum/sys-sage/src/parsers/caps-numa-benchmark.hpp" + }, + { + "symbol": "CSVReader", + "documented": false, + "kind": "class", + "line": 9, + "file": "/Users/jim/tum/sys-sage/src/parsers/caps-numa-benchmark.hpp" + }, + { + "symbol": "int parseCapsNumaBenchmark", + "documented": false, + "kind": "function", + "line": 7, + "file": "/Users/jim/tum/sys-sage/src/parsers/caps-numa-benchmark.hpp" + }, + { + "symbol": "caps-numa-benchmark.hpp", + "documented": false, + "kind": "file", + "line": 1, + "file": "/Users/jim/tum/sys-sage/src/parsers/caps-numa-benchmark.hpp" + } + ], + "/Users/jim/tum/sys-sage/src/DataPath.hpp": [ + { + "symbol": "map DataPath::attrib", + "documented": false, + "kind": "variable", + "line": 108, + "file": "/Users/jim/tum/sys-sage/src/DataPath.hpp" + }, + { + "symbol": "Component* DataPath::source", + "documented": false, + "kind": "variable", + "line": 110, + "file": "/Users/jim/tum/sys-sage/src/DataPath.hpp" + }, + { + "symbol": "Component* DataPath::target", + "documented": false, + "kind": "variable", + "line": 111, + "file": "/Users/jim/tum/sys-sage/src/DataPath.hpp" + }, + { + "symbol": "const int DataPath::oriented", + "documented": false, + "kind": "variable", + "line": 113, + "file": "/Users/jim/tum/sys-sage/src/DataPath.hpp" + }, + { + "symbol": "const int DataPath::dp_type", + "documented": true, + "kind": "variable", + "line": 114, + "file": "/Users/jim/tum/sys-sage/src/DataPath.hpp" + }, + { + "symbol": "double DataPath::bw", + "documented": false, + "kind": "variable", + "line": 116, + "file": "/Users/jim/tum/sys-sage/src/DataPath.hpp" + }, + { + "symbol": "double DataPath::latency", + "documented": false, + "kind": "variable", + "line": 117, + "file": "/Users/jim/tum/sys-sage/src/DataPath.hpp" + }, + { + "symbol": "DataPath::DataPath", + "documented": true, + "kind": "function", + "line": 58, + "file": "/Users/jim/tum/sys-sage/src/DataPath.hpp" + }, + { + "symbol": "DataPath::DataPath", + "documented": true, + "kind": "function", + "line": 67, + "file": "/Users/jim/tum/sys-sage/src/DataPath.hpp" + }, + { + "symbol": "DataPath::DataPath", + "documented": true, + "kind": "function", + "line": 78, + "file": "/Users/jim/tum/sys-sage/src/DataPath.hpp" + }, + { + "symbol": "Component * DataPath::GetSource", + "documented": true, + "kind": "function", + "line": 83, + "file": "/Users/jim/tum/sys-sage/src/DataPath.hpp" + }, + { + "symbol": "Component * DataPath::GetTarget", + "documented": true, + "kind": "function", + "line": 87, + "file": "/Users/jim/tum/sys-sage/src/DataPath.hpp" + }, + { + "symbol": "double DataPath::GetBw", + "documented": true, + "kind": "function", + "line": 91, + "file": "/Users/jim/tum/sys-sage/src/DataPath.hpp" + }, + { + "symbol": "double DataPath::GetLatency", + "documented": true, + "kind": "function", + "line": 95, + "file": "/Users/jim/tum/sys-sage/src/DataPath.hpp" + }, + { + "symbol": "int DataPath::GetDpType", + "documented": true, + "kind": "function", + "line": 100, + "file": "/Users/jim/tum/sys-sage/src/DataPath.hpp" + }, + { + "symbol": "int DataPath::GetOriented", + "documented": false, + "kind": "function", + "line": 101, + "file": "/Users/jim/tum/sys-sage/src/DataPath.hpp" + }, + { + "symbol": "void DataPath::Print", + "documented": true, + "kind": "function", + "line": 106, + "file": "/Users/jim/tum/sys-sage/src/DataPath.hpp" + }, + { + "symbol": "DataPath", + "documented": true, + "kind": "class", + "line": 47, + "file": "/Users/jim/tum/sys-sage/src/DataPath.hpp" + }, + { + "symbol": "std", + "documented": false, + "kind": "namespace", + "line": 22, + "file": "/Users/jim/tum/sys-sage/src/DataPath.hpp" + }, + { + "symbol": "SYS_SAGE_DATAPATH_NONE", + "documented": false, + "kind": "define", + "line": 8, + "file": "/Users/jim/tum/sys-sage/src/DataPath.hpp" + }, + { + "symbol": "SYS_SAGE_DATAPATH_OUTGOING", + "documented": false, + "kind": "define", + "line": 9, + "file": "/Users/jim/tum/sys-sage/src/DataPath.hpp" + }, + { + "symbol": "SYS_SAGE_DATAPATH_INCOMING", + "documented": false, + "kind": "define", + "line": 10, + "file": "/Users/jim/tum/sys-sage/src/DataPath.hpp" + }, + { + "symbol": "SYS_SAGE_DATAPATH_BIDIRECTIONAL", + "documented": false, + "kind": "define", + "line": 13, + "file": "/Users/jim/tum/sys-sage/src/DataPath.hpp" + }, + { + "symbol": "SYS_SAGE_DATAPATH_ORIENTED", + "documented": false, + "kind": "define", + "line": 14, + "file": "/Users/jim/tum/sys-sage/src/DataPath.hpp" + }, + { + "symbol": "SYS_SAGE_DATAPATH_TYPE_NONE", + "documented": false, + "kind": "define", + "line": 17, + "file": "/Users/jim/tum/sys-sage/src/DataPath.hpp" + }, + { + "symbol": "SYS_SAGE_DATAPATH_TYPE_LOGICAL", + "documented": false, + "kind": "define", + "line": 18, + "file": "/Users/jim/tum/sys-sage/src/DataPath.hpp" + }, + { + "symbol": "SYS_SAGE_DATAPATH_TYPE_PHYSICAL", + "documented": false, + "kind": "define", + "line": 19, + "file": "/Users/jim/tum/sys-sage/src/DataPath.hpp" + }, + { + "symbol": "SYS_SAGE_DATAPATH_TYPE_L3CAT", + "documented": false, + "kind": "define", + "line": 20, + "file": "/Users/jim/tum/sys-sage/src/DataPath.hpp" + }, + { + "symbol": "DataPath * NewDataPath", + "documented": true, + "kind": "function", + "line": 30, + "file": "/Users/jim/tum/sys-sage/src/DataPath.hpp" + }, + { + "symbol": "DataPath * NewDataPath", + "documented": true, + "kind": "function", + "line": 35, + "file": "/Users/jim/tum/sys-sage/src/DataPath.hpp" + }, + { + "symbol": "DataPath * NewDataPath", + "documented": true, + "kind": "function", + "line": 40, + "file": "/Users/jim/tum/sys-sage/src/DataPath.hpp" + }, + { + "symbol": "DataPath.hpp", + "documented": false, + "kind": "file", + "line": 1, + "file": "/Users/jim/tum/sys-sage/src/DataPath.hpp" + } + ], + "/Users/jim/tum/sys-sage/src/parsers/gpu-topo.hpp": [ + { + "symbol": "map > GpuTopo::benchmarkData", + "documented": false, + "kind": "variable", + "line": 18, + "file": "/Users/jim/tum/sys-sage/src/parsers/gpu-topo.hpp" + }, + { + "symbol": "string GpuTopo::dataSourcePath", + "documented": false, + "kind": "variable", + "line": 19, + "file": "/Users/jim/tum/sys-sage/src/parsers/gpu-topo.hpp" + }, + { + "symbol": "string GpuTopo::delim", + "documented": false, + "kind": "variable", + "line": 20, + "file": "/Users/jim/tum/sys-sage/src/parsers/gpu-topo.hpp" + }, + { + "symbol": "Chip* GpuTopo::root", + "documented": false, + "kind": "variable", + "line": 21, + "file": "/Users/jim/tum/sys-sage/src/parsers/gpu-topo.hpp" + }, + { + "symbol": "bool GpuTopo::L2_shared_on_gpu", + "documented": false, + "kind": "variable", + "line": 22, + "file": "/Users/jim/tum/sys-sage/src/parsers/gpu-topo.hpp" + }, + { + "symbol": "double GpuTopo::Memory_Clock_Frequency", + "documented": false, + "kind": "variable", + "line": 23, + "file": "/Users/jim/tum/sys-sage/src/parsers/gpu-topo.hpp" + }, + { + "symbol": "int GpuTopo::Memory_Bus_Width", + "documented": false, + "kind": "variable", + "line": 24, + "file": "/Users/jim/tum/sys-sage/src/parsers/gpu-topo.hpp" + }, + { + "symbol": "GpuTopo::GpuTopo", + "documented": false, + "kind": "function", + "line": 13, + "file": "/Users/jim/tum/sys-sage/src/parsers/gpu-topo.hpp" + }, + { + "symbol": "int GpuTopo::ParseBenchmarkData", + "documented": false, + "kind": "function", + "line": 15, + "file": "/Users/jim/tum/sys-sage/src/parsers/gpu-topo.hpp" + }, + { + "symbol": "int GpuTopo::ReadBenchmarkFile", + "documented": false, + "kind": "function", + "line": 17, + "file": "/Users/jim/tum/sys-sage/src/parsers/gpu-topo.hpp" + }, + { + "symbol": "int GpuTopo::parseGPU_INFORMATION", + "documented": false, + "kind": "function", + "line": 26, + "file": "/Users/jim/tum/sys-sage/src/parsers/gpu-topo.hpp" + }, + { + "symbol": "int GpuTopo::parseCOMPUTE_RESOURCE_INFORMATION", + "documented": false, + "kind": "function", + "line": 27, + "file": "/Users/jim/tum/sys-sage/src/parsers/gpu-topo.hpp" + }, + { + "symbol": "int GpuTopo::parseREGISTER_INFORMATION", + "documented": false, + "kind": "function", + "line": 28, + "file": "/Users/jim/tum/sys-sage/src/parsers/gpu-topo.hpp" + }, + { + "symbol": "int GpuTopo::parseADDITIONAL_INFORMATION", + "documented": false, + "kind": "function", + "line": 29, + "file": "/Users/jim/tum/sys-sage/src/parsers/gpu-topo.hpp" + }, + { + "symbol": "int GpuTopo::parseMAIN_MEMORY", + "documented": false, + "kind": "function", + "line": 30, + "file": "/Users/jim/tum/sys-sage/src/parsers/gpu-topo.hpp" + }, + { + "symbol": "int GpuTopo::parseCaches", + "documented": false, + "kind": "function", + "line": 31, + "file": "/Users/jim/tum/sys-sage/src/parsers/gpu-topo.hpp" + }, + { + "symbol": "GpuTopo", + "documented": false, + "kind": "class", + "line": 10, + "file": "/Users/jim/tum/sys-sage/src/parsers/gpu-topo.hpp" + }, + { + "symbol": "int parseGpuTopo", + "documented": false, + "kind": "function", + "line": 7, + "file": "/Users/jim/tum/sys-sage/src/parsers/gpu-topo.hpp" + }, + { + "symbol": "int parseGpuTopo", + "documented": false, + "kind": "function", + "line": 8, + "file": "/Users/jim/tum/sys-sage/src/parsers/gpu-topo.hpp" + }, + { + "symbol": "const std::string whiteSpaces", + "documented": false, + "kind": "function", + "line": 34, + "file": "/Users/jim/tum/sys-sage/src/parsers/gpu-topo.hpp" + }, + { + "symbol": "void trimRight", + "documented": false, + "kind": "function", + "line": 35, + "file": "/Users/jim/tum/sys-sage/src/parsers/gpu-topo.hpp" + }, + { + "symbol": "void trimLeft", + "documented": false, + "kind": "function", + "line": 36, + "file": "/Users/jim/tum/sys-sage/src/parsers/gpu-topo.hpp" + }, + { + "symbol": "void trim", + "documented": false, + "kind": "function", + "line": 37, + "file": "/Users/jim/tum/sys-sage/src/parsers/gpu-topo.hpp" + }, + { + "symbol": "gpu-topo.hpp", + "documented": false, + "kind": "file", + "line": 1, + "file": "/Users/jim/tum/sys-sage/src/parsers/gpu-topo.hpp" + } + ], + "/Users/jim/tum/sys-sage/examples/custom_attributes.cpp": [ + { + "symbol": "double My_core_attributes::temperature", + "documented": false, + "kind": "variable", + "line": 8, + "file": "/Users/jim/tum/sys-sage/examples/custom_attributes.cpp" + }, + { + "symbol": "int My_core_attributes::frequency", + "documented": false, + "kind": "variable", + "line": 9, + "file": "/Users/jim/tum/sys-sage/examples/custom_attributes.cpp" + }, + { + "symbol": "My_core_attributes::My_core_attributes", + "documented": false, + "kind": "function", + "line": 7, + "file": "/Users/jim/tum/sys-sage/examples/custom_attributes.cpp" + }, + { + "symbol": "My_core_attributes", + "documented": false, + "kind": "class", + "line": 5, + "file": "/Users/jim/tum/sys-sage/examples/custom_attributes.cpp" + }, + { + "symbol": "int print_my_attribs", + "documented": false, + "kind": "function", + "line": 14, + "file": "/Users/jim/tum/sys-sage/examples/custom_attributes.cpp" + }, + { + "symbol": "int print_my_custom_attribs", + "documented": false, + "kind": "function", + "line": 30, + "file": "/Users/jim/tum/sys-sage/examples/custom_attributes.cpp" + }, + { + "symbol": "void usage", + "documented": false, + "kind": "function", + "line": 50, + "file": "/Users/jim/tum/sys-sage/examples/custom_attributes.cpp" + }, + { + "symbol": "int main", + "documented": false, + "kind": "function", + "line": 58, + "file": "/Users/jim/tum/sys-sage/examples/custom_attributes.cpp" + }, + { + "symbol": "custom_attributes.cpp", + "documented": false, + "kind": "file", + "line": 1, + "file": "/Users/jim/tum/sys-sage/examples/custom_attributes.cpp" + } + ], + "/Users/jim/tum/sys-sage/data-sources/caps-numa-benchmark.cpp": [ + { + "symbol": "long long numa_region::numa_mem_sz", + "documented": false, + "kind": "variable", + "line": 32, + "file": "/Users/jim/tum/sys-sage/data-sources/caps-numa-benchmark.cpp" + }, + { + "symbol": "long long numa_region::arrsz", + "documented": false, + "kind": "variable", + "line": 33, + "file": "/Users/jim/tum/sys-sage/data-sources/caps-numa-benchmark.cpp" + }, + { + "symbol": "int numa_region::step", + "documented": false, + "kind": "variable", + "line": 34, + "file": "/Users/jim/tum/sys-sage/data-sources/caps-numa-benchmark.cpp" + }, + { + "symbol": "int numa_region::num_elems", + "documented": false, + "kind": "variable", + "line": 35, + "file": "/Users/jim/tum/sys-sage/data-sources/caps-numa-benchmark.cpp" + }, + { + "symbol": "uint64_t numa_region::timer_overhead", + "documented": false, + "kind": "variable", + "line": 37, + "file": "/Users/jim/tum/sys-sage/data-sources/caps-numa-benchmark.cpp" + }, + { + "symbol": "uint64_t numa_region::latency_time", + "documented": false, + "kind": "variable", + "line": 39, + "file": "/Users/jim/tum/sys-sage/data-sources/caps-numa-benchmark.cpp" + }, + { + "symbol": "uint64_t numa_region::bw_time", + "documented": false, + "kind": "variable", + "line": 40, + "file": "/Users/jim/tum/sys-sage/data-sources/caps-numa-benchmark.cpp" + }, + { + "symbol": "numa_region", + "documented": false, + "kind": "struct", + "line": 30, + "file": "/Users/jim/tum/sys-sage/data-sources/caps-numa-benchmark.cpp" + }, + { + "symbol": "REPEATS", + "documented": false, + "kind": "define", + "line": 18, + "file": "/Users/jim/tum/sys-sage/data-sources/caps-numa-benchmark.cpp" + }, + { + "symbol": "LATENCY_REPEATS", + "documented": false, + "kind": "define", + "line": 19, + "file": "/Users/jim/tum/sys-sage/data-sources/caps-numa-benchmark.cpp" + }, + { + "symbol": "MAIN_MEM_FRACTION", + "documented": false, + "kind": "define", + "line": 20, + "file": "/Users/jim/tum/sys-sage/data-sources/caps-numa-benchmark.cpp" + }, + { + "symbol": "CACHE_LINE_SZ", + "documented": false, + "kind": "define", + "line": 21, + "file": "/Users/jim/tum/sys-sage/data-sources/caps-numa-benchmark.cpp" + }, + { + "symbol": "TIMER_WARMUP", + "documented": false, + "kind": "define", + "line": 22, + "file": "/Users/jim/tum/sys-sage/data-sources/caps-numa-benchmark.cpp" + }, + { + "symbol": "TIMER_REPEATS", + "documented": false, + "kind": "define", + "line": 23, + "file": "/Users/jim/tum/sys-sage/data-sources/caps-numa-benchmark.cpp" + }, + { + "symbol": "errExit", + "documented": false, + "kind": "define", + "line": 28, + "file": "/Users/jim/tum/sys-sage/data-sources/caps-numa-benchmark.cpp" + }, + { + "symbol": "void fill_arr", + "documented": false, + "kind": "function", + "line": 43, + "file": "/Users/jim/tum/sys-sage/data-sources/caps-numa-benchmark.cpp" + }, + { + "symbol": "uint64_t get_timer_overhead", + "documented": false, + "kind": "function", + "line": 51, + "file": "/Users/jim/tum/sys-sage/data-sources/caps-numa-benchmark.cpp" + }, + { + "symbol": "int run_measurement", + "documented": false, + "kind": "function", + "line": 77, + "file": "/Users/jim/tum/sys-sage/data-sources/caps-numa-benchmark.cpp" + }, + { + "symbol": "int main", + "documented": false, + "kind": "function", + "line": 161, + "file": "/Users/jim/tum/sys-sage/data-sources/caps-numa-benchmark.cpp" + }, + { + "symbol": "caps-numa-benchmark.cpp", + "documented": false, + "kind": "file", + "line": 1, + "file": "/Users/jim/tum/sys-sage/data-sources/caps-numa-benchmark.cpp" + } + ], + "/Users/jim/tum/sys-sage/examples/matmul.cpp": [ + { + "symbol": "std::chrono", + "documented": false, + "kind": "namespace", + "line": 30, + "file": "/Users/jim/tum/sys-sage/examples/matmul.cpp" + }, + { + "symbol": "TIMER_WARMUP", + "documented": true, + "kind": "define", + "line": 24, + "file": "/Users/jim/tum/sys-sage/examples/matmul.cpp" + }, + { + "symbol": "TIMER_REPEATS", + "documented": false, + "kind": "define", + "line": 25, + "file": "/Users/jim/tum/sys-sage/examples/matmul.cpp" + }, + { + "symbol": "double* A", + "documented": false, + "kind": "variable", + "line": 35, + "file": "/Users/jim/tum/sys-sage/examples/matmul.cpp" + }, + { + "symbol": "double* B", + "documented": false, + "kind": "variable", + "line": 36, + "file": "/Users/jim/tum/sys-sage/examples/matmul.cpp" + }, + { + "symbol": "double* C", + "documented": false, + "kind": "variable", + "line": 37, + "file": "/Users/jim/tum/sys-sage/examples/matmul.cpp" + }, + { + "symbol": "int hwloc_dump_xml", + "documented": false, + "kind": "function", + "line": 214, + "file": "/Users/jim/tum/sys-sage/examples/matmul.cpp" + }, + { + "symbol": "uint64_t get_timer_overhead", + "documented": false, + "kind": "function", + "line": 188, + "file": "/Users/jim/tum/sys-sage/examples/matmul.cpp" + }, + { + "symbol": "void fill_matrices", + "documented": false, + "kind": "function", + "line": 39, + "file": "/Users/jim/tum/sys-sage/examples/matmul.cpp" + }, + { + "symbol": "void print_matrix", + "documented": false, + "kind": "function", + "line": 54, + "file": "/Users/jim/tum/sys-sage/examples/matmul.cpp" + }, + { + "symbol": "int main", + "documented": false, + "kind": "function", + "line": 67, + "file": "/Users/jim/tum/sys-sage/examples/matmul.cpp" + }, + { + "symbol": "matmul.cpp", + "documented": false, + "kind": "file", + "line": 1, + "file": "/Users/jim/tum/sys-sage/examples/matmul.cpp" + } + ], + "/Users/jim/tum/sys-sage/data-sources/hwloc-output.cpp": [ + { + "symbol": "int hwloc_dump_xml", + "documented": false, + "kind": "function", + "line": 27, + "file": "/Users/jim/tum/sys-sage/data-sources/hwloc-output.cpp" + }, + { + "symbol": "int main", + "documented": true, + "kind": "function", + "line": 16, + "file": "/Users/jim/tum/sys-sage/data-sources/hwloc-output.cpp" + }, + { + "symbol": "hwloc-output.cpp", + "documented": false, + "kind": "file", + "line": 1, + "file": "/Users/jim/tum/sys-sage/data-sources/hwloc-output.cpp" + } + ], + "/Users/jim/tum/sys-sage/data-sources/README.md": [ + { + "symbol": "README.md", + "documented": false, + "kind": "file", + "line": 1, + "file": "/Users/jim/tum/sys-sage/data-sources/README.md" + }, + { + "symbol": "md__Users_jim_tum_sys_sage_data_sources_README", + "documented": true, + "kind": "page", + "line": 1, + "file": "/Users/jim/tum/sys-sage/data-sources/README.md" + } + ], + "/Users/jim/tum/sys-sage/src/Concept.md": [ + { + "symbol": "Concept.md", + "documented": false, + "kind": "file", + "line": 1, + "file": "/Users/jim/tum/sys-sage/src/Concept.md" + }, + { + "symbol": "md_Concept", + "documented": true, + "kind": "page", + "line": 1, + "file": "/Users/jim/tum/sys-sage/src/Concept.md" + } + ], + "/Users/jim/tum/sys-sage/src/index.md": [ + { + "symbol": "index.md", + "documented": false, + "kind": "file", + "line": 1, + "file": "/Users/jim/tum/sys-sage/src/index.md" + }, + { + "symbol": "index", + "documented": true, + "kind": "page", + "line": 1, + "file": "/Users/jim/tum/sys-sage/src/index.md" + } + ], + "/Users/jim/tum/sys-sage/src/Installation_Guide.md": [ + { + "symbol": "Installation_Guide.md", + "documented": false, + "kind": "file", + "line": 1, + "file": "/Users/jim/tum/sys-sage/src/Installation_Guide.md" + }, + { + "symbol": "md_Installation_Guide", + "documented": true, + "kind": "page", + "line": 1, + "file": "/Users/jim/tum/sys-sage/src/Installation_Guide.md" + } + ], + "/Users/jim/tum/sys-sage/examples/basic_usage.cpp": [ + { + "symbol": "void usage", + "documented": false, + "kind": "function", + "line": 6, + "file": "/Users/jim/tum/sys-sage/examples/basic_usage.cpp" + }, + { + "symbol": "int main", + "documented": false, + "kind": "function", + "line": 14, + "file": "/Users/jim/tum/sys-sage/examples/basic_usage.cpp" + }, + { + "symbol": "basic_usage.cpp", + "documented": false, + "kind": "file", + "line": 1, + "file": "/Users/jim/tum/sys-sage/examples/basic_usage.cpp" + } + ], + "/Users/jim/tum/sys-sage/examples/cpu-frequency.cpp": [ + { + "symbol": "void usage", + "documented": false, + "kind": "function", + "line": 8, + "file": "/Users/jim/tum/sys-sage/examples/cpu-frequency.cpp" + }, + { + "symbol": "int main", + "documented": false, + "kind": "function", + "line": 14, + "file": "/Users/jim/tum/sys-sage/examples/cpu-frequency.cpp" + }, + { + "symbol": "cpu-frequency.cpp", + "documented": false, + "kind": "file", + "line": 1, + "file": "/Users/jim/tum/sys-sage/examples/cpu-frequency.cpp" + } + ], + "/Users/jim/tum/sys-sage/examples/gpu-topo-parser.cpp": [ + { + "symbol": "void usage", + "documented": false, + "kind": "function", + "line": 6, + "file": "/Users/jim/tum/sys-sage/examples/gpu-topo-parser.cpp" + }, + { + "symbol": "int main", + "documented": false, + "kind": "function", + "line": 14, + "file": "/Users/jim/tum/sys-sage/examples/gpu-topo-parser.cpp" + }, + { + "symbol": "gpu-topo-parser.cpp", + "documented": false, + "kind": "file", + "line": 1, + "file": "/Users/jim/tum/sys-sage/examples/gpu-topo-parser.cpp" + } + ], + "/Users/jim/tum/sys-sage/examples/larger_topo.cpp": [ + { + "symbol": "int main", + "documented": false, + "kind": "function", + "line": 9, + "file": "/Users/jim/tum/sys-sage/examples/larger_topo.cpp" + }, + { + "symbol": "larger_topo.cpp", + "documented": false, + "kind": "file", + "line": 1, + "file": "/Users/jim/tum/sys-sage/examples/larger_topo.cpp" + } + ], + "/Users/jim/tum/sys-sage/examples/sys-sage-benchmarking.cpp": [ + { + "symbol": "TIMER_WARMUP", + "documented": false, + "kind": "define", + "line": 11, + "file": "/Users/jim/tum/sys-sage/examples/sys-sage-benchmarking.cpp" + }, + { + "symbol": "TIMER_REPEATS", + "documented": false, + "kind": "define", + "line": 12, + "file": "/Users/jim/tum/sys-sage/examples/sys-sage-benchmarking.cpp" + }, + { + "symbol": "uint64_t get_timer_overhead", + "documented": false, + "kind": "function", + "line": 161, + "file": "/Users/jim/tum/sys-sage/examples/sys-sage-benchmarking.cpp" + }, + { + "symbol": "int main", + "documented": false, + "kind": "function", + "line": 23, + "file": "/Users/jim/tum/sys-sage/examples/sys-sage-benchmarking.cpp" + }, + { + "symbol": "sys-sage-benchmarking.cpp", + "documented": false, + "kind": "file", + "line": 1, + "file": "/Users/jim/tum/sys-sage/examples/sys-sage-benchmarking.cpp" + } + ], + "/Users/jim/tum/sys-sage/src/CAT_aware.cpp": [ + { + "symbol": "CAT_aware.cpp", + "documented": false, + "kind": "file", + "line": 1, + "file": "/Users/jim/tum/sys-sage/src/CAT_aware.cpp" + } + ], + "/Users/jim/tum/sys-sage/src/cpuinfo.cpp": [ + { + "symbol": "cpuinfo.cpp", + "documented": false, + "kind": "file", + "line": 1, + "file": "/Users/jim/tum/sys-sage/src/cpuinfo.cpp" + } + ], + "/Users/jim/tum/sys-sage/src/DataPath.cpp": [ + { + "symbol": "DataPath * NewDataPath", + "documented": true, + "kind": "function", + "line": 3, + "file": "/Users/jim/tum/sys-sage/src/DataPath.cpp" + }, + { + "symbol": "DataPath * NewDataPath", + "documented": true, + "kind": "function", + "line": 6, + "file": "/Users/jim/tum/sys-sage/src/DataPath.cpp" + }, + { + "symbol": "DataPath * NewDataPath", + "documented": true, + "kind": "function", + "line": 9, + "file": "/Users/jim/tum/sys-sage/src/DataPath.cpp" + }, + { + "symbol": "DataPath.cpp", + "documented": false, + "kind": "file", + "line": 1, + "file": "/Users/jim/tum/sys-sage/src/DataPath.cpp" + } + ], + "/Users/jim/tum/sys-sage/src/parsers/caps-numa-benchmark.cpp": [ + { + "symbol": "int parseCapsNumaBenchmark", + "documented": false, + "kind": "function", + "line": 10, + "file": "/Users/jim/tum/sys-sage/src/parsers/caps-numa-benchmark.cpp" + }, + { + "symbol": "caps-numa-benchmark.cpp", + "documented": false, + "kind": "file", + "line": 1, + "file": "/Users/jim/tum/sys-sage/src/parsers/caps-numa-benchmark.cpp" + } + ], + "/Users/jim/tum/sys-sage/src/parsers/gpu-topo.cpp": [ + { + "symbol": "int parseGpuTopo", + "documented": false, + "kind": "function", + "line": 13, + "file": "/Users/jim/tum/sys-sage/src/parsers/gpu-topo.cpp" + }, + { + "symbol": "int parseGpuTopo", + "documented": false, + "kind": "function", + "line": 24, + "file": "/Users/jim/tum/sys-sage/src/parsers/gpu-topo.cpp" + }, + { + "symbol": "void trimRight", + "documented": false, + "kind": "function", + "line": 687, + "file": "/Users/jim/tum/sys-sage/src/parsers/gpu-topo.cpp" + }, + { + "symbol": "void trimLeft", + "documented": false, + "kind": "function", + "line": 693, + "file": "/Users/jim/tum/sys-sage/src/parsers/gpu-topo.cpp" + }, + { + "symbol": "void trim", + "documented": false, + "kind": "function", + "line": 699, + "file": "/Users/jim/tum/sys-sage/src/parsers/gpu-topo.cpp" + }, + { + "symbol": "gpu-topo.cpp", + "documented": false, + "kind": "file", + "line": 1, + "file": "/Users/jim/tum/sys-sage/src/parsers/gpu-topo.cpp" + } + ], + "/Users/jim/tum/sys-sage/src/parsers/hwloc.cpp": [ + { + "symbol": "vector xmlRelevantNames", + "documented": true, + "kind": "variable", + "line": 9, + "file": "/Users/jim/tum/sys-sage/src/parsers/hwloc.cpp" + }, + { + "symbol": "vector xmlRelevantObjectTypes", + "documented": true, + "kind": "variable", + "line": 16, + "file": "/Users/jim/tum/sys-sage/src/parsers/hwloc.cpp" + }, + { + "symbol": "string xmlGetPropStr", + "documented": false, + "kind": "function", + "line": 33, + "file": "/Users/jim/tum/sys-sage/src/parsers/hwloc.cpp" + }, + { + "symbol": "Component * createChildC", + "documented": false, + "kind": "function", + "line": 45, + "file": "/Users/jim/tum/sys-sage/src/parsers/hwloc.cpp" + }, + { + "symbol": "int xmlProcessChildren", + "documented": false, + "kind": "function", + "line": 101, + "file": "/Users/jim/tum/sys-sage/src/parsers/hwloc.cpp" + }, + { + "symbol": "int removeUnknownCompoents", + "documented": false, + "kind": "function", + "line": 191, + "file": "/Users/jim/tum/sys-sage/src/parsers/hwloc.cpp" + }, + { + "symbol": "int parseHwlocOutput", + "documented": false, + "kind": "function", + "line": 225, + "file": "/Users/jim/tum/sys-sage/src/parsers/hwloc.cpp" + }, + { + "symbol": "hwloc.cpp", + "documented": false, + "kind": "file", + "line": 1, + "file": "/Users/jim/tum/sys-sage/src/parsers/hwloc.cpp" + } + ], + "/Users/jim/tum/sys-sage/src/parsers/hwloc.hpp": [ + { + "symbol": "std::vector xmlRelevantNames", + "documented": true, + "kind": "variable", + "line": 30, + "file": "/Users/jim/tum/sys-sage/src/parsers/hwloc.hpp" + }, + { + "symbol": "std::vector xmlRelevantObjectTypes", + "documented": true, + "kind": "variable", + "line": 34, + "file": "/Users/jim/tum/sys-sage/src/parsers/hwloc.hpp" + }, + { + "symbol": "int parseHwlocOutput", + "documented": true, + "kind": "function", + "line": 19, + "file": "/Users/jim/tum/sys-sage/src/parsers/hwloc.hpp" + }, + { + "symbol": "int xmlProcessChildren", + "documented": false, + "kind": "function", + "line": 21, + "file": "/Users/jim/tum/sys-sage/src/parsers/hwloc.hpp" + }, + { + "symbol": "Component * createChildC", + "documented": false, + "kind": "function", + "line": 23, + "file": "/Users/jim/tum/sys-sage/src/parsers/hwloc.hpp" + }, + { + "symbol": "std::string xmlGetPropStr", + "documented": false, + "kind": "function", + "line": 25, + "file": "/Users/jim/tum/sys-sage/src/parsers/hwloc.hpp" + }, + { + "symbol": "hwloc.hpp", + "documented": false, + "kind": "file", + "line": 1, + "file": "/Users/jim/tum/sys-sage/src/parsers/hwloc.hpp" + } + ], + "/Users/jim/tum/sys-sage/src/sys-sage.hpp": [ + { + "symbol": "sys-sage.hpp", + "documented": false, + "kind": "file", + "line": 1, + "file": "/Users/jim/tum/sys-sage/src/sys-sage.hpp" + } + ], + "/Users/jim/tum/sys-sage/src/Topology.cpp": [ + { + "symbol": "Topology.cpp", + "documented": false, + "kind": "file", + "line": 1, + "file": "/Users/jim/tum/sys-sage/src/Topology.cpp" + } + ], + "/Users/jim/tum/sys-sage/src/xml_dump.cpp": [ + { + "symbol": "std::function search_custom_attrib_key_fcn", + "documented": false, + "kind": "variable", + "line": 6, + "file": "/Users/jim/tum/sys-sage/src/xml_dump.cpp" + }, + { + "symbol": "std::function search_custom_complex_attrib_key_fcn", + "documented": false, + "kind": "variable", + "line": 7, + "file": "/Users/jim/tum/sys-sage/src/xml_dump.cpp" + }, + { + "symbol": "int search_default_attrib_key", + "documented": false, + "kind": "function", + "line": 10, + "file": "/Users/jim/tum/sys-sage/src/xml_dump.cpp" + }, + { + "symbol": "int search_default_complex_attrib_key", + "documented": false, + "kind": "function", + "line": 36, + "file": "/Users/jim/tum/sys-sage/src/xml_dump.cpp" + }, + { + "symbol": "int print_attrib", + "documented": false, + "kind": "function", + "line": 74, + "file": "/Users/jim/tum/sys-sage/src/xml_dump.cpp" + }, + { + "symbol": "int exportToXml", + "documented": true, + "kind": "function", + "line": 203, + "file": "/Users/jim/tum/sys-sage/src/xml_dump.cpp" + }, + { + "symbol": "xml_dump.cpp", + "documented": false, + "kind": "file", + "line": 1, + "file": "/Users/jim/tum/sys-sage/src/xml_dump.cpp" + } + ], + "/Users/jim/tum/sys-sage/src/xml_dump.hpp": [ + { + "symbol": "int exportToXml", + "documented": true, + "kind": "function", + "line": 12, + "file": "/Users/jim/tum/sys-sage/src/xml_dump.hpp" + }, + { + "symbol": "int search_default_attrib_key", + "documented": false, + "kind": "function", + "line": 13, + "file": "/Users/jim/tum/sys-sage/src/xml_dump.hpp" + }, + { + "symbol": "int print_attrib", + "documented": false, + "kind": "function", + "line": 15, + "file": "/Users/jim/tum/sys-sage/src/xml_dump.hpp" + }, + { + "symbol": "xml_dump.hpp", + "documented": false, + "kind": "file", + "line": 1, + "file": "/Users/jim/tum/sys-sage/src/xml_dump.hpp" + } + ] + } +} \ No newline at end of file diff --git a/docs/show_undocumented.py b/docs/show_undocumented.py new file mode 100755 index 0000000..88fc55f --- /dev/null +++ b/docs/show_undocumented.py @@ -0,0 +1,26 @@ +#!/usr/bin/env python3 + +# Shows undocumented symbols from the sys-sage project. +# Requires https://github.com/psycofdj/coverxygen, install via: pip3 install coverxygen +# Generate coverage file: python3 -m coverxygen --xml-dir xml --src-dir ../src/ --output doc-coverage.info --format json-v3 + +import sys +import json + +if len(sys.argv) != 2: + print("Missing input file argument") + exit(-1) + +cov = json.load(open(sys.argv[1])) +missing = 0 +for file in cov['files']: + for sym in cov['files'][file]: + if not sym['documented'] and sym['kind'] not in ['file', 'namespace']: + print("[{}:{}] \033[0;33m{}\033[0m".format( + sym['file'], sym['line'], sym['symbol'] + )) + missing += 1 + +print(f"Undocumented symbols: {missing}") + +exit(missing) diff --git a/src/xml_dump.hpp b/src/xml_dump.hpp index cb50b09..202817e 100644 --- a/src/xml_dump.hpp +++ b/src/xml_dump.hpp @@ -6,8 +6,8 @@ #include "Topology.hpp" #include "DataPath.hpp" -int exportToXml(Component* root, string path = "", std::function search_custom_attrib_key_fcn = NULL, std::function search_custom_complex_attrib_key_fcn = NULL); -int search_default_attrib_key(string key, void* value, string* ret_value_str); +int exportToXml(Component *root, string path = "", std::function search_custom_attrib_key_fcn = NULL, std::function search_custom_complex_attrib_key_fcn = NULL); +int search_default_attrib_key(string key, void *value, string *ret_value_str); -int print_attrib(map attrib, xmlNodePtr n); +int print_attrib(map attrib, xmlNodePtr n); #endif From 63cb7d5a8cfca5258acb84e04160abbf1d8d0b11 Mon Sep 17 00:00:00 2001 From: Jim Eckerlein Date: Sun, 9 Apr 2023 20:29:47 +0200 Subject: [PATCH 076/102] Add doc job --- .github/workflows/ci.yml | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4db97da..e6fe6ac 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -21,3 +21,15 @@ jobs: uses: ./.github/workflows/test.yml with: flags: -DTEST_UBSAN=ON + doc: + name: Documentation + runs-on: [ubuntu-latest] + steps: + - name: Checkout + uses: actions/checkout@v3 + with: + submodules: true + - run: pip3 install coverxygen + - run: doxygen docs/Doxyfile + - run: python3 -m coverxygen --xml-dir xml --src-dir src/ --output doc-coverage.info --format json-v3 + - run: doc/show_undocumented.py From d7dbc4a1494b3f951a6e5c6102055bdd78966f5f Mon Sep 17 00:00:00 2001 From: Jim Eckerlein Date: Sun, 9 Apr 2023 20:30:58 +0200 Subject: [PATCH 077/102] Do not generate latex output --- docs/Doxyfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/Doxyfile b/docs/Doxyfile index 129b59e..d2625b6 100644 --- a/docs/Doxyfile +++ b/docs/Doxyfile @@ -1849,7 +1849,7 @@ EXTRA_SEARCH_MAPPINGS = # If the GENERATE_LATEX tag is set to YES, doxygen will generate LaTeX output. # The default value is: YES. -GENERATE_LATEX = YES +GENERATE_LATEX = NO # The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. If a # relative path is entered the value of OUTPUT_DIRECTORY will be put in front of From 4145bb70c0e56a5539f9b8b59931da25fbaa163d Mon Sep 17 00:00:00 2001 From: Jim Eckerlein Date: Sun, 9 Apr 2023 20:32:30 +0200 Subject: [PATCH 078/102] Fix doc job --- .github/workflows/ci.yml | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e6fe6ac..75e285a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -29,7 +29,13 @@ jobs: uses: actions/checkout@v3 with: submodules: true - - run: pip3 install coverxygen - - run: doxygen docs/Doxyfile - - run: python3 -m coverxygen --xml-dir xml --src-dir src/ --output doc-coverage.info --format json-v3 - - run: doc/show_undocumented.py + - name: Install Doxygen + run: sudo apt install doxygen + - name: Install coverxygen + run: pip3 install coverxygen + - name: Generate documentation + run: doxygen docs/Doxyfile + - name: Generate documentation coverage + run: python3 -m coverxygen --xml-dir xml --src-dir src/ --output doc-coverage.info --format json-v3 + - name: Documentation report + run: doc/show_undocumented.py From 45f7399dfd77201d65dc06907b5670da0a9ed59f Mon Sep 17 00:00:00 2001 From: Jim Eckerlein Date: Sun, 9 Apr 2023 20:33:25 +0200 Subject: [PATCH 079/102] Fix typo --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 75e285a..f0e826d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -38,4 +38,4 @@ jobs: - name: Generate documentation coverage run: python3 -m coverxygen --xml-dir xml --src-dir src/ --output doc-coverage.info --format json-v3 - name: Documentation report - run: doc/show_undocumented.py + run: docs/show_undocumented.py From 190f6d755f9880d97da98e9dcb17410399fc4525 Mon Sep 17 00:00:00 2001 From: Jim Eckerlein Date: Sun, 9 Apr 2023 20:34:06 +0200 Subject: [PATCH 080/102] Fix --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f0e826d..ac8cea3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -38,4 +38,4 @@ jobs: - name: Generate documentation coverage run: python3 -m coverxygen --xml-dir xml --src-dir src/ --output doc-coverage.info --format json-v3 - name: Documentation report - run: docs/show_undocumented.py + run: docs/show_undocumented.py doc-coverage.info From d18c75d75fee07abd372b971503b2fe7c117faef Mon Sep 17 00:00:00 2001 From: Jim Eckerlein Date: Sun, 9 Apr 2023 20:37:43 +0200 Subject: [PATCH 081/102] cd into docs --- .github/workflows/ci.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ac8cea3..dd5344e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -34,8 +34,8 @@ jobs: - name: Install coverxygen run: pip3 install coverxygen - name: Generate documentation - run: doxygen docs/Doxyfile + run: cd docs && doxygen Doxyfile - name: Generate documentation coverage - run: python3 -m coverxygen --xml-dir xml --src-dir src/ --output doc-coverage.info --format json-v3 + run: cd docs && python3 -m coverxygen --xml-dir xml --src-dir ../src/ --output doc-coverage.info --format json-v3 - name: Documentation report - run: docs/show_undocumented.py doc-coverage.info + run: cd docs && show_undocumented.py doc-coverage.info From 44bb892683049ea59cb819608dee924c8ba0d209 Mon Sep 17 00:00:00 2001 From: Jim Eckerlein Date: Sun, 9 Apr 2023 20:39:14 +0200 Subject: [PATCH 082/102] fix relative path --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index dd5344e..aa79742 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -38,4 +38,4 @@ jobs: - name: Generate documentation coverage run: cd docs && python3 -m coverxygen --xml-dir xml --src-dir ../src/ --output doc-coverage.info --format json-v3 - name: Documentation report - run: cd docs && show_undocumented.py doc-coverage.info + run: cd docs && ./show_undocumented.py doc-coverage.info From b2f6b64710aa53f0b45a208e152288a0bfb98732 Mon Sep 17 00:00:00 2001 From: Stepan Vanecek Date: Fri, 15 Dec 2023 18:43:25 +0100 Subject: [PATCH 083/102] minor changes and new api calls --- examples/sys-sage-benchmarking.cpp | 4 ++- src/Topology.cpp | 49 +++++++++++++++++++++++++++--- src/Topology.hpp | 20 +++++++++--- src/cpuinfo.cpp | 1 - src/parsers/gpu-topo.cpp | 6 ++-- src/parsers/hwloc.cpp | 2 +- 6 files changed, 68 insertions(+), 14 deletions(-) diff --git a/examples/sys-sage-benchmarking.cpp b/examples/sys-sage-benchmarking.cpp index 8e31339..e98f345 100644 --- a/examples/sys-sage-benchmarking.cpp +++ b/examples/sys-sage-benchmarking.cpp @@ -146,7 +146,9 @@ int main(int argc, char *argv[]) cout << ", mt4g_dataPaths, "<< mt4g_dataPaths; cout << ", all_components, " << allComponentList.size() ; - cout << ", time_getNumaMaxBw, " << time_getNumaMaxBw; //<< "; bw; " << max_bw << "; ComponentId; " << max_bw_component->GetId() << endl; + cout << ", time_getNumaMaxBw, " << time_getNumaMaxBw; + if(false) + cout << "; bw; " << max_bw << "; ComponentId; " << max_bw_component->GetId() << endl; cout << ", time_createNewComponent, " << time_createNewComponent; cout << ", hwloc_component_size[B], " << hwloc_component_size; diff --git a/src/Topology.cpp b/src/Topology.cpp index 17a1193..dd0e3f8 100644 --- a/src/Topology.cpp +++ b/src/Topology.cpp @@ -124,8 +124,7 @@ void Component::GetComponentsNLevelsDeeper(vector* outArray, int dep void Component::GetSubcomponentsByType(vector* outArray, int _componentType) { - if(_componentType == componentType) - { + if(_componentType == componentType){ outArray->push_back(this); } for(Component* child: children) @@ -145,13 +144,17 @@ void Component::GetSubtreeNodeList(vector* outArray) } Component* Component::FindSubcomponentById(int _id, int _componentType) +{ + return GetSubcomponentById(_id, _componentType); +} +Component* Component::GetSubcomponentById(int _id, int _componentType) { if(componentType == _componentType && id == _id){ return this; } for(Component * child : children) { - Component* ret = child->FindSubcomponentById(_id, _componentType); + Component* ret = child->GetSubcomponentById(_id, _componentType); if(ret != NULL) { return ret; @@ -161,17 +164,55 @@ Component* Component::FindSubcomponentById(int _id, int _componentType) } void Component::FindAllSubcomponentsByType(vector* outArray, int _componentType) +{ + GetAllSubcomponentsByType(outArray, _componentType); +} +vector Component::GetAllSubcomponentsByType(int _componentType) +{ + vector ret; + GetAllSubcomponentsByType(&ret, _componentType); + return ret; +} +void Component::GetAllSubcomponentsByType(vector* outArray, int _componentType) { if(componentType == _componentType){ outArray->push_back(this); } for(Component * child : children) { - child->FindAllSubcomponentsByType(outArray, _componentType); + child->GetAllSubcomponentsByType(outArray, _componentType); } return; } +int Component::CountAllSubcomponents() +{ + int cnt = children.size(); + for(Component * child : children) + { + cnt += child->CountAllSubcomponents(); + } + return cnt; +} + +int Component::CountAllSubcomponentsByType(int _componentType) +{ + int cnt = 0; + for(Component * child : children) + { + if(child->GetComponentType() == _componentType) + cnt++; + } + for(Component * child : children) + { + cnt += child->CountAllSubcomponentsByType(_componentType); + } + return cnt; +} + +Component* Component::FindParentByType(int _componentType) +{ + return Get Component* Component::FindParentByType(int _componentType) { if(componentType == _componentType){ diff --git a/src/Topology.hpp b/src/Topology.hpp index 76458da..14fade3 100644 --- a/src/Topology.hpp +++ b/src/Topology.hpp @@ -153,23 +153,35 @@ class Component { Component* GetChild(int _id); Component* GetChildByType(int _componentType); vector GetAllChildrenByType(int _componentType); - + /** + OBSOLETE. Use GetSubcomponentById instead. This function will be removed in the future. + */ + Component* FindSubcomponentById(int _id, int _componentType); + /** + OBSOLETE. Use GetAllSubcomponentsByType instead. This function will be removed in the future. + */ + void FindAllSubcomponentsByType(vector* outArray, int _componentType); /** Searches the subtree to find a component with a matching id and componentType, i.e. looks for a certain component with a matching ID. The search is a DFS. The search starts with the calling component. \n Returns first occurence that matches these criteria. @param _id - the id to look for @param _componentType - the component type where to look for the id - @return Component * matching the criteria. NULL if no match found + @return Component * matching the criteria. Returns the first match. NULL if no match found */ - Component* FindSubcomponentById(int _id, int _componentType); - void FindAllSubcomponentsByType(vector* outArray, int _componentType); + Component* GetSubcomponentById(int _id, int _componentType); + void GetAllSubcomponentsByType(vector* outArray, int _componentType); + vector GetAllSubcomponentsByType(int _componentType); + int CountAllSubcomponents(); + int CountAllSubcomponentsByType(int _componentType); /** Moves up the tree until a parent of given type. @param _componentType - the desired component type @return Component * matching the criteria. NULL if no match found */ Component* FindParentByType(int _componentType); + /** + OBSOLETE. Use int CountAllSubcomponentsByType(SYS_SAGE_COMPONENT_THREAD) instead. Returns the number of Components of type SYS_SAGE_COMPONENT_THREAD in the subtree. */ int GetNumThreads(); diff --git a/src/cpuinfo.cpp b/src/cpuinfo.cpp index 870dcd1..95f0dbb 100644 --- a/src/cpuinfo.cpp +++ b/src/cpuinfo.cpp @@ -62,7 +62,6 @@ int readCpuinfoFreq(std::vector threads, bool keep_history = false) current_thread_pos = -1; } } - } else if (current_thread_pos != -1 && line.rfind("cpu MHz", 0) == 0) { diff --git a/src/parsers/gpu-topo.cpp b/src/parsers/gpu-topo.cpp index bc64893..66a0a2e 100644 --- a/src/parsers/gpu-topo.cpp +++ b/src/parsers/gpu-topo.cpp @@ -405,7 +405,7 @@ int GpuTopo::parseMAIN_MEMORY() if(latency != -1) for(Component * c : *(sm->GetChildren())) if(c->GetComponentType() == SYS_SAGE_COMPONENT_THREAD) - DataPath * d = new DataPath(mem, c, SYS_SAGE_DATAPATH_ORIENTED, SYS_SAGE_DATAPATH_TYPE_LOGICAL, 0, latency); + new DataPath(mem, c, SYS_SAGE_DATAPATH_ORIENTED, SYS_SAGE_DATAPATH_TYPE_LOGICAL, 0, latency); } } } @@ -610,7 +610,7 @@ int GpuTopo::parseCaches(string header_name, string cache_type) if(latency != -1) for(Component * c : *(sm->GetChildren())) if(c->GetComponentType() == SYS_SAGE_COMPONENT_THREAD) - DataPath * d = new DataPath(cache, c, SYS_SAGE_DATAPATH_ORIENTED, SYS_SAGE_DATAPATH_TYPE_LOGICAL, 0, latency); + new DataPath(cache, c, SYS_SAGE_DATAPATH_ORIENTED, SYS_SAGE_DATAPATH_TYPE_LOGICAL, 0, latency); } } } @@ -675,7 +675,7 @@ int GpuTopo::parseCaches(string header_name, string cache_type) } if(latency != -1) - DataPath * d = new DataPath(cache, child, SYS_SAGE_DATAPATH_ORIENTED, SYS_SAGE_DATAPATH_TYPE_LOGICAL, 0, latency); + new DataPath(cache, child, SYS_SAGE_DATAPATH_ORIENTED, SYS_SAGE_DATAPATH_TYPE_LOGICAL, 0, latency); } } } diff --git a/src/parsers/hwloc.cpp b/src/parsers/hwloc.cpp index 1271ea3..0e8efd4 100644 --- a/src/parsers/hwloc.cpp +++ b/src/parsers/hwloc.cpp @@ -204,7 +204,7 @@ int removeUnknownCompoents(Component* c){ vector* grandchildren = child->GetChildren(); int num_grandchildren = grandchildren->size(); if(num_grandchildren >= 1) { - int removed = c->RemoveChild(child); + c->RemoveChild(child); for(Component * grandchild : *grandchildren){ c->InsertChild(grandchild); grandchild->SetParent(c); From 6edc3b6dbe4f1c40c4200ed1fb2f6ee423a7d1b7 Mon Sep 17 00:00:00 2001 From: Stepan Vanecek Date: Fri, 15 Dec 2023 18:45:14 +0100 Subject: [PATCH 084/102] updated mt4g dependency --- data-sources/mt4g | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/data-sources/mt4g b/data-sources/mt4g index 8849feb..0536159 160000 --- a/data-sources/mt4g +++ b/data-sources/mt4g @@ -1 +1 @@ -Subproject commit 8849febb6fdf24a43a71d2a588a3a15afe14730e +Subproject commit 0536159f2492106041e5878122c7419f1458d664 From 20379c35588fb074292fedd761bcef8acb09cc00 Mon Sep 17 00:00:00 2001 From: Stepan Vanecek Date: Fri, 15 Dec 2023 19:05:22 +0100 Subject: [PATCH 085/102] make it compile --- src/Topology.cpp | 8 +++-- src/Topology.hpp | 81 +++--------------------------------------------- 2 files changed, 10 insertions(+), 79 deletions(-) diff --git a/src/Topology.cpp b/src/Topology.cpp index 4ec4ad2..2876379 100644 --- a/src/Topology.cpp +++ b/src/Topology.cpp @@ -220,8 +220,10 @@ int Component::CountAllSubcomponentsByType(int _componentType) Component* Component::FindParentByType(int _componentType) { - return Get -Component* Component::FindParentByType(int _componentType) + return GetAncestorType(_componentType); +} + +Component* Component::GetAncestorType(int _componentType) { if(componentType == _componentType){ return this; @@ -443,7 +445,7 @@ void Component::Delete(bool withSubtree) if(GetParent()!= NULL) { Component *myParent = GetParent(); - int j = myParent->RemoveChild(this); + myParent->RemoveChild(this); if (!withSubtree) { for(Component* child: children) diff --git a/src/Topology.hpp b/src/Topology.hpp index 1d0a4db..5d00d27 100644 --- a/src/Topology.hpp +++ b/src/Topology.hpp @@ -179,6 +179,10 @@ class Component { @param _componentType - the desired component type @return Component * matching the criteria. NULL if no match found */ + Component* GetAncestorType(int _componentType); + /** + OBSOLETE. Use GetAncestorType instead. This function will be removed in the future. + */ Component* FindParentByType(int _componentType); /** @@ -366,15 +370,8 @@ class Node : public Component { @param _name = name, default "Node" @param componentType=>SYS_SAGE_COMPONENT_NODE */ -<<<<<<< HEAD Node(Component * parent, int _id = 0, string _name = "Node"); - -======= - Node(int _id); - Node(Component* parent, int _id); - ~Node() override = default; ->>>>>>> ci-jim/master #ifdef CPUINFO public: int RefreshCpuCoreFrequency(bool keep_history = false); @@ -405,7 +402,6 @@ class Memory : public Component { @param componentType=>SYS_SAGE_COMPONENT_MEMORY */ Memory(); -<<<<<<< HEAD /** Memory constructor with insertion into the Component Tree as the parent 's child (as long as parent is an existing Component). Sets: @param parent = the parent @@ -414,14 +410,7 @@ class Memory : public Component { @param componentType=>SYS_SAGE_COMPONENT_MEMORY */ Memory(Component * parent, string _name = "Memory", long long _size = -1); -======= - Memory(Component * parent); - Memory(Component * parent, string _name); - Memory(Component * parent, string _name, long long _size); - ~Memory() override = default; - ->>>>>>> ci-jim/master long long GetSize(); void SetSize(long long _size); /** @@ -431,16 +420,12 @@ class Memory : public Component { xmlNodePtr CreateXmlSubtree(); private: long long size; /**< size/capacity of the memory element*/ -<<<<<<< HEAD bool is_volatile; /**< is volatile? */ #ifdef NVIDIA_MIG public: long long GetMIGSize(string uuid = ""); #endif -======= - bool is_volatile = false; /**< is volatile? */ ->>>>>>> ci-jim/master }; /** @@ -464,17 +449,10 @@ class Storage : public Component { @param componentType=>SYS_SAGE_COMPONENT_STORAGE */ Storage(Component * parent); -<<<<<<< HEAD + ~Storage() override = default; long long GetSize(); void SetSize(long long _size); -======= - - ~Storage() override = default; - - long long GetSize() { return size; }; - void SetSize(long long _size) { size = _size; }; ->>>>>>> ci-jim/master /** !!Should normally not be used!! Helper function of XML dump generation. @see exportToXml(Component* root, string path = "", std::function custom_search_attrib_key_fcn = NULL); @@ -507,7 +485,6 @@ class Chip : public Component { @param componentType=>SYS_SAGE_COMPONENT_CHIP */ Chip(Component * parent, int _id = 0, string _name = "Chip", int _type = SYS_SAGE_CHIP_TYPE_NONE); - ~Chip() override = default; void SetVendor(string _vendor); @@ -571,7 +548,6 @@ class Cache : public Component { @param componentType=>SYS_SAGE_COMPONENT_CACHE */ Cache(Component * parent, int _id = 0, int _cache_level = 0, long long _cache_size = -1, int _associativity = -1, int _cache_line_size = -1); - ~Cache() override = default; /** @@ -631,28 +607,8 @@ class Subdivision : public Component { @param _name = name, default "Subdivision" @param _componentType, componentType, default SYS_SAGE_COMPONENT_SUBDIVISION. If componentType is not SYS_SAGE_COMPONENT_SUBDIVISION or SYS_SAGE_COMPONENT_NUMA, it is set to SYS_SAGE_COMPONENT_SUBDIVISION as default option. */ -<<<<<<< HEAD Subdivision(Component * parent, int _id = 0, string _name = "Subdivision", int _componentType = SYS_SAGE_COMPONENT_SUBDIVISION); -======= - Subdivision(int _id); - Subdivision(int _id, string _name); - Subdivision(int _id, int _componentType); - /** - Helper constructor for inherited classes of Subdivision. Usually, this constructor will not be called. If called, the _componentType must be SYS_SAGE_COMPONENT_SUBDIVISION. - @param _id - id of the component - @param _name - name - @param _componentType - always use SYS_SAGE_COMPONENT_SUBDIVISION - */ - Subdivision(int _id, string _name, int _componentType); - Subdivision(Component * parent); - Subdivision(Component * parent, int _id); - Subdivision(Component * parent, int _id, string _name); - Subdivision(Component * parent, int _id, int _componentType); - Subdivision(Component * parent, int _id, string _name, int _componentType); - ~Subdivision() override = default; ->>>>>>> ci-jim/master - void SetSubdivisionType(int subdivisionType); int GetSubdivisionType(); /** @@ -686,25 +642,8 @@ class Numa : public Subdivision { @param _size = size or capacity of the NUMA region, default -1, i.e. no value. @param componentType=>SYS_SAGE_COMPONENT_NUMA */ -<<<<<<< HEAD Numa(Component * parent, int _id = 0, long long _size = -1); -======= - Numa(int _id); - /** - Numa constructor. Sets - \n name=>"Numa" - \n componentType=>SYS_SAGE_COMPONENT_NUMA - @param _id - id of the component - @param _size - size of the numa region of the memory (in case the memory segment is not represented by class Memory) - */ - Numa(int _id, int _size); - Numa(Component * parent); - Numa(Component * parent, int _id); - Numa(Component * parent, int _id, long long _size); - ~Numa() override = default; - ->>>>>>> ci-jim/master /** Get size of the Numa memory segment. @returns size of the Numa memory segment. @@ -740,18 +679,8 @@ class Core : public Component { @param _name = name, default "Core" @param componentType=>SYS_SAGE_COMPONENT_CORE */ -<<<<<<< HEAD Core(Component * parent, int _id = 0, string _name = "Core"); -======= - Core(int _id); - Core(int _id, string _name); - Core(Component * parent); - Core(Component * parent, int _id); - Core(Component * parent, int _id, string _name); - ~Core() override = default; ->>>>>>> ci-jim/master - private: #ifdef CPUINFO From 490f10ea0f21b2257db376aecc1a9e89f4581351 Mon Sep 17 00:00:00 2001 From: Stepan Vanecek Date: Fri, 15 Dec 2023 19:09:05 +0100 Subject: [PATCH 086/102] get/set size --- src/Topology.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/Topology.cpp b/src/Topology.cpp index 2876379..76d7e74 100644 --- a/src/Topology.cpp +++ b/src/Topology.cpp @@ -474,6 +474,9 @@ int Component::GetComponentType(){return componentType;} string Component::GetName(){return name;} int Component::GetId(){return id;} +void Storage::SetSize(long long _size){size = _size;} +long long Storage::GetSize(){return size;} + string Chip::GetVendor(){return vendor;} void Chip::SetVendor(string _vendor){vendor = _vendor;} string Chip::GetModel(){return model;} From 97c6a43f26dd2896f2948236bf56f79c2da43ef0 Mon Sep 17 00:00:00 2001 From: Stepan Vanecek Date: Fri, 15 Dec 2023 19:31:33 +0100 Subject: [PATCH 087/102] fix caps-numa-benchmark test --- test/caps-numa-benchmark.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/caps-numa-benchmark.cpp b/test/caps-numa-benchmark.cpp index d49d8da..de1ee51 100644 --- a/test/caps-numa-benchmark.cpp +++ b/test/caps-numa-benchmark.cpp @@ -26,14 +26,14 @@ static suite<"caps-numa-benchmark"> _ = [] expect(that % (4 == numa->GetDataPaths(SYS_SAGE_DATAPATH_INCOMING)->size()) >> fatal); for (const auto &dp : *numa->GetDataPaths(SYS_SAGE_DATAPATH_INCOMING)) { - expect(that % SYS_SAGE_DATAPATH_TYPE_PHYSICAL == dp->GetDpType()); + expect(that % SYS_SAGE_DATAPATH_TYPE_DATATRANSFER == dp->GetDpType()); expect(that % SYS_SAGE_DATAPATH_ORIENTED == dp->GetOriented()); } expect(that % (4 == numa->GetDataPaths(SYS_SAGE_DATAPATH_OUTGOING)->size()) >> fatal); for (const auto &dp : *numa->GetDataPaths(SYS_SAGE_DATAPATH_OUTGOING)) { - expect(that % SYS_SAGE_DATAPATH_TYPE_PHYSICAL == dp->GetDpType()); + expect(that % SYS_SAGE_DATAPATH_TYPE_DATATRANSFER == dp->GetDpType()); expect(that % SYS_SAGE_DATAPATH_ORIENTED == dp->GetOriented()); } } From d7c6b25658d1d985689da776bd27377b7095b613 Mon Sep 17 00:00:00 2001 From: Stepan Vanecek Date: Fri, 15 Dec 2023 19:49:55 +0100 Subject: [PATCH 088/102] documentation stubs --- src/Topology.hpp | 32 ++++++++++++++++++++++++++++++-- 1 file changed, 30 insertions(+), 2 deletions(-) diff --git a/src/Topology.hpp b/src/Topology.hpp index 5d00d27..ae54e0e 100644 --- a/src/Topology.hpp +++ b/src/Topology.hpp @@ -548,18 +548,26 @@ class Cache : public Component { @param componentType=>SYS_SAGE_COMPONENT_CACHE */ Cache(Component * parent, int _id = 0, int _cache_level = 0, long long _cache_size = -1, int _associativity = -1, int _cache_line_size = -1); + /** + * TODO + */ ~Cache() override = default; /** @returns cache level of this cache, assuming there's only 1 or no digit in the "cache_type" (e.g. "L1", "texture") - */ int GetCacheLevel(); + /** + * TODO + */ string GetCacheName(); /** @returns cache size of this cache */ long long GetCacheSize(); + /** + * TODO + */ void SetCacheSize(long long _cache_size); /** @returns the number of the cache associativity ways of this cache @@ -569,6 +577,9 @@ class Cache : public Component { @returns the size of a cache line of this cache */ int GetCacheLineSize(); + /** + * TODO + */ void SetCacheLineSize(int _cache_line_size); /** !!Should normally not be used!! Helper function of XML dump generation. @@ -608,8 +619,17 @@ class Subdivision : public Component { @param _componentType, componentType, default SYS_SAGE_COMPONENT_SUBDIVISION. If componentType is not SYS_SAGE_COMPONENT_SUBDIVISION or SYS_SAGE_COMPONENT_NUMA, it is set to SYS_SAGE_COMPONENT_SUBDIVISION as default option. */ Subdivision(Component * parent, int _id = 0, string _name = "Subdivision", int _componentType = SYS_SAGE_COMPONENT_SUBDIVISION); + /** + * TODO + */ ~Subdivision() override = default; + /** + * TODO + */ void SetSubdivisionType(int subdivisionType); + /** + * TODO + */ int GetSubdivisionType(); /** !!Should normally not be used!! Helper function of XML dump generation. @@ -643,6 +663,9 @@ class Numa : public Subdivision { @param componentType=>SYS_SAGE_COMPONENT_NUMA */ Numa(Component * parent, int _id = 0, long long _size = -1); + /** + * TODO + */ ~Numa() override = default; /** Get size of the Numa memory segment. @@ -680,6 +703,9 @@ class Core : public Component { @param componentType=>SYS_SAGE_COMPONENT_CORE */ Core(Component * parent, int _id = 0, string _name = "Core"); + /** + * TODO + */ ~Core() override = default; private: @@ -714,7 +740,9 @@ class Thread : public Component { @param componentType=>SYS_SAGE_COMPONENT_THREAD */ Thread(Component * parent, int _id = 0, string _name = "Thread"); - + /** + * TODO + */ ~Thread() override = default; #ifdef CPUINFO //defined in cpuinfo.cpp From 94c298b8e95dc993efee5195d76ab8a879b4546b Mon Sep 17 00:00:00 2001 From: Stepan Vanecek Date: Fri, 15 Dec 2023 20:00:21 +0100 Subject: [PATCH 089/102] more documentation stubs --- src/Topology.hpp | 116 +++++++++++++++++++++++++++++++++++++---------- 1 file changed, 91 insertions(+), 25 deletions(-) diff --git a/src/Topology.hpp b/src/Topology.hpp index ae54e0e..031910a 100644 --- a/src/Topology.hpp +++ b/src/Topology.hpp @@ -11,25 +11,25 @@ #include -#define SYS_SAGE_COMPONENT_NONE 1 -#define SYS_SAGE_COMPONENT_THREAD 2 -#define SYS_SAGE_COMPONENT_CORE 4 -#define SYS_SAGE_COMPONENT_CACHE 8 -#define SYS_SAGE_COMPONENT_SUBDIVISION 16 -#define SYS_SAGE_COMPONENT_NUMA 32 -#define SYS_SAGE_COMPONENT_CHIP 64 -#define SYS_SAGE_COMPONENT_MEMORY 128 -#define SYS_SAGE_COMPONENT_STORAGE 256 -#define SYS_SAGE_COMPONENT_NODE 512 -#define SYS_SAGE_COMPONENT_TOPOLOGY 1024 - -#define SYS_SAGE_SUBDIVISION_TYPE_NONE 1 -#define SYS_SAGE_SUBDIVISION_TYPE_GPU_SM 2 - -#define SYS_SAGE_CHIP_TYPE_NONE 1 -#define SYS_SAGE_CHIP_TYPE_CPU 2 -#define SYS_SAGE_CHIP_TYPE_CPU_SOCKET 4 -#define SYS_SAGE_CHIP_TYPE_GPU 8 +#define SYS_SAGE_COMPONENT_NONE 1 /**< class Component (do not use normally)*/ +#define SYS_SAGE_COMPONENT_THREAD 2 /**< class Thread */ +#define SYS_SAGE_COMPONENT_CORE 4 /**< class Core */ +#define SYS_SAGE_COMPONENT_CACHE 8 /**< class Cache */ +#define SYS_SAGE_COMPONENT_SUBDIVISION 16 /**< class Subdivision */ +#define SYS_SAGE_COMPONENT_NUMA 32 /**< class Numa */ +#define SYS_SAGE_COMPONENT_CHIP 64 /**< class Chip */ +#define SYS_SAGE_COMPONENT_MEMORY 128 /**< class Memory */ +#define SYS_SAGE_COMPONENT_STORAGE 256 /**< class Storage */ +#define SYS_SAGE_COMPONENT_NODE 512 /**< class Node */ +#define SYS_SAGE_COMPONENT_TOPOLOGY 1024 /**< class Topology */ + +#define SYS_SAGE_SUBDIVISION_TYPE_NONE 1 /**< Generic Subdivision type. */ +#define SYS_SAGE_SUBDIVISION_TYPE_GPU_SM 2 /**< Subdivision type for GPU SMs */ + +#define SYS_SAGE_CHIP_TYPE_NONE 1 /**< Generic Chip type. */ +#define SYS_SAGE_CHIP_TYPE_CPU 2 /**< Chip type used for a CPU. */ +#define SYS_SAGE_CHIP_TYPE_CPU_SOCKET 4 /**< Chip type used for one CPU socket. */ +#define SYS_SAGE_CHIP_TYPE_GPU 8 /**< Chip type used for a GPU.*/ using namespace std; @@ -56,6 +56,9 @@ class Component { @param _componentType = componentType, default SYS_SAGE_COMPONENT_NONE */ Component(Component * parent, int _id = 0, string _name = "unknown", int _componentType = SYS_SAGE_COMPONENT_NONE); + /** + * TODO + */ virtual ~Component() = default; /** Inserts a Child component to this component (in the Component Tree). @@ -152,7 +155,13 @@ class Component { \n Should there be more children with the same id, the first match will be retrieved (i.e. the one with lower index in the children array.) */ Component* GetChild(int _id); + /** + * TODO + */ Component* GetChildByType(int _componentType); + /** + * TODO + */ vector GetAllChildrenByType(int _componentType); /** OBSOLETE. Use GetSubcomponentById instead. This function will be removed in the future. @@ -170,9 +179,21 @@ class Component { @return Component * matching the criteria. Returns the first match. NULL if no match found */ Component* GetSubcomponentById(int _id, int _componentType); + /** + * TODO + */ void GetAllSubcomponentsByType(vector* outArray, int _componentType); + /** + * TODO + */ vector GetAllSubcomponentsByType(int _componentType); + /** + * TODO + */ int CountAllSubcomponents(); + /** + * TODO + */ int CountAllSubcomponentsByType(int _componentType); /** Moves up the tree until a parent of given type. @@ -258,6 +279,9 @@ class Component { \n The method pushes back the found data paths -- i.e. the data paths(pointers) can be found in this array after the method returns. (If no found, the vector is not changed.) */ void GetAllDpByType(vector* outDpArr, int dp_type, int orientation); + /** + * TODO + */ int CheckComponentTreeConsistency(); /** Calculates approximate memory footprint of the subtree of this element (including the relevant data paths). @@ -345,7 +369,9 @@ class Topology : public Component { \n componentType=>SYS_SAGE_COMPONENT_TOPOLOGY */ Topology(); - + /** + * TODO + */ ~Topology() override = default; private: }; @@ -371,6 +397,9 @@ class Node : public Component { @param componentType=>SYS_SAGE_COMPONENT_NODE */ Node(Component * parent, int _id = 0, string _name = "Node"); + /** + * TODO + */ ~Node() override = default; #ifdef CPUINFO public: @@ -410,8 +439,17 @@ class Memory : public Component { @param componentType=>SYS_SAGE_COMPONENT_MEMORY */ Memory(Component * parent, string _name = "Memory", long long _size = -1); + /** + * TODO + */ ~Memory() override = default; + /** + * TODO + */ long long GetSize(); + /** + * TODO + */ void SetSize(long long _size); /** !!Should normally not be used!! Helper function of XML dump generation. @@ -449,9 +487,17 @@ class Storage : public Component { @param componentType=>SYS_SAGE_COMPONENT_STORAGE */ Storage(Component * parent); + /** + * TODO + */ ~Storage() override = default; - + /** + * TODO + */ long long GetSize(); + /** + * TODO + */ void SetSize(long long _size); /** !!Should normally not be used!! Helper function of XML dump generation. @@ -485,13 +531,33 @@ class Chip : public Component { @param componentType=>SYS_SAGE_COMPONENT_CHIP */ Chip(Component * parent, int _id = 0, string _name = "Chip", int _type = SYS_SAGE_CHIP_TYPE_NONE); + /** + * TODO + */ ~Chip() override = default; - + /** + * TODO + */ void SetVendor(string _vendor); + /** + * TODO + */ string GetVendor(); + /** + * TODO + */ void SetModel(string _model); + /** + * TODO + */ string GetModel(); + /** + * TODO + */ void SetChipType(int chipType); + /** + * TODO + */ int GetChipType(); /** !!Should normally not be used!! Helper function of XML dump generation. @@ -499,9 +565,9 @@ class Chip : public Component { */ xmlNodePtr CreateXmlSubtree(); private: - string vendor; - string model; - int type; + string vendor; /**< TODO */ + string model; /**< TODO */ + int type; /**< TODO */ #ifdef NVIDIA_MIG public: int UpdateMIGSettings(string uuid = ""); From aac7947e1507570e66bc4d24c315613bcb43fc10 Mon Sep 17 00:00:00 2001 From: Stepan Vanecek Date: Fri, 15 Dec 2023 20:14:46 +0100 Subject: [PATCH 090/102] more doc stubs in datapath.hpp --- src/DataPath.hpp | 44 +++++++++++++++++++++++++------------------- 1 file changed, 25 insertions(+), 19 deletions(-) diff --git a/src/DataPath.hpp b/src/DataPath.hpp index 7b819d5..3464bc1 100644 --- a/src/DataPath.hpp +++ b/src/DataPath.hpp @@ -6,23 +6,23 @@ #include "defines.hpp" #include "Topology.hpp" -//void AddDataPath(DataPath* p, int orientation); -#define SYS_SAGE_DATAPATH_NONE 1 -#define SYS_SAGE_DATAPATH_OUTGOING 2 -#define SYS_SAGE_DATAPATH_INCOMING 4 +//Component pointing to a DataPath +#define SYS_SAGE_DATAPATH_NONE 1 /**< TODO */ +#define SYS_SAGE_DATAPATH_OUTGOING 2 /**< This Component is the source DataPath. */ +#define SYS_SAGE_DATAPATH_INCOMING 4 /**< This Component is the taerget DataPath. */ //int oriented -#define SYS_SAGE_DATAPATH_BIDIRECTIONAL 8 -#define SYS_SAGE_DATAPATH_ORIENTED 16 +#define SYS_SAGE_DATAPATH_BIDIRECTIONAL 8 /**< DataPath has no direction. */ +#define SYS_SAGE_DATAPATH_ORIENTED 16 /**< DataPath is directec from the source to the target. */ //dp_type -#define SYS_SAGE_DATAPATH_TYPE_NONE 32 -#define SYS_SAGE_DATAPATH_TYPE_LOGICAL 64 -#define SYS_SAGE_DATAPATH_TYPE_PHYSICAL 128 -#define SYS_SAGE_DATAPATH_TYPE_L3CAT 256 -#define SYS_SAGE_DATAPATH_TYPE_MIG 512 -#define SYS_SAGE_DATAPATH_TYPE_DATATRANSFER 1024 -#define SYS_SAGE_DATAPATH_TYPE_C2C 2048 +#define SYS_SAGE_DATAPATH_TYPE_NONE 32 /**< Generic type of DataPath */ +#define SYS_SAGE_DATAPATH_TYPE_LOGICAL 64 /**< DataPath describes a logical connection/relation of two Components. */ +#define SYS_SAGE_DATAPATH_TYPE_PHYSICAL 128 /**< DataPath describes a physical/hardware connection/relation of two Components. */ +#define SYS_SAGE_DATAPATH_TYPE_L3CAT 256 /**< DataPath type describing Cache partitioning settings. */ +#define SYS_SAGE_DATAPATH_TYPE_MIG 512 /**< DataPath type describing GPU partitioning settings. */ +#define SYS_SAGE_DATAPATH_TYPE_DATATRANSFER 1024 /**< DataPath type describing data transfer attributes. */ +#define SYS_SAGE_DATAPATH_TYPE_C2C 2048 /**< DataPath type describing cache-to-cache latencies (cccbench data source). */ using namespace std; class Component; @@ -103,6 +103,9 @@ class DataPath { @see dp_type */ int GetDpType(); + /** + * TODO + */ int GetOriented(); /** @@ -117,16 +120,19 @@ class DataPath { */ void DeleteDataPath(); + /** + * TODO + */ map attrib; private: - Component * source; - Component * target; + Component * source; /**< TODO */ + Component * target; /**< TODO */ - const int oriented; - const int dp_type; /**< asdasd */ + const int oriented; /**< TODO */ + const int dp_type; /**< TODO */ - double bw; - double latency; + double bw; /**< TODO */ + double latency; /**< TODO */ }; From 95299d4c4ad0e8752ad8cd8a1a14be66db47db33 Mon Sep 17 00:00:00 2001 From: Stepan Vanecek Date: Fri, 15 Dec 2023 20:20:35 +0100 Subject: [PATCH 091/102] update code coverage test --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index aa79742..8e22dff 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -36,6 +36,6 @@ jobs: - name: Generate documentation run: cd docs && doxygen Doxyfile - name: Generate documentation coverage - run: cd docs && python3 -m coverxygen --xml-dir xml --src-dir ../src/ --output doc-coverage.info --format json-v3 + run: cd docs && python3 -m coverxygen --xml-dir xml --src-dir ../src/ --output doc-coverage.info --format json-v3 --scope public,protected --prefix *.hpp - name: Documentation report run: cd docs && ./show_undocumented.py doc-coverage.info From d04d263363299363783b115eb786e611160ba86c Mon Sep 17 00:00:00 2001 From: Stepan Vanecek Date: Fri, 15 Dec 2023 20:29:14 +0100 Subject: [PATCH 092/102] test address sanitizer --- test/export.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/test/export.cpp b/test/export.cpp index 1bc7519..f76bdd0 100644 --- a/test/export.cpp +++ b/test/export.cpp @@ -119,6 +119,7 @@ static suite<"export"> _ = [] { auto topo = new Component{42, "a name", SYS_SAGE_COMPONENT_NONE}; exportToXml(topo, "test.xml"); + topo->Delete(); validate("test.xml"); }; From 2e51c819af85cdf33eb35951bb28888d6a6b10d4 Mon Sep 17 00:00:00 2001 From: Stepan Vanecek Date: Fri, 15 Dec 2023 20:35:45 +0100 Subject: [PATCH 093/102] more address sanitizers --- test/export.cpp | 2 +- test/gpu-topo.cpp | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/test/export.cpp b/test/export.cpp index f76bdd0..aee9691 100644 --- a/test/export.cpp +++ b/test/export.cpp @@ -119,7 +119,7 @@ static suite<"export"> _ = [] { auto topo = new Component{42, "a name", SYS_SAGE_COMPONENT_NONE}; exportToXml(topo, "test.xml"); - topo->Delete(); + topo->Delete(false); validate("test.xml"); }; diff --git a/test/gpu-topo.cpp b/test/gpu-topo.cpp index 4504be5..2a0e317 100644 --- a/test/gpu-topo.cpp +++ b/test/gpu-topo.cpp @@ -46,4 +46,5 @@ static suite<"gpu-topo"> _ = [] auto thread = dynamic_cast(cacheL1->GetChildByType(SYS_SAGE_COMPONENT_THREAD)); expect(that % (nullptr != thread) >> fatal); + topo->Delete(true); }; From f753e6af649507ac97494bbc5fee80b977e0c58a Mon Sep 17 00:00:00 2001 From: Stepan Vanecek Date: Fri, 15 Dec 2023 20:37:54 +0100 Subject: [PATCH 094/102] small fix --- test/gpu-topo.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/gpu-topo.cpp b/test/gpu-topo.cpp index 2a0e317..0bc1827 100644 --- a/test/gpu-topo.cpp +++ b/test/gpu-topo.cpp @@ -46,5 +46,5 @@ static suite<"gpu-topo"> _ = [] auto thread = dynamic_cast(cacheL1->GetChildByType(SYS_SAGE_COMPONENT_THREAD)); expect(that % (nullptr != thread) >> fatal); - topo->Delete(true); + topo.Delete(true); }; From 7ad493716c737a914848bdbcb57553fba632a1c8 Mon Sep 17 00:00:00 2001 From: Stepan Vanecek Date: Sat, 16 Dec 2023 17:14:05 +0100 Subject: [PATCH 095/102] update gpu example to delete topology --- examples/gpu-topo-parser.cpp | 8 +++++--- test/Dockerfile | 2 +- test/gpu-topo.cpp | 2 +- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/examples/gpu-topo-parser.cpp b/examples/gpu-topo-parser.cpp index d727745..3cdfe3e 100644 --- a/examples/gpu-topo-parser.cpp +++ b/examples/gpu-topo-parser.cpp @@ -18,7 +18,7 @@ int main(int argc, char *argv[]) std::string path_prefix(argv[0]); std::size_t found = path_prefix.find_last_of("/\\"); path_prefix=path_prefix.substr(0,found) + "/"; - gpuTopoPath = path_prefix + "example_data/pascal_gpu_topo.csv"; + gpuTopoPath = path_prefix + "example_data/ampere_gpu_topo.csv"; } else if(argc == 2){ gpuTopoPath = argv[1]; @@ -42,9 +42,11 @@ int main(int argc, char *argv[]) string output_name = "sys-sage_gpu_sample_output.xml"; cout << "-------- Exporting as XML to " << output_name << " --------" << endl; + + //topo->DeleteSubtree(); exportToXml(topo, output_name); - delete topo; - delete n; + topo->Delete(true); + return 0; } diff --git a/test/Dockerfile b/test/Dockerfile index fd66869..e7e1302 100644 --- a/test/Dockerfile +++ b/test/Dockerfile @@ -1,4 +1,4 @@ -FROM ubuntu:22.10 +FROM ubuntu:22.04 RUN apt-get update diff --git a/test/gpu-topo.cpp b/test/gpu-topo.cpp index 0bc1827..3b79f8b 100644 --- a/test/gpu-topo.cpp +++ b/test/gpu-topo.cpp @@ -46,5 +46,5 @@ static suite<"gpu-topo"> _ = [] auto thread = dynamic_cast(cacheL1->GetChildByType(SYS_SAGE_COMPONENT_THREAD)); expect(that % (nullptr != thread) >> fatal); - topo.Delete(true); + //topo.Delete(true); }; From 48fe41ddcf0d1ca26af2cfee0561cc4a572df29e Mon Sep 17 00:00:00 2001 From: Stepan Vanecek Date: Sat, 16 Dec 2023 17:42:48 +0100 Subject: [PATCH 096/102] disable address sanitizer test --- .github/workflows/ci.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8e22dff..eb07ba0 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -8,7 +8,8 @@ jobs: needs: test uses: ./.github/workflows/test.yml with: - flags: -DTEST_ASAN=ON + flags: -DTEST_ASAN=OFF + #TODO -DTEST_ASAN=ON tsan: name: Thread Sanitizer needs: test From 611c23a2a0c2e000fdf0c63918d0c002fd324b8a Mon Sep 17 00:00:00 2001 From: Stepan Vanecek Date: Mon, 18 Dec 2023 10:41:36 +0100 Subject: [PATCH 097/102] doc test --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index eb07ba0..7daddbf 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -37,6 +37,6 @@ jobs: - name: Generate documentation run: cd docs && doxygen Doxyfile - name: Generate documentation coverage - run: cd docs && python3 -m coverxygen --xml-dir xml --src-dir ../src/ --output doc-coverage.info --format json-v3 --scope public,protected --prefix *.hpp + run: cd docs && python3 -m coverxygen --xml-dir xml --src-dir ../src/ --output doc-coverage.info --format json-v3 --scope public,protected #--prefix *.hpp - name: Documentation report run: cd docs && ./show_undocumented.py doc-coverage.info From 45efbe182293dbd434327857e393c8fa679c6e26 Mon Sep 17 00:00:00 2001 From: Stepan Vanecek Date: Mon, 18 Dec 2023 11:10:37 +0100 Subject: [PATCH 098/102] ci doc --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7daddbf..5ab247c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -37,6 +37,6 @@ jobs: - name: Generate documentation run: cd docs && doxygen Doxyfile - name: Generate documentation coverage - run: cd docs && python3 -m coverxygen --xml-dir xml --src-dir ../src/ --output doc-coverage.info --format json-v3 --scope public,protected #--prefix *.hpp + run: cd docs && python3 -m coverxygen --xml-dir xml --src-dir ../src/ --output doc-coverage.info --format json-v3 --scope public,protected --kind enum,enumvalue,friend,typedef,function,class,struct,union,define,file,namespace #--prefix *.hpp - name: Documentation report run: cd docs && ./show_undocumented.py doc-coverage.info From dba14d491ef3dd99d2779e1184cfc5731516c46e Mon Sep 17 00:00:00 2001 From: Stepan Vanecek Date: Mon, 18 Dec 2023 11:14:42 +0100 Subject: [PATCH 099/102] ci doc limit scope --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5ab247c..6190913 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -37,6 +37,6 @@ jobs: - name: Generate documentation run: cd docs && doxygen Doxyfile - name: Generate documentation coverage - run: cd docs && python3 -m coverxygen --xml-dir xml --src-dir ../src/ --output doc-coverage.info --format json-v3 --scope public,protected --kind enum,enumvalue,friend,typedef,function,class,struct,union,define,file,namespace #--prefix *.hpp + run: cd docs && python3 -m coverxygen --xml-dir xml --src-dir ../src/ --output doc-coverage.info --format json-v3 --scope public,protected --kind enum,enumvalue,friend,typedef,function,class,struct,union,define,file,namespace --prefix src/ - name: Documentation report run: cd docs && ./show_undocumented.py doc-coverage.info From 4727ed153d26c246ddfcbe26cbaaa333efbf489c Mon Sep 17 00:00:00 2001 From: Stepan Vanecek Date: Mon, 18 Dec 2023 12:37:18 +0100 Subject: [PATCH 100/102] remove ci doc coverage -- does not work properly --- .github/workflows/ci.yml | 37 +- docs/doc-coverage.info | 2571 -------------------------------------- 2 files changed, 19 insertions(+), 2589 deletions(-) delete mode 100644 docs/doc-coverage.info diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6190913..329f6e0 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -22,21 +22,22 @@ jobs: uses: ./.github/workflows/test.yml with: flags: -DTEST_UBSAN=ON - doc: - name: Documentation - runs-on: [ubuntu-latest] - steps: - - name: Checkout - uses: actions/checkout@v3 - with: - submodules: true - - name: Install Doxygen - run: sudo apt install doxygen - - name: Install coverxygen - run: pip3 install coverxygen - - name: Generate documentation - run: cd docs && doxygen Doxyfile - - name: Generate documentation coverage - run: cd docs && python3 -m coverxygen --xml-dir xml --src-dir ../src/ --output doc-coverage.info --format json-v3 --scope public,protected --kind enum,enumvalue,friend,typedef,function,class,struct,union,define,file,namespace --prefix src/ - - name: Documentation report - run: cd docs && ./show_undocumented.py doc-coverage.info + # TODO check documentation CI so that unnecessary files (.cpp, examples/,...) can be left out + # doc: + # name: Documentation + # runs-on: [ubuntu-latest] + # steps: + # - name: Checkout + # uses: actions/checkout@v3 + # with: + # submodules: true + # - name: Install Doxygen + # run: sudo apt install doxygen + # - name: Install coverxygen + # run: pip3 install coverxygen + # - name: Generate documentation + # run: cd docs && doxygen Doxyfile + # - name: Generate documentation coverage + # run: cd docs && python3 -m coverxygen --xml-dir xml --src-dir ../src/ --output doc-coverage.info --format json-v3 --scope public,protected --kind enum,enumvalue,friend,typedef,function,class,struct,union,define,file,namespace --prefix */src/ + # - name: Documentation report + # run: cd docs && ./show_undocumented.py doc-coverage.info diff --git a/docs/doc-coverage.info b/docs/doc-coverage.info deleted file mode 100644 index fc2f6f5..0000000 --- a/docs/doc-coverage.info +++ /dev/null @@ -1,2571 +0,0 @@ -{ - "total": { - "documented_symbol_count": 119, - "symbol_count": 352, - "coverage_rate": 0.3380681818181818 - }, - "kinds": { - "variable": { - "documented_symbol_count": 24, - "symbol_count": 56, - "coverage_rate": 0.42857142857142855 - }, - "function": { - "documented_symbol_count": 78, - "symbol_count": 209, - "coverage_rate": 0.37320574162679426 - }, - "class": { - "documented_symbol_count": 12, - "symbol_count": 15, - "coverage_rate": 0.8 - }, - "struct": { - "documented_symbol_count": 0, - "symbol_count": 1, - "coverage_rate": 0.0 - }, - "namespace": { - "documented_symbol_count": 0, - "symbol_count": 2, - "coverage_rate": 0.0 - }, - "file": { - "documented_symbol_count": 0, - "symbol_count": 28, - "coverage_rate": 0.0 - }, - "define": { - "documented_symbol_count": 1, - "symbol_count": 37, - "coverage_rate": 0.02702702702702703 - }, - "page": { - "documented_symbol_count": 4, - "symbol_count": 4, - "coverage_rate": 1.0 - } - }, - "files": { - "/Users/jim/tum/sys-sage/src/Topology.hpp": [ - { - "symbol": "string Cache::cache_type", - "documented": true, - "kind": "variable", - "line": 529, - "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" - }, - { - "symbol": "long long Cache::cache_size", - "documented": true, - "kind": "variable", - "line": 530, - "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" - }, - { - "symbol": "int Cache::cache_associativity_ways", - "documented": true, - "kind": "variable", - "line": 531, - "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" - }, - { - "symbol": "int Cache::cache_line_size", - "documented": true, - "kind": "variable", - "line": 532, - "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" - }, - { - "symbol": "Cache::Cache", - "documented": true, - "kind": "function", - "line": 484, - "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" - }, - { - "symbol": "Cache::Cache", - "documented": true, - "kind": "function", - "line": 493, - "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" - }, - { - "symbol": "Cache::Cache", - "documented": false, - "kind": "function", - "line": 494, - "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" - }, - { - "symbol": "Cache::Cache", - "documented": false, - "kind": "function", - "line": 495, - "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" - }, - { - "symbol": "Cache::Cache", - "documented": false, - "kind": "function", - "line": 496, - "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" - }, - { - "symbol": "Cache::Cache", - "documented": false, - "kind": "function", - "line": 497, - "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" - }, - { - "symbol": "Cache::Cache", - "documented": false, - "kind": "function", - "line": 498, - "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" - }, - { - "symbol": "Cache::Cache", - "documented": false, - "kind": "function", - "line": 499, - "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" - }, - { - "symbol": "Cache::Cache", - "documented": false, - "kind": "function", - "line": 500, - "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" - }, - { - "symbol": "Cache::~Cache", - "documented": false, - "kind": "function", - "line": 502, - "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" - }, - { - "symbol": "int Cache::GetCacheLevel", - "documented": true, - "kind": "function", - "line": 507, - "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" - }, - { - "symbol": "string Cache::GetCacheName", - "documented": false, - "kind": "function", - "line": 508, - "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" - }, - { - "symbol": "long long Cache::GetCacheSize", - "documented": true, - "kind": "function", - "line": 512, - "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" - }, - { - "symbol": "void Cache::SetCacheSize", - "documented": false, - "kind": "function", - "line": 513, - "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" - }, - { - "symbol": "int Cache::GetCacheAssociativityWays", - "documented": true, - "kind": "function", - "line": 517, - "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" - }, - { - "symbol": "int Cache::GetCacheLineSize", - "documented": true, - "kind": "function", - "line": 521, - "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" - }, - { - "symbol": "void Cache::SetCacheLineSize", - "documented": false, - "kind": "function", - "line": 522, - "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" - }, - { - "symbol": "xmlNodePtr Cache::CreateXmlSubtree", - "documented": true, - "kind": "function", - "line": 527, - "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" - }, - { - "symbol": "Cache", - "documented": true, - "kind": "class", - "line": 476, - "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" - }, - { - "symbol": "string Chip::vendor", - "documented": false, - "kind": "variable", - "line": 467, - "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" - }, - { - "symbol": "string Chip::model", - "documented": false, - "kind": "variable", - "line": 468, - "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" - }, - { - "symbol": "int Chip::type", - "documented": false, - "kind": "variable", - "line": 469, - "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" - }, - { - "symbol": "Chip::Chip", - "documented": true, - "kind": "function", - "line": 438, - "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" - }, - { - "symbol": "Chip::Chip", - "documented": true, - "kind": "function", - "line": 445, - "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" - }, - { - "symbol": "Chip::Chip", - "documented": false, - "kind": "function", - "line": 446, - "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" - }, - { - "symbol": "Chip::Chip", - "documented": false, - "kind": "function", - "line": 447, - "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" - }, - { - "symbol": "Chip::Chip", - "documented": false, - "kind": "function", - "line": 448, - "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" - }, - { - "symbol": "Chip::Chip", - "documented": false, - "kind": "function", - "line": 449, - "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" - }, - { - "symbol": "Chip::Chip", - "documented": false, - "kind": "function", - "line": 450, - "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" - }, - { - "symbol": "Chip::Chip", - "documented": false, - "kind": "function", - "line": 451, - "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" - }, - { - "symbol": "Chip::~Chip", - "documented": false, - "kind": "function", - "line": 453, - "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" - }, - { - "symbol": "void Chip::SetVendor", - "documented": false, - "kind": "function", - "line": 455, - "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" - }, - { - "symbol": "string Chip::GetVendor", - "documented": false, - "kind": "function", - "line": 456, - "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" - }, - { - "symbol": "void Chip::SetModel", - "documented": false, - "kind": "function", - "line": 457, - "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" - }, - { - "symbol": "string Chip::GetModel", - "documented": false, - "kind": "function", - "line": 458, - "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" - }, - { - "symbol": "void Chip::SetChipType", - "documented": false, - "kind": "function", - "line": 459, - "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" - }, - { - "symbol": "int Chip::GetChipType", - "documented": false, - "kind": "function", - "line": 460, - "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" - }, - { - "symbol": "xmlNodePtr Chip::CreateXmlSubtree", - "documented": true, - "kind": "function", - "line": 465, - "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" - }, - { - "symbol": "Chip", - "documented": true, - "kind": "class", - "line": 430, - "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" - }, - { - "symbol": "map Component::attrib", - "documented": true, - "kind": "variable", - "line": 277, - "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" - }, - { - "symbol": "int Component::id", - "documented": true, - "kind": "variable", - "line": 280, - "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" - }, - { - "symbol": "int Component::depth", - "documented": true, - "kind": "variable", - "line": 281, - "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" - }, - { - "symbol": "string Component::name", - "documented": true, - "kind": "variable", - "line": 282, - "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" - }, - { - "symbol": "int Component::count", - "documented": true, - "kind": "variable", - "line": 283, - "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" - }, - { - "symbol": "const int Component::componentType", - "documented": true, - "kind": "variable", - "line": 299, - "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" - }, - { - "symbol": "vector Component::children", - "documented": true, - "kind": "variable", - "line": 300, - "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" - }, - { - "symbol": "Component* Component::parent", - "documented": true, - "kind": "variable", - "line": 301, - "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" - }, - { - "symbol": "vector Component::dp_incoming", - "documented": true, - "kind": "variable", - "line": 302, - "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" - }, - { - "symbol": "vector Component::dp_outgoing", - "documented": true, - "kind": "variable", - "line": 303, - "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" - }, - { - "symbol": "Component::Component", - "documented": true, - "kind": "function", - "line": 50, - "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" - }, - { - "symbol": "Component::Component", - "documented": false, - "kind": "function", - "line": 51, - "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" - }, - { - "symbol": "Component::Component", - "documented": true, - "kind": "function", - "line": 58, - "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" - }, - { - "symbol": "Component::Component", - "documented": false, - "kind": "function", - "line": 59, - "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" - }, - { - "symbol": "virtual Component::~Component", - "documented": false, - "kind": "function", - "line": 61, - "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" - }, - { - "symbol": "void Component::InsertChild", - "documented": true, - "kind": "function", - "line": 70, - "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" - }, - { - "symbol": "int Component::RemoveChild", - "documented": true, - "kind": "function", - "line": 75, - "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" - }, - { - "symbol": "void Component::SetParent", - "documented": true, - "kind": "function", - "line": 81, - "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" - }, - { - "symbol": "void Component::PrintSubtree", - "documented": true, - "kind": "function", - "line": 86, - "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" - }, - { - "symbol": "void Component::PrintSubtree", - "documented": true, - "kind": "function", - "line": 92, - "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" - }, - { - "symbol": "void Component::PrintAllDataPathsInSubtree", - "documented": true, - "kind": "function", - "line": 97, - "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" - }, - { - "symbol": "string Component::GetName", - "documented": true, - "kind": "function", - "line": 104, - "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" - }, - { - "symbol": "int Component::GetId", - "documented": true, - "kind": "function", - "line": 110, - "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" - }, - { - "symbol": "int Component::GetComponentType", - "documented": true, - "kind": "function", - "line": 127, - "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" - }, - { - "symbol": "string Component::GetComponentTypeStr", - "documented": true, - "kind": "function", - "line": 144, - "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" - }, - { - "symbol": "vector< Component * > * Component::GetChildren", - "documented": true, - "kind": "function", - "line": 149, - "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" - }, - { - "symbol": "Component * Component::GetParent", - "documented": true, - "kind": "function", - "line": 153, - "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" - }, - { - "symbol": "Component * Component::GetChild", - "documented": true, - "kind": "function", - "line": 158, - "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" - }, - { - "symbol": "Component * Component::GetChildByType", - "documented": false, - "kind": "function", - "line": 159, - "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" - }, - { - "symbol": "vector< Component * > Component::GetAllChildrenByType", - "documented": false, - "kind": "function", - "line": 160, - "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" - }, - { - "symbol": "Component * Component::FindSubcomponentById", - "documented": true, - "kind": "function", - "line": 169, - "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" - }, - { - "symbol": "void Component::FindAllSubcomponentsByType", - "documented": false, - "kind": "function", - "line": 170, - "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" - }, - { - "symbol": "Component * Component::FindParentByType", - "documented": true, - "kind": "function", - "line": 176, - "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" - }, - { - "symbol": "int Component::GetNumThreads", - "documented": true, - "kind": "function", - "line": 180, - "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" - }, - { - "symbol": "int Component::GetTopoTreeDepth", - "documented": true, - "kind": "function", - "line": 186, - "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" - }, - { - "symbol": "void Component::GetComponentsNLevelsDeeper", - "documented": true, - "kind": "function", - "line": 195, - "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" - }, - { - "symbol": "void Component::GetSubcomponentsByType", - "documented": true, - "kind": "function", - "line": 205, - "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" - }, - { - "symbol": "void Component::GetSubtreeNodeList", - "documented": true, - "kind": "function", - "line": 213, - "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" - }, - { - "symbol": "vector< DataPath * > * Component::GetDataPaths", - "documented": true, - "kind": "function", - "line": 222, - "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" - }, - { - "symbol": "void Component::AddDataPath", - "documented": true, - "kind": "function", - "line": 230, - "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" - }, - { - "symbol": "DataPath * Component::GetDpByType", - "documented": true, - "kind": "function", - "line": 238, - "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" - }, - { - "symbol": "void Component::GetAllDpByType", - "documented": true, - "kind": "function", - "line": 248, - "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" - }, - { - "symbol": "int Component::CheckComponentTreeConsistency", - "documented": false, - "kind": "function", - "line": 249, - "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" - }, - { - "symbol": "int Component::GetTopologySize", - "documented": true, - "kind": "function", - "line": 256, - "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" - }, - { - "symbol": "int Component::GetTopologySize", - "documented": true, - "kind": "function", - "line": 266, - "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" - }, - { - "symbol": "xmlNodePtr Component::CreateXmlSubtree", - "documented": true, - "kind": "function", - "line": 272, - "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" - }, - { - "symbol": "Component", - "documented": true, - "kind": "class", - "line": 41, - "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" - }, - { - "symbol": "Core::Core", - "documented": true, - "kind": "function", - "line": 644, - "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" - }, - { - "symbol": "Core::Core", - "documented": true, - "kind": "function", - "line": 651, - "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" - }, - { - "symbol": "Core::Core", - "documented": false, - "kind": "function", - "line": 652, - "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" - }, - { - "symbol": "Core::Core", - "documented": false, - "kind": "function", - "line": 653, - "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" - }, - { - "symbol": "Core::Core", - "documented": false, - "kind": "function", - "line": 654, - "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" - }, - { - "symbol": "Core::Core", - "documented": false, - "kind": "function", - "line": 655, - "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" - }, - { - "symbol": "Core::~Core", - "documented": false, - "kind": "function", - "line": 657, - "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" - }, - { - "symbol": "Core", - "documented": true, - "kind": "class", - "line": 636, - "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" - }, - { - "symbol": "long long Memory::size", - "documented": true, - "kind": "variable", - "line": 394, - "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" - }, - { - "symbol": "bool Memory::is_volatile", - "documented": true, - "kind": "variable", - "line": 395, - "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" - }, - { - "symbol": "Memory::Memory", - "documented": true, - "kind": "function", - "line": 379, - "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" - }, - { - "symbol": "Memory::Memory", - "documented": false, - "kind": "function", - "line": 380, - "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" - }, - { - "symbol": "Memory::Memory", - "documented": false, - "kind": "function", - "line": 381, - "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" - }, - { - "symbol": "Memory::Memory", - "documented": false, - "kind": "function", - "line": 382, - "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" - }, - { - "symbol": "Memory::~Memory", - "documented": false, - "kind": "function", - "line": 384, - "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" - }, - { - "symbol": "long long Memory::GetSize", - "documented": false, - "kind": "function", - "line": 386, - "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" - }, - { - "symbol": "void Memory::SetSize", - "documented": false, - "kind": "function", - "line": 387, - "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" - }, - { - "symbol": "xmlNodePtr Memory::CreateXmlSubtree", - "documented": true, - "kind": "function", - "line": 392, - "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" - }, - { - "symbol": "Memory", - "documented": true, - "kind": "class", - "line": 371, - "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" - }, - { - "symbol": "Node::Node", - "documented": true, - "kind": "function", - "line": 338, - "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" - }, - { - "symbol": "Node::Node", - "documented": false, - "kind": "function", - "line": 339, - "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" - }, - { - "symbol": "Node::Node", - "documented": true, - "kind": "function", - "line": 346, - "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" - }, - { - "symbol": "Node::Node", - "documented": false, - "kind": "function", - "line": 347, - "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" - }, - { - "symbol": "Node::~Node", - "documented": false, - "kind": "function", - "line": 349, - "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" - }, - { - "symbol": "Node", - "documented": true, - "kind": "class", - "line": 330, - "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" - }, - { - "symbol": "long long Numa::size", - "documented": true, - "kind": "variable", - "line": 629, - "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" - }, - { - "symbol": "Numa::Numa", - "documented": true, - "kind": "function", - "line": 595, - "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" - }, - { - "symbol": "Numa::Numa", - "documented": true, - "kind": "function", - "line": 602, - "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" - }, - { - "symbol": "Numa::Numa", - "documented": true, - "kind": "function", - "line": 610, - "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" - }, - { - "symbol": "Numa::Numa", - "documented": false, - "kind": "function", - "line": 611, - "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" - }, - { - "symbol": "Numa::Numa", - "documented": false, - "kind": "function", - "line": 612, - "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" - }, - { - "symbol": "Numa::Numa", - "documented": false, - "kind": "function", - "line": 613, - "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" - }, - { - "symbol": "Numa::~Numa", - "documented": false, - "kind": "function", - "line": 615, - "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" - }, - { - "symbol": "long long Numa::GetSize", - "documented": true, - "kind": "function", - "line": 621, - "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" - }, - { - "symbol": "xmlNodePtr Numa::CreateXmlSubtree", - "documented": true, - "kind": "function", - "line": 627, - "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" - }, - { - "symbol": "Numa", - "documented": true, - "kind": "class", - "line": 587, - "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" - }, - { - "symbol": "long long Storage::size", - "documented": true, - "kind": "variable", - "line": 423, - "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" - }, - { - "symbol": "Storage::Storage", - "documented": true, - "kind": "function", - "line": 410, - "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" - }, - { - "symbol": "Storage::Storage", - "documented": false, - "kind": "function", - "line": 411, - "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" - }, - { - "symbol": "Storage::~Storage", - "documented": false, - "kind": "function", - "line": 413, - "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" - }, - { - "symbol": "long long Storage::GetSize", - "documented": false, - "kind": "function", - "line": 415, - "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" - }, - { - "symbol": "void Storage::SetSize", - "documented": false, - "kind": "function", - "line": 416, - "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" - }, - { - "symbol": "xmlNodePtr Storage::CreateXmlSubtree", - "documented": true, - "kind": "function", - "line": 421, - "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" - }, - { - "symbol": "Storage", - "documented": true, - "kind": "class", - "line": 402, - "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" - }, - { - "symbol": "int Subdivision::type", - "documented": true, - "kind": "variable", - "line": 580, - "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" - }, - { - "symbol": "Subdivision::Subdivision", - "documented": true, - "kind": "function", - "line": 547, - "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" - }, - { - "symbol": "Subdivision::Subdivision", - "documented": true, - "kind": "function", - "line": 554, - "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" - }, - { - "symbol": "Subdivision::Subdivision", - "documented": false, - "kind": "function", - "line": 555, - "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" - }, - { - "symbol": "Subdivision::Subdivision", - "documented": false, - "kind": "function", - "line": 556, - "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" - }, - { - "symbol": "Subdivision::Subdivision", - "documented": true, - "kind": "function", - "line": 563, - "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" - }, - { - "symbol": "Subdivision::Subdivision", - "documented": false, - "kind": "function", - "line": 564, - "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" - }, - { - "symbol": "Subdivision::Subdivision", - "documented": false, - "kind": "function", - "line": 565, - "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" - }, - { - "symbol": "Subdivision::Subdivision", - "documented": false, - "kind": "function", - "line": 566, - "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" - }, - { - "symbol": "Subdivision::Subdivision", - "documented": false, - "kind": "function", - "line": 567, - "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" - }, - { - "symbol": "Subdivision::Subdivision", - "documented": false, - "kind": "function", - "line": 568, - "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" - }, - { - "symbol": "Subdivision::~Subdivision", - "documented": false, - "kind": "function", - "line": 570, - "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" - }, - { - "symbol": "void Subdivision::SetSubdivisionType", - "documented": false, - "kind": "function", - "line": 572, - "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" - }, - { - "symbol": "int Subdivision::GetSubdivisionType", - "documented": false, - "kind": "function", - "line": 573, - "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" - }, - { - "symbol": "xmlNodePtr Subdivision::CreateXmlSubtree", - "documented": true, - "kind": "function", - "line": 578, - "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" - }, - { - "symbol": "Subdivision", - "documented": true, - "kind": "class", - "line": 539, - "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" - }, - { - "symbol": "Thread::Thread", - "documented": true, - "kind": "function", - "line": 683, - "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" - }, - { - "symbol": "Thread::Thread", - "documented": true, - "kind": "function", - "line": 690, - "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" - }, - { - "symbol": "Thread::Thread", - "documented": false, - "kind": "function", - "line": 691, - "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" - }, - { - "symbol": "Thread::Thread", - "documented": false, - "kind": "function", - "line": 692, - "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" - }, - { - "symbol": "Thread::Thread", - "documented": false, - "kind": "function", - "line": 693, - "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" - }, - { - "symbol": "Thread::Thread", - "documented": false, - "kind": "function", - "line": 694, - "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" - }, - { - "symbol": "Thread::~Thread", - "documented": false, - "kind": "function", - "line": 696, - "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" - }, - { - "symbol": "Thread", - "documented": true, - "kind": "class", - "line": 675, - "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" - }, - { - "symbol": "Topology::Topology", - "documented": true, - "kind": "function", - "line": 320, - "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" - }, - { - "symbol": "Topology::~Topology", - "documented": false, - "kind": "function", - "line": 322, - "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" - }, - { - "symbol": "Topology", - "documented": true, - "kind": "class", - "line": 312, - "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" - }, - { - "symbol": "SYS_SAGE_COMPONENT_NONE", - "documented": false, - "kind": "define", - "line": 13, - "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" - }, - { - "symbol": "SYS_SAGE_COMPONENT_THREAD", - "documented": false, - "kind": "define", - "line": 14, - "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" - }, - { - "symbol": "SYS_SAGE_COMPONENT_CORE", - "documented": false, - "kind": "define", - "line": 15, - "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" - }, - { - "symbol": "SYS_SAGE_COMPONENT_CACHE", - "documented": false, - "kind": "define", - "line": 16, - "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" - }, - { - "symbol": "SYS_SAGE_COMPONENT_SUBDIVISION", - "documented": false, - "kind": "define", - "line": 17, - "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" - }, - { - "symbol": "SYS_SAGE_COMPONENT_NUMA", - "documented": false, - "kind": "define", - "line": 18, - "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" - }, - { - "symbol": "SYS_SAGE_COMPONENT_CHIP", - "documented": false, - "kind": "define", - "line": 19, - "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" - }, - { - "symbol": "SYS_SAGE_COMPONENT_MEMORY", - "documented": false, - "kind": "define", - "line": 20, - "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" - }, - { - "symbol": "SYS_SAGE_COMPONENT_STORAGE", - "documented": false, - "kind": "define", - "line": 21, - "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" - }, - { - "symbol": "SYS_SAGE_COMPONENT_NODE", - "documented": false, - "kind": "define", - "line": 22, - "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" - }, - { - "symbol": "SYS_SAGE_COMPONENT_TOPOLOGY", - "documented": false, - "kind": "define", - "line": 23, - "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" - }, - { - "symbol": "SYS_SAGE_SUBDIVISION_TYPE_NONE", - "documented": false, - "kind": "define", - "line": 25, - "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" - }, - { - "symbol": "SYS_SAGE_SUBDIVISION_TYPE_GPU_SM", - "documented": false, - "kind": "define", - "line": 26, - "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" - }, - { - "symbol": "SYS_SAGE_CHIP_TYPE_NONE", - "documented": false, - "kind": "define", - "line": 28, - "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" - }, - { - "symbol": "SYS_SAGE_CHIP_TYPE_CPU", - "documented": false, - "kind": "define", - "line": 29, - "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" - }, - { - "symbol": "SYS_SAGE_CHIP_TYPE_CPU_SOCKET", - "documented": false, - "kind": "define", - "line": 30, - "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" - }, - { - "symbol": "SYS_SAGE_CHIP_TYPE_GPU", - "documented": false, - "kind": "define", - "line": 31, - "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" - }, - { - "symbol": "Topology.hpp", - "documented": false, - "kind": "file", - "line": 1, - "file": "/Users/jim/tum/sys-sage/src/Topology.hpp" - } - ], - "/Users/jim/tum/sys-sage/src/parsers/caps-numa-benchmark.hpp": [ - { - "symbol": "std::string CSVReader::benchmarkPath", - "documented": false, - "kind": "variable", - "line": 11, - "file": "/Users/jim/tum/sys-sage/src/parsers/caps-numa-benchmark.hpp" - }, - { - "symbol": "std::string CSVReader::delimiter", - "documented": false, - "kind": "variable", - "line": 12, - "file": "/Users/jim/tum/sys-sage/src/parsers/caps-numa-benchmark.hpp" - }, - { - "symbol": "CSVReader::CSVReader", - "documented": false, - "kind": "function", - "line": 14, - "file": "/Users/jim/tum/sys-sage/src/parsers/caps-numa-benchmark.hpp" - }, - { - "symbol": "int CSVReader::getData", - "documented": false, - "kind": "function", - "line": 16, - "file": "/Users/jim/tum/sys-sage/src/parsers/caps-numa-benchmark.hpp" - }, - { - "symbol": "CSVReader", - "documented": false, - "kind": "class", - "line": 9, - "file": "/Users/jim/tum/sys-sage/src/parsers/caps-numa-benchmark.hpp" - }, - { - "symbol": "int parseCapsNumaBenchmark", - "documented": false, - "kind": "function", - "line": 7, - "file": "/Users/jim/tum/sys-sage/src/parsers/caps-numa-benchmark.hpp" - }, - { - "symbol": "caps-numa-benchmark.hpp", - "documented": false, - "kind": "file", - "line": 1, - "file": "/Users/jim/tum/sys-sage/src/parsers/caps-numa-benchmark.hpp" - } - ], - "/Users/jim/tum/sys-sage/src/DataPath.hpp": [ - { - "symbol": "map DataPath::attrib", - "documented": false, - "kind": "variable", - "line": 108, - "file": "/Users/jim/tum/sys-sage/src/DataPath.hpp" - }, - { - "symbol": "Component* DataPath::source", - "documented": false, - "kind": "variable", - "line": 110, - "file": "/Users/jim/tum/sys-sage/src/DataPath.hpp" - }, - { - "symbol": "Component* DataPath::target", - "documented": false, - "kind": "variable", - "line": 111, - "file": "/Users/jim/tum/sys-sage/src/DataPath.hpp" - }, - { - "symbol": "const int DataPath::oriented", - "documented": false, - "kind": "variable", - "line": 113, - "file": "/Users/jim/tum/sys-sage/src/DataPath.hpp" - }, - { - "symbol": "const int DataPath::dp_type", - "documented": true, - "kind": "variable", - "line": 114, - "file": "/Users/jim/tum/sys-sage/src/DataPath.hpp" - }, - { - "symbol": "double DataPath::bw", - "documented": false, - "kind": "variable", - "line": 116, - "file": "/Users/jim/tum/sys-sage/src/DataPath.hpp" - }, - { - "symbol": "double DataPath::latency", - "documented": false, - "kind": "variable", - "line": 117, - "file": "/Users/jim/tum/sys-sage/src/DataPath.hpp" - }, - { - "symbol": "DataPath::DataPath", - "documented": true, - "kind": "function", - "line": 58, - "file": "/Users/jim/tum/sys-sage/src/DataPath.hpp" - }, - { - "symbol": "DataPath::DataPath", - "documented": true, - "kind": "function", - "line": 67, - "file": "/Users/jim/tum/sys-sage/src/DataPath.hpp" - }, - { - "symbol": "DataPath::DataPath", - "documented": true, - "kind": "function", - "line": 78, - "file": "/Users/jim/tum/sys-sage/src/DataPath.hpp" - }, - { - "symbol": "Component * DataPath::GetSource", - "documented": true, - "kind": "function", - "line": 83, - "file": "/Users/jim/tum/sys-sage/src/DataPath.hpp" - }, - { - "symbol": "Component * DataPath::GetTarget", - "documented": true, - "kind": "function", - "line": 87, - "file": "/Users/jim/tum/sys-sage/src/DataPath.hpp" - }, - { - "symbol": "double DataPath::GetBw", - "documented": true, - "kind": "function", - "line": 91, - "file": "/Users/jim/tum/sys-sage/src/DataPath.hpp" - }, - { - "symbol": "double DataPath::GetLatency", - "documented": true, - "kind": "function", - "line": 95, - "file": "/Users/jim/tum/sys-sage/src/DataPath.hpp" - }, - { - "symbol": "int DataPath::GetDpType", - "documented": true, - "kind": "function", - "line": 100, - "file": "/Users/jim/tum/sys-sage/src/DataPath.hpp" - }, - { - "symbol": "int DataPath::GetOriented", - "documented": false, - "kind": "function", - "line": 101, - "file": "/Users/jim/tum/sys-sage/src/DataPath.hpp" - }, - { - "symbol": "void DataPath::Print", - "documented": true, - "kind": "function", - "line": 106, - "file": "/Users/jim/tum/sys-sage/src/DataPath.hpp" - }, - { - "symbol": "DataPath", - "documented": true, - "kind": "class", - "line": 47, - "file": "/Users/jim/tum/sys-sage/src/DataPath.hpp" - }, - { - "symbol": "std", - "documented": false, - "kind": "namespace", - "line": 22, - "file": "/Users/jim/tum/sys-sage/src/DataPath.hpp" - }, - { - "symbol": "SYS_SAGE_DATAPATH_NONE", - "documented": false, - "kind": "define", - "line": 8, - "file": "/Users/jim/tum/sys-sage/src/DataPath.hpp" - }, - { - "symbol": "SYS_SAGE_DATAPATH_OUTGOING", - "documented": false, - "kind": "define", - "line": 9, - "file": "/Users/jim/tum/sys-sage/src/DataPath.hpp" - }, - { - "symbol": "SYS_SAGE_DATAPATH_INCOMING", - "documented": false, - "kind": "define", - "line": 10, - "file": "/Users/jim/tum/sys-sage/src/DataPath.hpp" - }, - { - "symbol": "SYS_SAGE_DATAPATH_BIDIRECTIONAL", - "documented": false, - "kind": "define", - "line": 13, - "file": "/Users/jim/tum/sys-sage/src/DataPath.hpp" - }, - { - "symbol": "SYS_SAGE_DATAPATH_ORIENTED", - "documented": false, - "kind": "define", - "line": 14, - "file": "/Users/jim/tum/sys-sage/src/DataPath.hpp" - }, - { - "symbol": "SYS_SAGE_DATAPATH_TYPE_NONE", - "documented": false, - "kind": "define", - "line": 17, - "file": "/Users/jim/tum/sys-sage/src/DataPath.hpp" - }, - { - "symbol": "SYS_SAGE_DATAPATH_TYPE_LOGICAL", - "documented": false, - "kind": "define", - "line": 18, - "file": "/Users/jim/tum/sys-sage/src/DataPath.hpp" - }, - { - "symbol": "SYS_SAGE_DATAPATH_TYPE_PHYSICAL", - "documented": false, - "kind": "define", - "line": 19, - "file": "/Users/jim/tum/sys-sage/src/DataPath.hpp" - }, - { - "symbol": "SYS_SAGE_DATAPATH_TYPE_L3CAT", - "documented": false, - "kind": "define", - "line": 20, - "file": "/Users/jim/tum/sys-sage/src/DataPath.hpp" - }, - { - "symbol": "DataPath * NewDataPath", - "documented": true, - "kind": "function", - "line": 30, - "file": "/Users/jim/tum/sys-sage/src/DataPath.hpp" - }, - { - "symbol": "DataPath * NewDataPath", - "documented": true, - "kind": "function", - "line": 35, - "file": "/Users/jim/tum/sys-sage/src/DataPath.hpp" - }, - { - "symbol": "DataPath * NewDataPath", - "documented": true, - "kind": "function", - "line": 40, - "file": "/Users/jim/tum/sys-sage/src/DataPath.hpp" - }, - { - "symbol": "DataPath.hpp", - "documented": false, - "kind": "file", - "line": 1, - "file": "/Users/jim/tum/sys-sage/src/DataPath.hpp" - } - ], - "/Users/jim/tum/sys-sage/src/parsers/gpu-topo.hpp": [ - { - "symbol": "map > GpuTopo::benchmarkData", - "documented": false, - "kind": "variable", - "line": 18, - "file": "/Users/jim/tum/sys-sage/src/parsers/gpu-topo.hpp" - }, - { - "symbol": "string GpuTopo::dataSourcePath", - "documented": false, - "kind": "variable", - "line": 19, - "file": "/Users/jim/tum/sys-sage/src/parsers/gpu-topo.hpp" - }, - { - "symbol": "string GpuTopo::delim", - "documented": false, - "kind": "variable", - "line": 20, - "file": "/Users/jim/tum/sys-sage/src/parsers/gpu-topo.hpp" - }, - { - "symbol": "Chip* GpuTopo::root", - "documented": false, - "kind": "variable", - "line": 21, - "file": "/Users/jim/tum/sys-sage/src/parsers/gpu-topo.hpp" - }, - { - "symbol": "bool GpuTopo::L2_shared_on_gpu", - "documented": false, - "kind": "variable", - "line": 22, - "file": "/Users/jim/tum/sys-sage/src/parsers/gpu-topo.hpp" - }, - { - "symbol": "double GpuTopo::Memory_Clock_Frequency", - "documented": false, - "kind": "variable", - "line": 23, - "file": "/Users/jim/tum/sys-sage/src/parsers/gpu-topo.hpp" - }, - { - "symbol": "int GpuTopo::Memory_Bus_Width", - "documented": false, - "kind": "variable", - "line": 24, - "file": "/Users/jim/tum/sys-sage/src/parsers/gpu-topo.hpp" - }, - { - "symbol": "GpuTopo::GpuTopo", - "documented": false, - "kind": "function", - "line": 13, - "file": "/Users/jim/tum/sys-sage/src/parsers/gpu-topo.hpp" - }, - { - "symbol": "int GpuTopo::ParseBenchmarkData", - "documented": false, - "kind": "function", - "line": 15, - "file": "/Users/jim/tum/sys-sage/src/parsers/gpu-topo.hpp" - }, - { - "symbol": "int GpuTopo::ReadBenchmarkFile", - "documented": false, - "kind": "function", - "line": 17, - "file": "/Users/jim/tum/sys-sage/src/parsers/gpu-topo.hpp" - }, - { - "symbol": "int GpuTopo::parseGPU_INFORMATION", - "documented": false, - "kind": "function", - "line": 26, - "file": "/Users/jim/tum/sys-sage/src/parsers/gpu-topo.hpp" - }, - { - "symbol": "int GpuTopo::parseCOMPUTE_RESOURCE_INFORMATION", - "documented": false, - "kind": "function", - "line": 27, - "file": "/Users/jim/tum/sys-sage/src/parsers/gpu-topo.hpp" - }, - { - "symbol": "int GpuTopo::parseREGISTER_INFORMATION", - "documented": false, - "kind": "function", - "line": 28, - "file": "/Users/jim/tum/sys-sage/src/parsers/gpu-topo.hpp" - }, - { - "symbol": "int GpuTopo::parseADDITIONAL_INFORMATION", - "documented": false, - "kind": "function", - "line": 29, - "file": "/Users/jim/tum/sys-sage/src/parsers/gpu-topo.hpp" - }, - { - "symbol": "int GpuTopo::parseMAIN_MEMORY", - "documented": false, - "kind": "function", - "line": 30, - "file": "/Users/jim/tum/sys-sage/src/parsers/gpu-topo.hpp" - }, - { - "symbol": "int GpuTopo::parseCaches", - "documented": false, - "kind": "function", - "line": 31, - "file": "/Users/jim/tum/sys-sage/src/parsers/gpu-topo.hpp" - }, - { - "symbol": "GpuTopo", - "documented": false, - "kind": "class", - "line": 10, - "file": "/Users/jim/tum/sys-sage/src/parsers/gpu-topo.hpp" - }, - { - "symbol": "int parseGpuTopo", - "documented": false, - "kind": "function", - "line": 7, - "file": "/Users/jim/tum/sys-sage/src/parsers/gpu-topo.hpp" - }, - { - "symbol": "int parseGpuTopo", - "documented": false, - "kind": "function", - "line": 8, - "file": "/Users/jim/tum/sys-sage/src/parsers/gpu-topo.hpp" - }, - { - "symbol": "const std::string whiteSpaces", - "documented": false, - "kind": "function", - "line": 34, - "file": "/Users/jim/tum/sys-sage/src/parsers/gpu-topo.hpp" - }, - { - "symbol": "void trimRight", - "documented": false, - "kind": "function", - "line": 35, - "file": "/Users/jim/tum/sys-sage/src/parsers/gpu-topo.hpp" - }, - { - "symbol": "void trimLeft", - "documented": false, - "kind": "function", - "line": 36, - "file": "/Users/jim/tum/sys-sage/src/parsers/gpu-topo.hpp" - }, - { - "symbol": "void trim", - "documented": false, - "kind": "function", - "line": 37, - "file": "/Users/jim/tum/sys-sage/src/parsers/gpu-topo.hpp" - }, - { - "symbol": "gpu-topo.hpp", - "documented": false, - "kind": "file", - "line": 1, - "file": "/Users/jim/tum/sys-sage/src/parsers/gpu-topo.hpp" - } - ], - "/Users/jim/tum/sys-sage/examples/custom_attributes.cpp": [ - { - "symbol": "double My_core_attributes::temperature", - "documented": false, - "kind": "variable", - "line": 8, - "file": "/Users/jim/tum/sys-sage/examples/custom_attributes.cpp" - }, - { - "symbol": "int My_core_attributes::frequency", - "documented": false, - "kind": "variable", - "line": 9, - "file": "/Users/jim/tum/sys-sage/examples/custom_attributes.cpp" - }, - { - "symbol": "My_core_attributes::My_core_attributes", - "documented": false, - "kind": "function", - "line": 7, - "file": "/Users/jim/tum/sys-sage/examples/custom_attributes.cpp" - }, - { - "symbol": "My_core_attributes", - "documented": false, - "kind": "class", - "line": 5, - "file": "/Users/jim/tum/sys-sage/examples/custom_attributes.cpp" - }, - { - "symbol": "int print_my_attribs", - "documented": false, - "kind": "function", - "line": 14, - "file": "/Users/jim/tum/sys-sage/examples/custom_attributes.cpp" - }, - { - "symbol": "int print_my_custom_attribs", - "documented": false, - "kind": "function", - "line": 30, - "file": "/Users/jim/tum/sys-sage/examples/custom_attributes.cpp" - }, - { - "symbol": "void usage", - "documented": false, - "kind": "function", - "line": 50, - "file": "/Users/jim/tum/sys-sage/examples/custom_attributes.cpp" - }, - { - "symbol": "int main", - "documented": false, - "kind": "function", - "line": 58, - "file": "/Users/jim/tum/sys-sage/examples/custom_attributes.cpp" - }, - { - "symbol": "custom_attributes.cpp", - "documented": false, - "kind": "file", - "line": 1, - "file": "/Users/jim/tum/sys-sage/examples/custom_attributes.cpp" - } - ], - "/Users/jim/tum/sys-sage/data-sources/caps-numa-benchmark.cpp": [ - { - "symbol": "long long numa_region::numa_mem_sz", - "documented": false, - "kind": "variable", - "line": 32, - "file": "/Users/jim/tum/sys-sage/data-sources/caps-numa-benchmark.cpp" - }, - { - "symbol": "long long numa_region::arrsz", - "documented": false, - "kind": "variable", - "line": 33, - "file": "/Users/jim/tum/sys-sage/data-sources/caps-numa-benchmark.cpp" - }, - { - "symbol": "int numa_region::step", - "documented": false, - "kind": "variable", - "line": 34, - "file": "/Users/jim/tum/sys-sage/data-sources/caps-numa-benchmark.cpp" - }, - { - "symbol": "int numa_region::num_elems", - "documented": false, - "kind": "variable", - "line": 35, - "file": "/Users/jim/tum/sys-sage/data-sources/caps-numa-benchmark.cpp" - }, - { - "symbol": "uint64_t numa_region::timer_overhead", - "documented": false, - "kind": "variable", - "line": 37, - "file": "/Users/jim/tum/sys-sage/data-sources/caps-numa-benchmark.cpp" - }, - { - "symbol": "uint64_t numa_region::latency_time", - "documented": false, - "kind": "variable", - "line": 39, - "file": "/Users/jim/tum/sys-sage/data-sources/caps-numa-benchmark.cpp" - }, - { - "symbol": "uint64_t numa_region::bw_time", - "documented": false, - "kind": "variable", - "line": 40, - "file": "/Users/jim/tum/sys-sage/data-sources/caps-numa-benchmark.cpp" - }, - { - "symbol": "numa_region", - "documented": false, - "kind": "struct", - "line": 30, - "file": "/Users/jim/tum/sys-sage/data-sources/caps-numa-benchmark.cpp" - }, - { - "symbol": "REPEATS", - "documented": false, - "kind": "define", - "line": 18, - "file": "/Users/jim/tum/sys-sage/data-sources/caps-numa-benchmark.cpp" - }, - { - "symbol": "LATENCY_REPEATS", - "documented": false, - "kind": "define", - "line": 19, - "file": "/Users/jim/tum/sys-sage/data-sources/caps-numa-benchmark.cpp" - }, - { - "symbol": "MAIN_MEM_FRACTION", - "documented": false, - "kind": "define", - "line": 20, - "file": "/Users/jim/tum/sys-sage/data-sources/caps-numa-benchmark.cpp" - }, - { - "symbol": "CACHE_LINE_SZ", - "documented": false, - "kind": "define", - "line": 21, - "file": "/Users/jim/tum/sys-sage/data-sources/caps-numa-benchmark.cpp" - }, - { - "symbol": "TIMER_WARMUP", - "documented": false, - "kind": "define", - "line": 22, - "file": "/Users/jim/tum/sys-sage/data-sources/caps-numa-benchmark.cpp" - }, - { - "symbol": "TIMER_REPEATS", - "documented": false, - "kind": "define", - "line": 23, - "file": "/Users/jim/tum/sys-sage/data-sources/caps-numa-benchmark.cpp" - }, - { - "symbol": "errExit", - "documented": false, - "kind": "define", - "line": 28, - "file": "/Users/jim/tum/sys-sage/data-sources/caps-numa-benchmark.cpp" - }, - { - "symbol": "void fill_arr", - "documented": false, - "kind": "function", - "line": 43, - "file": "/Users/jim/tum/sys-sage/data-sources/caps-numa-benchmark.cpp" - }, - { - "symbol": "uint64_t get_timer_overhead", - "documented": false, - "kind": "function", - "line": 51, - "file": "/Users/jim/tum/sys-sage/data-sources/caps-numa-benchmark.cpp" - }, - { - "symbol": "int run_measurement", - "documented": false, - "kind": "function", - "line": 77, - "file": "/Users/jim/tum/sys-sage/data-sources/caps-numa-benchmark.cpp" - }, - { - "symbol": "int main", - "documented": false, - "kind": "function", - "line": 161, - "file": "/Users/jim/tum/sys-sage/data-sources/caps-numa-benchmark.cpp" - }, - { - "symbol": "caps-numa-benchmark.cpp", - "documented": false, - "kind": "file", - "line": 1, - "file": "/Users/jim/tum/sys-sage/data-sources/caps-numa-benchmark.cpp" - } - ], - "/Users/jim/tum/sys-sage/examples/matmul.cpp": [ - { - "symbol": "std::chrono", - "documented": false, - "kind": "namespace", - "line": 30, - "file": "/Users/jim/tum/sys-sage/examples/matmul.cpp" - }, - { - "symbol": "TIMER_WARMUP", - "documented": true, - "kind": "define", - "line": 24, - "file": "/Users/jim/tum/sys-sage/examples/matmul.cpp" - }, - { - "symbol": "TIMER_REPEATS", - "documented": false, - "kind": "define", - "line": 25, - "file": "/Users/jim/tum/sys-sage/examples/matmul.cpp" - }, - { - "symbol": "double* A", - "documented": false, - "kind": "variable", - "line": 35, - "file": "/Users/jim/tum/sys-sage/examples/matmul.cpp" - }, - { - "symbol": "double* B", - "documented": false, - "kind": "variable", - "line": 36, - "file": "/Users/jim/tum/sys-sage/examples/matmul.cpp" - }, - { - "symbol": "double* C", - "documented": false, - "kind": "variable", - "line": 37, - "file": "/Users/jim/tum/sys-sage/examples/matmul.cpp" - }, - { - "symbol": "int hwloc_dump_xml", - "documented": false, - "kind": "function", - "line": 214, - "file": "/Users/jim/tum/sys-sage/examples/matmul.cpp" - }, - { - "symbol": "uint64_t get_timer_overhead", - "documented": false, - "kind": "function", - "line": 188, - "file": "/Users/jim/tum/sys-sage/examples/matmul.cpp" - }, - { - "symbol": "void fill_matrices", - "documented": false, - "kind": "function", - "line": 39, - "file": "/Users/jim/tum/sys-sage/examples/matmul.cpp" - }, - { - "symbol": "void print_matrix", - "documented": false, - "kind": "function", - "line": 54, - "file": "/Users/jim/tum/sys-sage/examples/matmul.cpp" - }, - { - "symbol": "int main", - "documented": false, - "kind": "function", - "line": 67, - "file": "/Users/jim/tum/sys-sage/examples/matmul.cpp" - }, - { - "symbol": "matmul.cpp", - "documented": false, - "kind": "file", - "line": 1, - "file": "/Users/jim/tum/sys-sage/examples/matmul.cpp" - } - ], - "/Users/jim/tum/sys-sage/data-sources/hwloc-output.cpp": [ - { - "symbol": "int hwloc_dump_xml", - "documented": false, - "kind": "function", - "line": 27, - "file": "/Users/jim/tum/sys-sage/data-sources/hwloc-output.cpp" - }, - { - "symbol": "int main", - "documented": true, - "kind": "function", - "line": 16, - "file": "/Users/jim/tum/sys-sage/data-sources/hwloc-output.cpp" - }, - { - "symbol": "hwloc-output.cpp", - "documented": false, - "kind": "file", - "line": 1, - "file": "/Users/jim/tum/sys-sage/data-sources/hwloc-output.cpp" - } - ], - "/Users/jim/tum/sys-sage/data-sources/README.md": [ - { - "symbol": "README.md", - "documented": false, - "kind": "file", - "line": 1, - "file": "/Users/jim/tum/sys-sage/data-sources/README.md" - }, - { - "symbol": "md__Users_jim_tum_sys_sage_data_sources_README", - "documented": true, - "kind": "page", - "line": 1, - "file": "/Users/jim/tum/sys-sage/data-sources/README.md" - } - ], - "/Users/jim/tum/sys-sage/src/Concept.md": [ - { - "symbol": "Concept.md", - "documented": false, - "kind": "file", - "line": 1, - "file": "/Users/jim/tum/sys-sage/src/Concept.md" - }, - { - "symbol": "md_Concept", - "documented": true, - "kind": "page", - "line": 1, - "file": "/Users/jim/tum/sys-sage/src/Concept.md" - } - ], - "/Users/jim/tum/sys-sage/src/index.md": [ - { - "symbol": "index.md", - "documented": false, - "kind": "file", - "line": 1, - "file": "/Users/jim/tum/sys-sage/src/index.md" - }, - { - "symbol": "index", - "documented": true, - "kind": "page", - "line": 1, - "file": "/Users/jim/tum/sys-sage/src/index.md" - } - ], - "/Users/jim/tum/sys-sage/src/Installation_Guide.md": [ - { - "symbol": "Installation_Guide.md", - "documented": false, - "kind": "file", - "line": 1, - "file": "/Users/jim/tum/sys-sage/src/Installation_Guide.md" - }, - { - "symbol": "md_Installation_Guide", - "documented": true, - "kind": "page", - "line": 1, - "file": "/Users/jim/tum/sys-sage/src/Installation_Guide.md" - } - ], - "/Users/jim/tum/sys-sage/examples/basic_usage.cpp": [ - { - "symbol": "void usage", - "documented": false, - "kind": "function", - "line": 6, - "file": "/Users/jim/tum/sys-sage/examples/basic_usage.cpp" - }, - { - "symbol": "int main", - "documented": false, - "kind": "function", - "line": 14, - "file": "/Users/jim/tum/sys-sage/examples/basic_usage.cpp" - }, - { - "symbol": "basic_usage.cpp", - "documented": false, - "kind": "file", - "line": 1, - "file": "/Users/jim/tum/sys-sage/examples/basic_usage.cpp" - } - ], - "/Users/jim/tum/sys-sage/examples/cpu-frequency.cpp": [ - { - "symbol": "void usage", - "documented": false, - "kind": "function", - "line": 8, - "file": "/Users/jim/tum/sys-sage/examples/cpu-frequency.cpp" - }, - { - "symbol": "int main", - "documented": false, - "kind": "function", - "line": 14, - "file": "/Users/jim/tum/sys-sage/examples/cpu-frequency.cpp" - }, - { - "symbol": "cpu-frequency.cpp", - "documented": false, - "kind": "file", - "line": 1, - "file": "/Users/jim/tum/sys-sage/examples/cpu-frequency.cpp" - } - ], - "/Users/jim/tum/sys-sage/examples/gpu-topo-parser.cpp": [ - { - "symbol": "void usage", - "documented": false, - "kind": "function", - "line": 6, - "file": "/Users/jim/tum/sys-sage/examples/gpu-topo-parser.cpp" - }, - { - "symbol": "int main", - "documented": false, - "kind": "function", - "line": 14, - "file": "/Users/jim/tum/sys-sage/examples/gpu-topo-parser.cpp" - }, - { - "symbol": "gpu-topo-parser.cpp", - "documented": false, - "kind": "file", - "line": 1, - "file": "/Users/jim/tum/sys-sage/examples/gpu-topo-parser.cpp" - } - ], - "/Users/jim/tum/sys-sage/examples/larger_topo.cpp": [ - { - "symbol": "int main", - "documented": false, - "kind": "function", - "line": 9, - "file": "/Users/jim/tum/sys-sage/examples/larger_topo.cpp" - }, - { - "symbol": "larger_topo.cpp", - "documented": false, - "kind": "file", - "line": 1, - "file": "/Users/jim/tum/sys-sage/examples/larger_topo.cpp" - } - ], - "/Users/jim/tum/sys-sage/examples/sys-sage-benchmarking.cpp": [ - { - "symbol": "TIMER_WARMUP", - "documented": false, - "kind": "define", - "line": 11, - "file": "/Users/jim/tum/sys-sage/examples/sys-sage-benchmarking.cpp" - }, - { - "symbol": "TIMER_REPEATS", - "documented": false, - "kind": "define", - "line": 12, - "file": "/Users/jim/tum/sys-sage/examples/sys-sage-benchmarking.cpp" - }, - { - "symbol": "uint64_t get_timer_overhead", - "documented": false, - "kind": "function", - "line": 161, - "file": "/Users/jim/tum/sys-sage/examples/sys-sage-benchmarking.cpp" - }, - { - "symbol": "int main", - "documented": false, - "kind": "function", - "line": 23, - "file": "/Users/jim/tum/sys-sage/examples/sys-sage-benchmarking.cpp" - }, - { - "symbol": "sys-sage-benchmarking.cpp", - "documented": false, - "kind": "file", - "line": 1, - "file": "/Users/jim/tum/sys-sage/examples/sys-sage-benchmarking.cpp" - } - ], - "/Users/jim/tum/sys-sage/src/CAT_aware.cpp": [ - { - "symbol": "CAT_aware.cpp", - "documented": false, - "kind": "file", - "line": 1, - "file": "/Users/jim/tum/sys-sage/src/CAT_aware.cpp" - } - ], - "/Users/jim/tum/sys-sage/src/cpuinfo.cpp": [ - { - "symbol": "cpuinfo.cpp", - "documented": false, - "kind": "file", - "line": 1, - "file": "/Users/jim/tum/sys-sage/src/cpuinfo.cpp" - } - ], - "/Users/jim/tum/sys-sage/src/DataPath.cpp": [ - { - "symbol": "DataPath * NewDataPath", - "documented": true, - "kind": "function", - "line": 3, - "file": "/Users/jim/tum/sys-sage/src/DataPath.cpp" - }, - { - "symbol": "DataPath * NewDataPath", - "documented": true, - "kind": "function", - "line": 6, - "file": "/Users/jim/tum/sys-sage/src/DataPath.cpp" - }, - { - "symbol": "DataPath * NewDataPath", - "documented": true, - "kind": "function", - "line": 9, - "file": "/Users/jim/tum/sys-sage/src/DataPath.cpp" - }, - { - "symbol": "DataPath.cpp", - "documented": false, - "kind": "file", - "line": 1, - "file": "/Users/jim/tum/sys-sage/src/DataPath.cpp" - } - ], - "/Users/jim/tum/sys-sage/src/parsers/caps-numa-benchmark.cpp": [ - { - "symbol": "int parseCapsNumaBenchmark", - "documented": false, - "kind": "function", - "line": 10, - "file": "/Users/jim/tum/sys-sage/src/parsers/caps-numa-benchmark.cpp" - }, - { - "symbol": "caps-numa-benchmark.cpp", - "documented": false, - "kind": "file", - "line": 1, - "file": "/Users/jim/tum/sys-sage/src/parsers/caps-numa-benchmark.cpp" - } - ], - "/Users/jim/tum/sys-sage/src/parsers/gpu-topo.cpp": [ - { - "symbol": "int parseGpuTopo", - "documented": false, - "kind": "function", - "line": 13, - "file": "/Users/jim/tum/sys-sage/src/parsers/gpu-topo.cpp" - }, - { - "symbol": "int parseGpuTopo", - "documented": false, - "kind": "function", - "line": 24, - "file": "/Users/jim/tum/sys-sage/src/parsers/gpu-topo.cpp" - }, - { - "symbol": "void trimRight", - "documented": false, - "kind": "function", - "line": 687, - "file": "/Users/jim/tum/sys-sage/src/parsers/gpu-topo.cpp" - }, - { - "symbol": "void trimLeft", - "documented": false, - "kind": "function", - "line": 693, - "file": "/Users/jim/tum/sys-sage/src/parsers/gpu-topo.cpp" - }, - { - "symbol": "void trim", - "documented": false, - "kind": "function", - "line": 699, - "file": "/Users/jim/tum/sys-sage/src/parsers/gpu-topo.cpp" - }, - { - "symbol": "gpu-topo.cpp", - "documented": false, - "kind": "file", - "line": 1, - "file": "/Users/jim/tum/sys-sage/src/parsers/gpu-topo.cpp" - } - ], - "/Users/jim/tum/sys-sage/src/parsers/hwloc.cpp": [ - { - "symbol": "vector xmlRelevantNames", - "documented": true, - "kind": "variable", - "line": 9, - "file": "/Users/jim/tum/sys-sage/src/parsers/hwloc.cpp" - }, - { - "symbol": "vector xmlRelevantObjectTypes", - "documented": true, - "kind": "variable", - "line": 16, - "file": "/Users/jim/tum/sys-sage/src/parsers/hwloc.cpp" - }, - { - "symbol": "string xmlGetPropStr", - "documented": false, - "kind": "function", - "line": 33, - "file": "/Users/jim/tum/sys-sage/src/parsers/hwloc.cpp" - }, - { - "symbol": "Component * createChildC", - "documented": false, - "kind": "function", - "line": 45, - "file": "/Users/jim/tum/sys-sage/src/parsers/hwloc.cpp" - }, - { - "symbol": "int xmlProcessChildren", - "documented": false, - "kind": "function", - "line": 101, - "file": "/Users/jim/tum/sys-sage/src/parsers/hwloc.cpp" - }, - { - "symbol": "int removeUnknownCompoents", - "documented": false, - "kind": "function", - "line": 191, - "file": "/Users/jim/tum/sys-sage/src/parsers/hwloc.cpp" - }, - { - "symbol": "int parseHwlocOutput", - "documented": false, - "kind": "function", - "line": 225, - "file": "/Users/jim/tum/sys-sage/src/parsers/hwloc.cpp" - }, - { - "symbol": "hwloc.cpp", - "documented": false, - "kind": "file", - "line": 1, - "file": "/Users/jim/tum/sys-sage/src/parsers/hwloc.cpp" - } - ], - "/Users/jim/tum/sys-sage/src/parsers/hwloc.hpp": [ - { - "symbol": "std::vector xmlRelevantNames", - "documented": true, - "kind": "variable", - "line": 30, - "file": "/Users/jim/tum/sys-sage/src/parsers/hwloc.hpp" - }, - { - "symbol": "std::vector xmlRelevantObjectTypes", - "documented": true, - "kind": "variable", - "line": 34, - "file": "/Users/jim/tum/sys-sage/src/parsers/hwloc.hpp" - }, - { - "symbol": "int parseHwlocOutput", - "documented": true, - "kind": "function", - "line": 19, - "file": "/Users/jim/tum/sys-sage/src/parsers/hwloc.hpp" - }, - { - "symbol": "int xmlProcessChildren", - "documented": false, - "kind": "function", - "line": 21, - "file": "/Users/jim/tum/sys-sage/src/parsers/hwloc.hpp" - }, - { - "symbol": "Component * createChildC", - "documented": false, - "kind": "function", - "line": 23, - "file": "/Users/jim/tum/sys-sage/src/parsers/hwloc.hpp" - }, - { - "symbol": "std::string xmlGetPropStr", - "documented": false, - "kind": "function", - "line": 25, - "file": "/Users/jim/tum/sys-sage/src/parsers/hwloc.hpp" - }, - { - "symbol": "hwloc.hpp", - "documented": false, - "kind": "file", - "line": 1, - "file": "/Users/jim/tum/sys-sage/src/parsers/hwloc.hpp" - } - ], - "/Users/jim/tum/sys-sage/src/sys-sage.hpp": [ - { - "symbol": "sys-sage.hpp", - "documented": false, - "kind": "file", - "line": 1, - "file": "/Users/jim/tum/sys-sage/src/sys-sage.hpp" - } - ], - "/Users/jim/tum/sys-sage/src/Topology.cpp": [ - { - "symbol": "Topology.cpp", - "documented": false, - "kind": "file", - "line": 1, - "file": "/Users/jim/tum/sys-sage/src/Topology.cpp" - } - ], - "/Users/jim/tum/sys-sage/src/xml_dump.cpp": [ - { - "symbol": "std::function search_custom_attrib_key_fcn", - "documented": false, - "kind": "variable", - "line": 6, - "file": "/Users/jim/tum/sys-sage/src/xml_dump.cpp" - }, - { - "symbol": "std::function search_custom_complex_attrib_key_fcn", - "documented": false, - "kind": "variable", - "line": 7, - "file": "/Users/jim/tum/sys-sage/src/xml_dump.cpp" - }, - { - "symbol": "int search_default_attrib_key", - "documented": false, - "kind": "function", - "line": 10, - "file": "/Users/jim/tum/sys-sage/src/xml_dump.cpp" - }, - { - "symbol": "int search_default_complex_attrib_key", - "documented": false, - "kind": "function", - "line": 36, - "file": "/Users/jim/tum/sys-sage/src/xml_dump.cpp" - }, - { - "symbol": "int print_attrib", - "documented": false, - "kind": "function", - "line": 74, - "file": "/Users/jim/tum/sys-sage/src/xml_dump.cpp" - }, - { - "symbol": "int exportToXml", - "documented": true, - "kind": "function", - "line": 203, - "file": "/Users/jim/tum/sys-sage/src/xml_dump.cpp" - }, - { - "symbol": "xml_dump.cpp", - "documented": false, - "kind": "file", - "line": 1, - "file": "/Users/jim/tum/sys-sage/src/xml_dump.cpp" - } - ], - "/Users/jim/tum/sys-sage/src/xml_dump.hpp": [ - { - "symbol": "int exportToXml", - "documented": true, - "kind": "function", - "line": 12, - "file": "/Users/jim/tum/sys-sage/src/xml_dump.hpp" - }, - { - "symbol": "int search_default_attrib_key", - "documented": false, - "kind": "function", - "line": 13, - "file": "/Users/jim/tum/sys-sage/src/xml_dump.hpp" - }, - { - "symbol": "int print_attrib", - "documented": false, - "kind": "function", - "line": 15, - "file": "/Users/jim/tum/sys-sage/src/xml_dump.hpp" - }, - { - "symbol": "xml_dump.hpp", - "documented": false, - "kind": "file", - "line": 1, - "file": "/Users/jim/tum/sys-sage/src/xml_dump.hpp" - } - ] - } -} \ No newline at end of file From 212f943a823fde52f25feef6870e69560b9d0b4c Mon Sep 17 00:00:00 2001 From: Stepan Vanecek Date: Mon, 18 Dec 2023 17:48:01 +0100 Subject: [PATCH 101/102] fix hwloc ds -- print to buffer and to a file --- CMakeLists.txt | 1 - data-sources/CMakeLists.txt | 4 +++- data-sources/hwloc-output.cpp | 14 ++++++++------ 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index f81f031..3c6495f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -33,7 +33,6 @@ endif() if(DATA_SOURCES OR DS_HWLOC) find_package(HWLOC REQUIRED) - include_directories(${HWLOC_INCLUDE_DIRS}) endif() diff --git a/data-sources/CMakeLists.txt b/data-sources/CMakeLists.txt index 2ce2f9c..2442e08 100644 --- a/data-sources/CMakeLists.txt +++ b/data-sources/CMakeLists.txt @@ -11,7 +11,9 @@ if(DS_HWLOC) endif() add_executable(hwloc-output hwloc-output.cpp) - target_link_libraries(hwloc-output hwloc) + target_include_directories(hwloc-output PUBLIC ${HWLOC_INCLUDE_DIRS}) + target_link_directories(hwloc-output PRIVATE ${HWLOC_LIBRARY_DIRS}) + target_link_libraries(hwloc-output PRIVATE ${HWLOC_LIBRARIES}) install(TARGETS hwloc-output DESTINATION bin) endif() diff --git a/data-sources/hwloc-output.cpp b/data-sources/hwloc-output.cpp index 0833a3b..fd61314 100644 --- a/data-sources/hwloc-output.cpp +++ b/data-sources/hwloc-output.cpp @@ -17,7 +17,6 @@ Binary (entrypoint) for generating hwloc topology XML output (to current directo \n usage: ./hwloc-output [output_filename] @param filename of the output file (default: hwloc_topology.xml) */ - int main(int argc, char* argv[]) { @@ -66,16 +65,19 @@ string get_hwloc_topology_xml_string() { hwloc_topology_destroy(topology); return ""; } - //TODO replace with hwloc_topology_export_xmlbuffer? - stringstream xml_output_stream; - err = hwloc_topology_export_xml(topology, xml_output_stream.str().c_str(), flags); + char * xmlbuffer; + int buflen; + err = hwloc_topology_export_xmlbuffer(topology, &xmlbuffer, &buflen, flags); if (err) { - cerr << "hwloc: Failed to export xml" << endl; + cerr << "hwloc: Failed to export to a temporary buffer" << endl; + hwloc_free_xmlbuffer(topology, xmlbuffer); hwloc_topology_destroy(topology); return ""; } + std::string xml_output(xmlbuffer, buflen); + hwloc_free_xmlbuffer(topology, xmlbuffer); hwloc_topology_destroy(topology); - string xml_output = xml_output_stream.str(); + return xml_output; } From 4fb93b6139e83a6faa97cabffbdf369014df815b Mon Sep 17 00:00:00 2001 From: Stepan Vanecek Date: Mon, 18 Dec 2023 18:40:22 +0100 Subject: [PATCH 102/102] add option for exporting hwloc to stdout --- data-sources/hwloc-output.cpp | 29 +++++++++++++++++++---------- 1 file changed, 19 insertions(+), 10 deletions(-) diff --git a/data-sources/hwloc-output.cpp b/data-sources/hwloc-output.cpp index fd61314..7580c5e 100644 --- a/data-sources/hwloc-output.cpp +++ b/data-sources/hwloc-output.cpp @@ -13,31 +13,40 @@ using namespace std; string get_hwloc_topology_xml_string(); /** -Binary (entrypoint) for generating hwloc topology XML output (to current directory) +Binary (entrypoint) for generating hwloc topology XML output (to current directory). Functionality is almost identical to "lstopo --of XML" (with an option to store to a file). \n usage: ./hwloc-output [output_filename] -@param filename of the output file (default: hwloc_topology.xml) +@param filename of the output file. If no output_filename is selected, print to stdout (also use "-" as output_filename to print to stdout) */ int main(int argc, char* argv[]) { - + bool to_stdout = false; string filename; - if (argc < 2) { - filename = "hwloc_topology.xml"; + if (argc < 2 || std::strcmp(argv[1], "-") == 0 ) { + to_stdout = true; } else { filename = argv[1]; } + string xml_output = get_hwloc_topology_xml_string(); if (!xml_output.empty()) { - ofstream outfile; - outfile.open(filename); - outfile << xml_output; - outfile.close(); - //cout << "Hwloc XML output exported to " << filename << endl; + if(to_stdout) + { + std::cout << xml_output; + } + else + { + ofstream outfile; + outfile.open(filename); + outfile << xml_output; + outfile.close(); + //cout << "Hwloc XML output exported to " << filename << endl; + } } else { cerr << "Failed to generate hwloc topology XML output" << endl; + return 1; } return 0;