perf stress basic struct folder and no op herarchy structure (#390)
* perf stress basic struct folder and no op herarchy structure
This commit is contained in:
parent
66c331e52b
commit
e782efbb47
@ -53,6 +53,7 @@ include(global_compile_options)
|
||||
include(${CMAKE_CURRENT_SOURCE_DIR}/cmake-modules/doxygen_common.cmake)
|
||||
|
||||
# sub-projects
|
||||
add_subdirectory(sdk/core/performance-stress)
|
||||
add_subdirectory(sdk/core/azure-core)
|
||||
if(BUILD_CURL_TRANSPORT)
|
||||
add_subdirectory(sdk/core/azure-core/test/e2e) # will work only if BUILD_CURL_TRANSPORT=ON
|
||||
|
||||
5
sdk/core/performance-stress/CHANGELOG.md
Normal file
5
sdk/core/performance-stress/CHANGELOG.md
Normal file
@ -0,0 +1,5 @@
|
||||
# Release History
|
||||
|
||||
## 1.0.0-preview.1 (Unreleased)
|
||||
|
||||
* Testing. Validating automation.
|
||||
24
sdk/core/performance-stress/CMakeLists.txt
Normal file
24
sdk/core/performance-stress/CMakeLists.txt
Normal file
@ -0,0 +1,24 @@
|
||||
# Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
# SPDX-License-Identifier: MIT
|
||||
|
||||
cmake_minimum_required (VERSION 3.12)
|
||||
set(TARGET_NAME "azure-perf-stress")
|
||||
project(${TARGET_NAME} LANGUAGES CXX)
|
||||
|
||||
set(CMAKE_CXX_STANDARD 14)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED True)
|
||||
|
||||
add_library (
|
||||
${TARGET_NAME}
|
||||
src/placeholder.cpp
|
||||
)
|
||||
|
||||
target_include_directories (${TARGET_NAME} PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/inc> $<INSTALL_INTERFACE:include/az_core>)
|
||||
|
||||
# make sure that users can consume the project as a library.
|
||||
add_library (Azure::PerfStress ALIAS ${TARGET_NAME})
|
||||
|
||||
# Import azure-core to get a context type
|
||||
target_link_libraries(${TARGET_NAME} PRIVATE azure-core)
|
||||
|
||||
add_subdirectory(test)
|
||||
21
sdk/core/performance-stress/LICENSE
Normal file
21
sdk/core/performance-stress/LICENSE
Normal file
@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
59
sdk/core/performance-stress/README.md
Normal file
59
sdk/core/performance-stress/README.md
Normal file
@ -0,0 +1,59 @@
|
||||
# Azure SDK performance stress C++
|
||||
|
||||
Azure performance stress for C++ (`azure-core`) provides shared primitives, abstractions, and helpers for running performance tests for an Azure SDK Service.
|
||||
|
||||
## Getting started
|
||||
|
||||
TODO
|
||||
|
||||
## Key concepts
|
||||
|
||||
TODO
|
||||
|
||||
## Examples
|
||||
|
||||
TODO
|
||||
|
||||
## Contributing
|
||||
For details on contributing to this repository, see the [contributing guide][azure_sdk_for_cpp_contributing].
|
||||
|
||||
This project welcomes contributions and suggestions. Most contributions require you to agree to a
|
||||
Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us
|
||||
the rights to use your contribution. For details, visit https://cla.microsoft.com.
|
||||
|
||||
When you submit a pull request, a CLA-bot will automatically determine whether you need to provide
|
||||
a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions
|
||||
provided by the bot. You will only need to do this once across all repos using our CLA.
|
||||
|
||||
This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/).
|
||||
For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or
|
||||
contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments.
|
||||
|
||||
### Additional Helpful Links for Contributors
|
||||
Many people all over the world have helped make this project better. You'll want to check out:
|
||||
|
||||
* [What are some good first issues for new contributors to the repo?](https://github.com/azure/azure-sdk-for-cpp/issues?q=is%3Aopen+is%3Aissue+label%3A%22up+for+grabs%22)
|
||||
* [How to build and test your change][azure_sdk_for_cpp_contributing_developer_guide]
|
||||
* [How you can make a change happen!][azure_sdk_for_cpp_contributing_pull_requests]
|
||||
* Frequently Asked Questions (FAQ) and Conceptual Topics in the detailed [Azure SDK for C++ wiki](https://github.com/azure/azure-sdk-for-cpp/wiki).
|
||||
|
||||
### Reporting security issues and security bugs
|
||||
|
||||
Security issues and bugs should be reported privately, via email, to the Microsoft Security Response Center (MSRC) <secure@microsoft.com>. You should receive a response within 24 hours. If for some reason you do not, please follow up via email to ensure we received your original message. Further information, including the MSRC PGP key, can be found in the [Security TechCenter](https://www.microsoft.com/msrc/faqs-report-an-issue).
|
||||
|
||||
### License
|
||||
|
||||
Azure SDK for C++ is licensed under the [MIT](LICENSE) license.
|
||||
|
||||
<!-- LINKS -->
|
||||
[azure_sdk_for_c_contributing]: https://github.com/Azure/azure-sdk-for-cpp/blob/master/CONTRIBUTING.md
|
||||
[azure_sdk_for_c_contributing_developer_guide]: https://github.com/Azure/azure-sdk-for-cpp/blob/master/CONTRIBUTING.md#developer-guide
|
||||
[azure_sdk_for_c_contributing_pull_requests]: https://github.com/Azure/azure-sdk-for-cpp/blob/master/CONTRIBUTING.md#pull-requests
|
||||
[azure_cli]: https://docs.microsoft.com/cli/azure
|
||||
[azure_pattern_circuit_breaker]: https://docs.microsoft.com/azure/architecture/patterns/circuit-breaker
|
||||
[azure_pattern_retry]: https://docs.microsoft.com/azure/architecture/patterns/retry
|
||||
[azure_portal]: https://portal.azure.com
|
||||
[azure_sub]: https://azure.microsoft.com/free/
|
||||
[c_compiler]: https://visualstudio.microsoft.com/vs/features/cplusplus/
|
||||
[cloud_shell]: https://docs.microsoft.com/azure/cloud-shell/overview
|
||||
[cloud_shell_bash]: https://shell.azure.com/bash
|
||||
53
sdk/core/performance-stress/inc/perf_stress_options.hpp
Normal file
53
sdk/core/performance-stress/inc/perf_stress_options.hpp
Normal file
@ -0,0 +1,53 @@
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "azure/core/nullable.hpp"
|
||||
|
||||
namespace Azure { namespace PerfStress {
|
||||
// options supported when running a test.
|
||||
// TODO: add defaults for command line
|
||||
struct PerfStressOptions
|
||||
{
|
||||
/* [Option('d', "duration", Default = 10, HelpText = "Duration of test in seconds")] */
|
||||
int Duration;
|
||||
|
||||
/* [Option("host", HelpText = "Host to redirect HTTP requests")] */
|
||||
std::string Host;
|
||||
|
||||
/* [Option("insecure", HelpText = "Allow untrusted SSL certs")] */
|
||||
bool Insecure;
|
||||
|
||||
/* [Option('i', "iterations", Default = 1, HelpText = "Number of iterations of main test loop")]
|
||||
*/
|
||||
int Iterations;
|
||||
|
||||
/* [Option("job-statistics", HelpText = "Print job statistics (used by automation)")] */
|
||||
bool JobStatistics;
|
||||
|
||||
/* [Option('l', "latency", HelpText = "Track and print per-operation latency statistics")] */
|
||||
bool Latency;
|
||||
|
||||
/* [Option("no-cleanup", HelpText = "Disables test cleanup")] */
|
||||
bool NoCleanup;
|
||||
|
||||
/* [Option('p', "parallel", Default = 1, HelpText = "Number of operations to execute in
|
||||
* parallel")] */
|
||||
int Parallel;
|
||||
|
||||
/* [Option("port", HelpText = "Port to redirect HTTP requests")] */
|
||||
Azure::Core::Nullable<int> Port;
|
||||
|
||||
/* [Option('r', "rate", HelpText = "Target throughput (ops/sec)")] */
|
||||
Azure::Core::Nullable<int> Rate;
|
||||
|
||||
/* [Option("sync", HelpText = "Runs sync version of test")] */
|
||||
bool Sync;
|
||||
|
||||
/* [Option('w', "warmup", Default = 5, HelpText = "Duration of warmup in seconds")] */
|
||||
int Warmup;
|
||||
};
|
||||
}} // namespace Azure::PerfStress
|
||||
17
sdk/core/performance-stress/inc/perf_stress_test.hpp
Normal file
17
sdk/core/performance-stress/inc/perf_stress_test.hpp
Normal file
@ -0,0 +1,17 @@
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "perf_stress_options.hpp"
|
||||
#include "perf_stress_test_base.hpp"
|
||||
|
||||
namespace Azure { namespace PerfStress {
|
||||
class PerfStressTest : public Azure::PerfStress::PerfStressTestBase {
|
||||
private:
|
||||
Azure::PerfStress::PerfStressOptions m_options;
|
||||
|
||||
public:
|
||||
PerfStressTest(Azure::PerfStress::PerfStressOptions options) : m_options(std::move(options)) {}
|
||||
};
|
||||
}} // namespace Azure::PerfStress
|
||||
20
sdk/core/performance-stress/inc/perf_stress_test_base.hpp
Normal file
20
sdk/core/performance-stress/inc/perf_stress_test_base.hpp
Normal file
@ -0,0 +1,20 @@
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <azure/core/context.hpp>
|
||||
|
||||
namespace Azure { namespace PerfStress {
|
||||
// contract for a test
|
||||
struct PerfStressTestBase
|
||||
{
|
||||
virtual void GlobalSetupAsync(){};
|
||||
virtual void SetupAsync(){};
|
||||
virtual void Run(Azure::Core::Context const& cancellationToken) = 0;
|
||||
// async not supported on Azure SDK for C++
|
||||
// virtual void RunAsync(Azure::Core::Context cancellationToken) = 0;
|
||||
virtual void CleanupAsync(){};
|
||||
virtual void GlobalCleanupAsync(){};
|
||||
};
|
||||
}} // namespace Azure::PerfStress
|
||||
0
sdk/core/performance-stress/src/placeholder.cpp
Normal file
0
sdk/core/performance-stress/src/placeholder.cpp
Normal file
17
sdk/core/performance-stress/test/CMakeLists.txt
Normal file
17
sdk/core/performance-stress/test/CMakeLists.txt
Normal file
@ -0,0 +1,17 @@
|
||||
# Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
# SPDX-License-Identifier: MIT
|
||||
|
||||
cmake_minimum_required (VERSION 3.12)
|
||||
|
||||
set(TARGET_NAME "azure-perf-stress-test")
|
||||
|
||||
project (${TARGET_NAME} LANGUAGES CXX)
|
||||
set(CMAKE_CXX_STANDARD 14)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED True)
|
||||
|
||||
add_executable (
|
||||
${TARGET_NAME}
|
||||
src/no_op_test.cpp
|
||||
)
|
||||
|
||||
target_link_libraries(${TARGET_NAME} PRIVATE azure-core azure-perf-stress)
|
||||
33
sdk/core/performance-stress/test/src/no_op_test.cpp
Normal file
33
sdk/core/performance-stress/test/src/no_op_test.cpp
Normal file
@ -0,0 +1,33 @@
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
#include "perf_stress_options.hpp"
|
||||
#include "perf_stress_test.hpp"
|
||||
|
||||
#include <iostream>
|
||||
|
||||
using Azure::PerfStress::PerfStressOptions;
|
||||
using Azure::PerfStress::PerfStressTest;
|
||||
using std::cout;
|
||||
using std::endl;
|
||||
|
||||
class NoOp : public PerfStressTest {
|
||||
public:
|
||||
NoOp(PerfStressOptions options) : PerfStressTest(options) {}
|
||||
|
||||
void Run(Azure::Core::Context const& ctx) override
|
||||
{
|
||||
(void)ctx;
|
||||
cout << "Hello test" << endl;
|
||||
}
|
||||
};
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
(void)argv;
|
||||
(void)argc;
|
||||
PerfStressOptions op;
|
||||
NoOp test(op);
|
||||
test.Run(Azure::Core::GetApplicationContext());
|
||||
return 0;
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user