Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Core perf tests consolidation #5363

Merged
merged 9 commits into from
Feb 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions sdk/core/azure-core/test/perf/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,12 @@ set(CMAKE_CXX_STANDARD_REQUIRED True)

set(
AZURE_CORE_PERF_TEST_HEADER
inc/azure/core/test/delay_test.hpp
inc/azure/core/test/exception_test.hpp
inc/azure/core/test/extended_options_test.hpp
inc/azure/core/test/http_transport_test.hpp
inc/azure/core/test/json_test.hpp
inc/azure/core/test/no_op_test.hpp
inc/azure/core/test/nullable_test.hpp
inc/azure/core/test/pipeline_test.hpp
inc/azure/core/test/uuid_test.hpp
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
#include <thread>
#include <vector>

namespace Azure { namespace Perf { namespace Test {
namespace Azure { namespace Core { namespace Test {

namespace _detail {
static std::atomic_uint64_t DelayTestInstanceCount(0);
Expand Down Expand Up @@ -77,14 +77,14 @@ namespace Azure { namespace Perf { namespace Test {
std::vector<Azure::Perf::TestOption> GetTestOptions() override
{
return {
{"InitialDelayMs", {"-m"}, "Initial delay (in milliseconds). Default to 1000 (1sec)", 1},
{"InitialDelayMs", {"--m"}, "Initial delay (in milliseconds). Default to 1000 (1sec)", 1},
{"InstanceGrowthFactor",
{"-n"},
{"--n"},
"Instance growth factor. The delay of instance N will be (InitialDelayMS * "
"(InstanceGrowthFactor ^ InstanceCount)). Default to 1",
1},
{"IterationGrowthFactor",
{"-t"},
{"--t"},
"Initial delay (in milliseconds). The delay of iteration N will be (InitialDelayMS * "
"(IterationGrowthFactor ^ IterationCount)). Default to 1",
1}};
Expand All @@ -101,9 +101,9 @@ namespace Azure { namespace Perf { namespace Test {
"delay",
"The no op test with a configurable time delay for the main test loop.",
[](Azure::Perf::TestOptions options) {
return std::make_unique<Azure::Perf::Test::DelayTest>(options);
return std::make_unique<Azure::Core::Test::DelayTest>(options);
}};
}
};

}}} // namespace Azure::Perf::Test
}}} // namespace Azure::Core::Test
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

#include <memory>

namespace Azure { namespace Perf { namespace Test {
namespace Azure { namespace Core { namespace Test {

/**
* @brief Measures the overhead of creating, throwing, and catching an exception (compared to
Expand Down Expand Up @@ -57,9 +57,9 @@ namespace Azure { namespace Perf { namespace Test {
"exception",
"Measure how the impact of catching a runtime exception.",
[](Azure::Perf::TestOptions options) {
return std::make_unique<Azure::Perf::Test::ExceptionTest>(options);
return std::make_unique<Azure::Core::Test::ExceptionTest>(options);
}};
}
};

}}} // namespace Azure::Perf::Test
}}} // namespace Azure::Core::Test
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
#include <memory>
#include <vector>

namespace Azure { namespace Perf { namespace Test {
namespace Azure { namespace Core { namespace Test {

/**
* @brief A performance test that defines a test option.
Expand Down Expand Up @@ -47,7 +47,7 @@ namespace Azure { namespace Perf { namespace Test {
*/
std::vector<Azure::Perf::TestOption> GetTestOptions() override
{
return {{"extraOption", {"-e"}, "Example for extended option for test.", 1}};
return {{"extraOption", {"--e"}, "Example for extended option for test.", 1}};
}

/**
Expand All @@ -62,9 +62,9 @@ namespace Azure { namespace Perf { namespace Test {
"Demostrate how to include a test option to a test and measures how expensive is to do "
"it.",
[](Azure::Perf::TestOptions options) {
return std::make_unique<Azure::Perf::Test::ExtendedOptionsTest>(options);
return std::make_unique<Azure::Core::Test::ExtendedOptionsTest>(options);
}};
}
};

}}} // namespace Azure::Perf::Test
}}} // namespace Azure::Core::Test
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ namespace Azure { namespace Core { namespace Test {
static Azure::Perf::TestMetadata GetTestMetadata()
{
return {
"HTTPTransportTest",
"httpTransport",
"Measures HTTP transport performance",
[](Azure::Perf::TestOptions options) {
return std::make_unique<Azure::Core::Test::HTTPTransportTest>(options);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@ namespace Azure { namespace Core { namespace Test {
static Azure::Perf::TestMetadata GetTestMetadata()
{
return {
"JsonTest",
"json",
"Measures Json serialize/deserialize performance",
[](Azure::Perf::TestOptions options) {
return std::make_unique<Azure::Core::Test::JsonTest>(options);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

#include <memory>

namespace Azure { namespace Perf { namespace Test {
namespace Azure { namespace Core { namespace Test {

/**
* @brief The no op test is an empty test used to measure the performance framework alone.
Expand Down Expand Up @@ -45,7 +45,7 @@ namespace Azure { namespace Perf { namespace Test {
*/
std::vector<Azure::Perf::TestOption> GetTestOptions() override
{
return {{"extraOption", {"-e"}, "Example for extended option for test.", 1}};
return {{"extraOption", {"--e"}, "Example for extended option for test.", 1}};
}

/**
Expand All @@ -59,9 +59,9 @@ namespace Azure { namespace Perf { namespace Test {
"NoOp",
"Simplest test to measure the performance framework speed.",
[](Azure::Perf::TestOptions options) {
return std::make_unique<Azure::Perf::Test::NoOp>(options);
return std::make_unique<Azure::Core::Test::NoOp>(options);
}};
}
};

}}} // namespace Azure::Perf::Test
}}} // namespace Azure::Core::Test
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ namespace Azure { namespace Core { namespace Test {
static Azure::Perf::TestMetadata GetTestMetadata()
{
return {
"NullableTest",
"nullable",
"Measures the overhead of using nullable objects",
[](Azure::Perf::TestOptions options) {
return std::make_unique<Azure::Core::Test::NullableTest>(options);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ namespace Azure { namespace Core { namespace Test {
static Azure::Perf::TestMetadata GetTestMetadata()
{
return {
"PipelineBaseTest",
"pipelineBase",
"Measures HTTP pipeline and policies performance",
[](Azure::Perf::TestOptions options) {
return std::make_unique<Azure::Core::Test::PipelineTest>(options);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ namespace Azure { namespace Core { namespace Test {
*/
std::vector<Azure::Perf::TestOption> GetTestOptions() override
{
return {{"count", {"-c"}, "The number of uuid objects to be created.", 1, true}};
return {{"count", {"--c"}, "The number of uuid objects to be created.", 1, true}};
}

/**
Expand All @@ -59,7 +59,7 @@ namespace Azure { namespace Core { namespace Test {
static Azure::Perf::TestMetadata GetTestMetadata()
{
return {
"UuidTest",
"uuid",
"Measures the overhead of using Uuid objects",
[](Azure::Perf::TestOptions options) {
return std::make_unique<Azure::Core::Test::UuidTest>(options);
Expand Down
8 changes: 8 additions & 0 deletions sdk/core/azure-core/test/perf/src/azure_core_perf_test.cpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

#include "azure/core/test/delay_test.hpp"
#include "azure/core/test/exception_test.hpp"
#include "azure/core/test/extended_options_test.hpp"
#include "azure/core/test/http_transport_test.hpp"
#include "azure/core/test/json_test.hpp"
#include "azure/core/test/no_op_test.hpp"
#include "azure/core/test/nullable_test.hpp"
#include "azure/core/test/pipeline_test.hpp"
#include "azure/core/test/uuid_test.hpp"
Expand All @@ -16,8 +20,12 @@ int main(int argc, char** argv)

// Create the test list
std::vector<Azure::Perf::TestMetadata> tests{
Azure::Core::Test::DelayTest::GetTestMetadata(),
Azure::Core::Test::ExceptionTest::GetTestMetadata(),
Azure::Core::Test::ExtendedOptionsTest::GetTestMetadata(),
Azure::Core::Test::HTTPTransportTest::GetTestMetadata(),
Azure::Core::Test::JsonTest::GetTestMetadata(),
Azure::Core::Test::NoOp::GetTestMetadata(),
Azure::Core::Test::NullableTest::GetTestMetadata(),
Azure::Core::Test::PipelineTest::GetTestMetadata(),
Azure::Core::Test::UuidTest::GetTestMetadata()};
Expand Down
37 changes: 34 additions & 3 deletions sdk/core/perf-tests.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,44 @@
Service: core

Project: azure-perf-test
Project: azure-core-perf

PackageVersions:
- azure-core-cpp: 1.7.2
- azure-core-cpp: 1.11.0
- azure-core-cpp: source

Tests:
- Test: delay
Class: delay
Arguments:
- --m 100 --n 1000 --t 500

- Test: exception
Class: exception
Arguments:
- --e 1

- Test: extendedOptions
Class: extendedOptions
Arguments:
- -e 1
- --e 1

- Test: json
Class: json
Arguments:
- --action serialize --size 1000
- --action deserialize --size 1000

- Test: noOp
Class: noOp
Arguments:
- --e 1

- Test: nullable
Class: nullable
Arguments:
- --e 1

- Test: uuid
Class: uuid
Arguments:
- --c 1
2 changes: 1 addition & 1 deletion sdk/core/perf.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ parameters:
- name: Tests
displayName: Tests (regex of tests to run)
type: string
default: '^(extendedOptions)$'
default: '^(delay|exception|extendedOptions|json|noop|nullable|uuid)$'
- name: Arguments
displayName: Arguments (regex of arguments to run)
type: string
Expand Down
6 changes: 5 additions & 1 deletion sdk/core/perf/inc/azure/perf/base_test.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,11 @@ namespace Azure { namespace Perf {
*/
virtual std::vector<Azure::Perf::TestOption> GetTestOptions()
{
return std::vector<Azure::Perf::TestOption>();
return {
{"extraOption",
{"--e"},
"Example for extended option for test.Needed to be run by the perf tool.",
1}};
}

/**
Expand Down
40 changes: 1 addition & 39 deletions sdk/core/perf/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,55 +3,17 @@

# Configure CMake project.
cmake_minimum_required (VERSION 3.13)
project(azure-perf-test LANGUAGES CXX)
project(azure-perf-unit-test LANGUAGES CXX)
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED True)

set(
AZURE_PERF_TEST_HEADER
inc/azure/perf/test/curl_http_client_get_test.hpp
inc/azure/perf/test/delay_test.hpp
inc/azure/perf/test/exception_test.hpp
inc/azure/perf/test/extended_options_test.hpp
inc/azure/perf/test/http_client_get_test.hpp
inc/azure/perf/test/http_pipeline_get_test.hpp
inc/azure/perf/test/no_op_test.hpp
inc/azure/perf/test/win_http_client_get_test.hpp
)

set(
AZURE_PERF_TEST_SOURCE
src/perf_test.cpp
)

# Name the binary to be created.
add_executable (
azure-perf-test
${AZURE_PERF_TEST_HEADER} ${AZURE_PERF_TEST_SOURCE}
)

create_map_file(azure-perf-test azure-perf-test.map)

# Include the headers from the project.
target_include_directories(
azure-perf-test
PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/inc>
)

if(DEFINED ENV{VCPKG-AZURE-CORE-CPP})
find_package(azure-core-cpp $ENV{VCPKG-AZURE-CORE-CPP} EXACT)
add_compile_definitions(VCPKG_CORE_VERSION="$ENV{VCPKG-AZURE-CORE-CPP}")
else()
add_compile_definitions(VCPKG_CORE_VERSION="source")
endif()


# link the `azure-perf` lib together with any other library which will be used for the tests.
target_link_libraries(azure-perf-test PRIVATE Azure::azure-core azure-perf)
# Make sure the project will appear in the test folder for Visual Studio CMake view
set_target_properties(azure-perf-test PROPERTIES FOLDER "Tests/Core")

# Unit tests
include(GoogleTest)

Expand Down

This file was deleted.

Loading