Skip to content
Merged
Changes from 1 commit
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
de0409b
Async WinHTTP
LarryOsterman Oct 10, 2022
8da47ee
Added cancellation test; added support for request cancellation.
LarryOsterman Oct 11, 2022
e48f66f
Added header for requests
LarryOsterman Oct 11, 2022
6bff722
Fixed deadlock when TLS error happens
LarryOsterman Oct 11, 2022
4a76919
FIxed accidentally changed timeout
LarryOsterman Oct 11, 2022
a37968f
Cleaned up some comments and headers
LarryOsterman Oct 11, 2022
5c5c63a
CSpell and fixed UWP build issue
LarryOsterman Oct 11, 2022
1539336
Update sdk/core/azure-core/CMakeLists.txt
LarryOsterman Oct 12, 2022
b85b2b8
Update sdk/core/azure-core/src/http/winhttp/win_http_transport.cpp
LarryOsterman Oct 12, 2022
25b2ff5
Update sdk/core/azure-core/src/http/winhttp/win_http_transport.cpp
LarryOsterman Oct 12, 2022
e1eaa35
Update sdk/core/azure-core/src/http/winhttp/win_http_transport.cpp
LarryOsterman Oct 12, 2022
8e14296
Update sdk/core/azure-core/src/http/winhttp/win_http_transport.cpp
LarryOsterman Oct 12, 2022
7a217e2
Update sdk/core/azure-core/src/http/winhttp/win_http_request.hpp
LarryOsterman Oct 12, 2022
14e0c86
Update sdk/core/azure-core/src/http/winhttp/win_http_request.hpp
LarryOsterman Oct 12, 2022
8d41533
Update sdk/core/azure-core/src/http/winhttp/win_http_transport.cpp
LarryOsterman Oct 12, 2022
768bfc6
Improved discoverability of tests; handle exceptions thrown during te…
LarryOsterman Oct 12, 2022
c695b02
Merge branch 'larryo/asyncwinhttp' of https://github.com/LarryOsterma…
LarryOsterman Oct 12, 2022
01d7904
clang-format
LarryOsterman Oct 13, 2022
cba73d3
clang-format
LarryOsterman Oct 13, 2022
2b67738
Merge branch 'main' into larryo/asyncwinhttp
LarryOsterman Oct 13, 2022
3b40e8b
Undid bad merge
LarryOsterman Oct 13, 2022
3f23d74
Use sigabrt handler to report any thrown exceptions
LarryOsterman Oct 13, 2022
9dc8514
clang-format
LarryOsterman Oct 13, 2022
ec7577f
Update sdk/core/azure-core/src/http/winhttp/win_http_request.hpp
LarryOsterman Oct 17, 2022
015c846
Update sdk/core/azure-core/src/http/winhttp/win_http_request.hpp
LarryOsterman Oct 17, 2022
684c013
Update sdk/core/azure-core/src/http/winhttp/win_http_request.hpp
LarryOsterman Oct 17, 2022
9b45291
pull request feedback
LarryOsterman Oct 17, 2022
aea5284
Merge branch 'larryo/asyncwinhttp' of https://github.com/LarryOsterma…
LarryOsterman Oct 17, 2022
12dd753
Pull request feedback
LarryOsterman Oct 17, 2022
57c50fb
More pull request feedback
LarryOsterman Oct 18, 2022
807a3cf
clang-format
LarryOsterman Oct 18, 2022
ae10a3f
Added more control over what events cause requests to complete
LarryOsterman Oct 18, 2022
68530e8
Pull request feedback
LarryOsterman Oct 19, 2022
2084eab
Update sdk/core/azure-core/inc/azure/core/internal/diagnostics/global…
LarryOsterman Oct 19, 2022
1a349d9
clang-format
LarryOsterman Oct 19, 2022
7068ca0
Merge branch 'larryo/asyncwinhttp' of https://github.com/LarryOsterma…
LarryOsterman Oct 19, 2022
e3e4cae
clang-format, again
LarryOsterman Oct 19, 2022
2e270fb
Don't set the complete event until after the mutex is released
LarryOsterman Oct 19, 2022
6c8ac5b
Added a bit of comments
LarryOsterman Oct 20, 2022
d431631
Swap out twiter.com for wikipedia.org
LarryOsterman Oct 20, 2022
d673a49
Cannot use wikipedia on CI pipeline
LarryOsterman Oct 20, 2022
2dfa186
Fixed aws url
LarryOsterman Oct 20, 2022
b013c05
Comment changes from pull request feedback
LarryOsterman Oct 21, 2022
10148f8
Update sdk/core/azure-core/src/http/winhttp/win_http_request.hpp
LarryOsterman Oct 21, 2022
a8573e0
pull request feedback
LarryOsterman Oct 21, 2022
f29c866
Merge branch 'larryo/asyncwinhttp' of https://github.com/LarryOsterma…
LarryOsterman Oct 21, 2022
53af4ee
Bumped test discovery timeout
LarryOsterman Oct 21, 2022
8d00d34
Update sdk/core/azure-core/src/http/winhttp/win_http_transport.cpp
LarryOsterman Oct 21, 2022
beac2fb
More pull request feedback
LarryOsterman Oct 21, 2022
1086aae
Merge branch 'larryo/asyncwinhttp' of https://github.com/LarryOsterma…
LarryOsterman Oct 21, 2022
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
Prev Previous commit
Next Next commit
Undid bad merge
  • Loading branch information
LarryOsterman committed Oct 13, 2022
commit 3b40e8b59384c0f2200d5933cb03d898cb751b33
225 changes: 90 additions & 135 deletions sdk/core/perf/src/program.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -214,15 +214,11 @@ inline void RunTests(
{
using namespace std::chrono_literals;
std::this_thread::sleep_for(1000ms);
if (!progressToken.IsCancelled())
{

auto total = Sum(completedOperations);
auto current = total - lastCompleted;
auto avg = Sum(ZipAvg(completedOperations, lastCompletionTimes));
lastCompleted = total;
std::cout << current << "\t\t" << total << "\t\t" << avg << std::endl;
}
auto total = Sum(completedOperations);
auto current = total - lastCompleted;
auto avg = Sum(ZipAvg(completedOperations, lastCompletionTimes));
lastCompleted = total;
std::cout << current << "\t\t" << total << "\t\t" << avg << std::endl;
}
});

Expand Down Expand Up @@ -256,34 +252,25 @@ inline void RunTests(
{
t.join();
}
bool testPrematurelyCancelled = progressToken.IsCancelled();

// Stop progress
progressToken.Cancel();
progressThread.join();

if (testPrematurelyCancelled)
{
std::cout << std::endl << "*** TESTS CANCELLED DUE TO EXCEPTION ***" << std::endl;
}
else
{

std::cout << std::endl << "=== Results ===";
std::cout << std::endl << "=== Results ===";

auto totalOperations = Sum(completedOperations);
auto operationsPerSecond = Sum(ZipAvg(completedOperations, lastCompletionTimes));
auto secondsPerOperation = 1 / operationsPerSecond;
auto weightedAverageSeconds = totalOperations / operationsPerSecond;
auto totalOperations = Sum(completedOperations);
auto operationsPerSecond = Sum(ZipAvg(completedOperations, lastCompletionTimes));
auto secondsPerOperation = 1 / operationsPerSecond;
auto weightedAverageSeconds = totalOperations / operationsPerSecond;

std::cout << std::endl
<< "Completed " << FormatNumber(totalOperations, false)
<< " operations in a weighted-average of "
<< FormatNumber(weightedAverageSeconds, false) << "s ("
<< FormatNumber(operationsPerSecond) << " ops/s, " << secondsPerOperation << " s/op)"
<< std::endl
<< std::endl;
}
std::cout << std::endl
<< "Completed " << FormatNumber(totalOperations, false)
<< " operations in a weighted-average of "
<< FormatNumber(weightedAverageSeconds, false) << "s ("
<< FormatNumber(operationsPerSecond) << " ops/s, " << secondsPerOperation << " s/op)"
<< std::endl
<< std::endl;
}

} // namespace
Expand Down Expand Up @@ -336,94 +323,80 @@ void Azure::Perf::Program::Run(

if (options.JobStatistics)
{
// Parse args only to get the test name first
testMetadata = GetTestMetadata(tests, argc, argv);
auto const& testGenerator = testMetadata->Factory;
if (testMetadata == nullptr)
{
// Wrong input. Print what are the options.
PrintAvailableTests(tests);
std::cout << std::endl << "Application started." << std::endl;
}

return;
}
// Print test metadata
std::cout << std::endl << "Running test: " << testMetadata->Name;
std::cout << std::endl << "Description: " << testMetadata->Description << std::endl;

// Initial test to get it's options, we can use a dummy parser results
argagg::parser_results argResults;
auto test = testGenerator(Azure::Perf::TestOptions(argResults));
auto testOptions = test->GetTestOptions();
argResults = Azure::Perf::Program::ArgParser::Parse(argc, argv, testOptions);
// ReCreate Test with parsed results
test = testGenerator(Azure::Perf::TestOptions(argResults));
GlobalTestOptions options = Azure::Perf::Program::ArgParser::Parse(argResults);
// Print options
PrintOptions(options, testOptions, argResults);

if (options.JobStatistics)
// Create parallel pool of tests
int const parallelTasks = options.Parallel;
std::vector<std::unique_ptr<Azure::Perf::PerfTest>> parallelTest(parallelTasks);
for (int i = 0; i < parallelTasks; i++)
{
parallelTest[i] = testGenerator(Azure::Perf::TestOptions(argResults));
// Let the test know it should use a proxy
if (!options.TestProxies.empty())
{
// Take the corresponding proxy from the list in round robin
parallelTest[i]->SetTestProxy(options.TestProxies[i % options.TestProxies.size()]);
}
if (options.Insecure)
{
std::cout << std::endl << "Application started." << std::endl;
parallelTest[i]->AllowInsecureConnections(true);
}
}

// Print test metadata
std::cout << std::endl << "Running test: " << testMetadata->Name;
std::cout << std::endl << "Description: " << testMetadata->Description << std::endl;
/******************** Global Set up ******************************/
std::cout << std::endl << "=== Global Setup ===" << std::endl;
test->GlobalSetup();

// Print options
PrintOptions(options, testOptions, argResults);
std::cout << std::endl << "=== Test Setup ===" << std::endl;

// Create parallel pool of tests
int const parallelTasks = options.Parallel;
std::vector<std::unique_ptr<Azure::Perf::PerfTest>> parallelTest(parallelTasks);
/******************** Set up ******************************/
{
std::vector<std::thread> tasks(parallelTasks);
for (int i = 0; i < parallelTasks; i++)
{
parallelTest[i] = testGenerator(Azure::Perf::TestOptions(argResults));
// Let the test know it should use a proxy
if (!options.TestProxies.empty())
{
// Take the corresponding proxy from the list in round robin
parallelTest[i]->SetTestProxy(options.TestProxies[i % options.TestProxies.size()]);
}
if (options.Insecure)
{
parallelTest[i]->AllowInsecureConnections(true);
}
tasks[i] = std::thread([&parallelTest, i]() { parallelTest[i]->Setup(); });
}
// Wait for all tests to complete setUp
for (auto& t : tasks)
{
t.join();
}
}

/******************** Global Set up ******************************/
std::cout << std::endl << "=== Global Setup ===" << std::endl;
test->GlobalSetup();

std::cout << std::endl << "=== Test Setup ===" << std::endl;

/******************** Set up ******************************/
// instrument test for recordings if the env is set up.
std::cout << std::endl << "=== Post Setup ===" << std::endl;
{
if (!options.TestProxies.empty())
{
std::cout << " - Creating test recordings for each test using test-proxies..." << std::endl;
std::cout << " - Enabling test-proxy playback" << std::endl;
}

// instrument test for recordings if the env is set up.
std::cout << std::endl << "=== Post Setup ===" << std::endl;
std::vector<std::thread> tasks(parallelTasks);
for (int i = 0; i < parallelTasks; i++)
{
if (!options.TestProxies.empty())
{
std::cout << " - Creating test recordgins for each test using test-proxies..." << std::endl;
std::cout << " - Enabling test-proxy playback" << std::endl;
}

std::vector<std::thread> tasks(parallelTasks);
for (int i = 0; i < parallelTasks; i++)
{
tasks[i] = std::thread([&parallelTest, i]() { parallelTest[i]->PostSetUp(); });
}
// Wait for all tests to complete setUp
for (auto& t : tasks)
{
t.join();
}
tasks[i] = std::thread([&parallelTest, i]() { parallelTest[i]->PostSetUp(); });
}

/******************** WarmUp ******************************/
if (options.Warmup)
// Wait for all tests to complete setUp
for (auto& t : tasks)
{
RunTests(context, parallelTest, options, "Warmup", true);
t.join();
}
}

/******************** WarmUp ******************************/
if (options.Warmup)
{
RunTests(context, parallelTest, options, "Warmup", true);
}

/******************** Tests ******************************/
std::string iterationInfo;
Expand All @@ -440,53 +413,35 @@ void Azure::Perf::Program::Run(
{
if (!options.TestProxies.empty())
{
std::cout << "Error: " << error.what();
std::cout << " - Deleting test recordings from test-proxies..." << std::endl;
std::cout << " - Disabling test-proxy playback" << std::endl;
}

std::cout << std::endl << "=== Pre-Cleanup ===" << std::endl;
std::vector<std::thread> tasks(parallelTasks);
for (int i = 0; i < parallelTasks; i++)
{
if (!options.TestProxies.empty())
{
std::cout << " - Deleting test recordings from test-proxies..." << std::endl;
std::cout << " - Disabling test-proxy playback" << std::endl;
}

std::vector<std::thread> tasks(parallelTasks);
for (int i = 0; i < parallelTasks; i++)
{
tasks[i] = std::thread([&parallelTest, i]() { parallelTest[i]->PreCleanUp(); });
}
// Wait for all tests to complete setUp
for (auto& t : tasks)
{
t.join();
}
tasks[i] = std::thread([&parallelTest, i]() { parallelTest[i]->PreCleanUp(); });
}

/******************** Clean up ******************************/
if (!options.NoCleanup)
// Wait for all tests to complete setUp
for (auto& t : tasks)
{
std::cout << std::endl << "=== Cleanup ===" << std::endl;
std::vector<std::thread> tasks(parallelTasks);
for (int i = 0; i < parallelTasks; i++)
{
tasks[i] = std::thread([&parallelTest, i]() { parallelTest[i]->Cleanup(); });
}
for (auto& t : tasks)
{
t.join();
}
test->GlobalCleanup();
t.join();
}
}
catch (std::exception& e)
{
std::cout << "Error parsing options: " << e.what() << std::endl;

if (testMetadata)
/******************** Clean up ******************************/
if (!options.NoCleanup)
{
std::cout << std::endl << "=== Cleanup ===" << std::endl;
std::vector<std::thread> tasks(parallelTasks);
for (int i = 0; i < parallelTasks; i++)
{
std::cout << "Usage: " << testMetadata->Name << " [options]" << std::endl;
tasks[i] = std::thread([&parallelTest, i]() { parallelTest[i]->Cleanup(); });
}
return;
for (auto& t : tasks)
{
t.join();
}
test->GlobalCleanup();
}
}