diff options
author | Devtools Arcadia <arcadia-devtools@yandex-team.ru> | 2022-02-07 18:08:42 +0300 |
---|---|---|
committer | Devtools Arcadia <arcadia-devtools@mous.vla.yp-c.yandex.net> | 2022-02-07 18:08:42 +0300 |
commit | 1110808a9d39d4b808aef724c861a2e1a38d2a69 (patch) | |
tree | e26c9fed0de5d9873cce7e00bc214573dc2195b7 /util/system/benchmark/create_destroy_thread | |
download | ydb-1110808a9d39d4b808aef724c861a2e1a38d2a69.tar.gz |
intermediate changes
ref:cde9a383711a11544ce7e107a78147fb96cc4029
Diffstat (limited to 'util/system/benchmark/create_destroy_thread')
4 files changed, 63 insertions, 0 deletions
diff --git a/util/system/benchmark/create_destroy_thread/main.cpp b/util/system/benchmark/create_destroy_thread/main.cpp new file mode 100644 index 0000000000..0ca2a9d96f --- /dev/null +++ b/util/system/benchmark/create_destroy_thread/main.cpp @@ -0,0 +1,26 @@ +#include <library/cpp/testing/benchmark/bench.h> + +#include <util/system/thread.h> + +static void* DoNothing(void*) noexcept { + return nullptr; +} + +Y_CPU_BENCHMARK(CreateDestroyThread, iface) { + for (size_t i = 0, iEnd = iface.Iterations(); i < iEnd; ++i) { + NBench::Clobber(); + TThread t(&DoNothing, nullptr); + Y_DO_NOT_OPTIMIZE_AWAY(t); + NBench::Clobber(); + } +} + +Y_CPU_BENCHMARK(CreateRunDestroyThread, iface) { + for (size_t i = 0, iEnd = iface.Iterations(); i < iEnd; ++i) { + NBench::Clobber(); + TThread t(&DoNothing, nullptr); + t.Start(); + NBench::Escape(t.Join()); + NBench::Clobber(); + } +} diff --git a/util/system/benchmark/create_destroy_thread/metrics/main.py b/util/system/benchmark/create_destroy_thread/metrics/main.py new file mode 100644 index 0000000000..45564cda7f --- /dev/null +++ b/util/system/benchmark/create_destroy_thread/metrics/main.py @@ -0,0 +1,7 @@ +import yatest.common as yc + + +def test_export_metrics(metrics): + metrics.set_benchmark( + yc.execute_benchmark('util/system/benchmark/create_destroy_thread/create_destroy_thread', threads=8) + ) diff --git a/util/system/benchmark/create_destroy_thread/metrics/ya.make b/util/system/benchmark/create_destroy_thread/metrics/ya.make new file mode 100644 index 0000000000..d526487e1a --- /dev/null +++ b/util/system/benchmark/create_destroy_thread/metrics/ya.make @@ -0,0 +1,21 @@ +OWNER( + yazevnul + g:util +) +SUBSCRIBER(g:util-subscribers) + +PY2TEST() + +SIZE(LARGE) + +TAG( + ya:force_sandbox + sb:intel_e5_2660v1 + ya:fat +) + +TEST_SRCS(main.py) + +DEPENDS(util/system/benchmark/create_destroy_thread) + +END() diff --git a/util/system/benchmark/create_destroy_thread/ya.make b/util/system/benchmark/create_destroy_thread/ya.make new file mode 100644 index 0000000000..03eb0ec8e0 --- /dev/null +++ b/util/system/benchmark/create_destroy_thread/ya.make @@ -0,0 +1,9 @@ +OWNER(yazevnul) + +Y_BENCHMARK() + +SRCS( + main.cpp +) + +END() |