aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Craig Tiller <ctiller@google.com>2017-03-06 14:46:51 -0800
committerGravatar Craig Tiller <ctiller@google.com>2017-03-06 14:46:51 -0800
commit5ea6c9f3644c72c9cfb578658ed43bb58de902e0 (patch)
tree984f3c3a397a4c78b203c74f93c77d022066c1af
parente067b6e119e94b097092458dca99e8b253caf64b (diff)
parentf09ec59222e4abd8a534f89139f6b52378776fc4 (diff)
Merge branch 'fssplit' of github.com:ctiller/grpc into fssplit
-rw-r--r--CMakeLists.txt1
-rw-r--r--Makefile2
-rw-r--r--build.yaml2
-rw-r--r--test/cpp/microbenchmarks/helpers.cc65
-rw-r--r--test/cpp/microbenchmarks/helpers.h32
-rw-r--r--tools/run_tests/generated/sources_and_headers.json1
-rwxr-xr-xtools/run_tests/run_microbenchmark.py7
-rw-r--r--vsprojects/vcxproj/test/grpc_benchmark/grpc_benchmark.vcxproj2
-rw-r--r--vsprojects/vcxproj/test/grpc_benchmark/grpc_benchmark.vcxproj.filters5
9 files changed, 83 insertions, 34 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index c95085f3f1..610005701c 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -3106,6 +3106,7 @@ endif()
if (gRPC_BUILD_TESTS)
add_library(grpc_benchmark
+ test/cpp/microbenchmarks/helpers.cc
)
if(WIN32 AND MSVC)
diff --git a/Makefile b/Makefile
index 3701f1d48c..ec71d8c44b 100644
--- a/Makefile
+++ b/Makefile
@@ -4976,6 +4976,7 @@ endif
LIBGRPC_BENCHMARK_SRC = \
+ test/cpp/microbenchmarks/helpers.cc \
PUBLIC_HEADERS_CXX += \
@@ -18380,6 +18381,7 @@ test/cpp/interop/interop_client.cc: $(OPENSSL_DEP)
test/cpp/interop/interop_server.cc: $(OPENSSL_DEP)
test/cpp/interop/interop_server_bootstrap.cc: $(OPENSSL_DEP)
test/cpp/interop/server_helper.cc: $(OPENSSL_DEP)
+test/cpp/microbenchmarks/helpers.cc: $(OPENSSL_DEP)
test/cpp/qps/client_async.cc: $(OPENSSL_DEP)
test/cpp/qps/client_sync.cc: $(OPENSSL_DEP)
test/cpp/qps/driver.cc: $(OPENSSL_DEP)
diff --git a/build.yaml b/build.yaml
index a4333b4773..8a6abb645b 100644
--- a/build.yaml
+++ b/build.yaml
@@ -1221,6 +1221,8 @@ libs:
- test/cpp/microbenchmarks/fullstack_context_mutators.h
- test/cpp/microbenchmarks/fullstack_fixtures.h
- test/cpp/microbenchmarks/helpers.h
+ src:
+ - test/cpp/microbenchmarks/helpers.cc
deps:
- benchmark
- grpc++
diff --git a/test/cpp/microbenchmarks/helpers.cc b/test/cpp/microbenchmarks/helpers.cc
new file mode 100644
index 0000000000..947e81ffd8
--- /dev/null
+++ b/test/cpp/microbenchmarks/helpers.cc
@@ -0,0 +1,65 @@
+/*
+ *
+ * Copyright 2017, Google Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+
+#include "test/cpp/microbenchmarks/helpers.h"
+
+void TrackCounters::Finish(benchmark::State &state) {
+ std::ostringstream out;
+ AddToLabel(out, state);
+ auto label = out.str();
+ if (label.length() && label[0] == ' ') {
+ label = label.substr(1);
+ }
+ state.SetLabel(label);
+}
+
+void TrackCounters::AddToLabel(std::ostream &out, benchmark::State &state) {
+#ifdef GPR_LOW_LEVEL_COUNTERS
+ out << " locks/iter:" << ((double)(gpr_atm_no_barrier_load(&gpr_mu_locks) -
+ mu_locks_at_start_) /
+ (double)state.iterations())
+ << " atm_cas/iter:"
+ << ((double)(gpr_atm_no_barrier_load(&gpr_counter_atm_cas) -
+ atm_cas_at_start_) /
+ (double)state.iterations())
+ << " atm_add/iter:"
+ << ((double)(gpr_atm_no_barrier_load(&gpr_counter_atm_add) -
+ atm_add_at_start_) /
+ (double)state.iterations());
+#endif
+ grpc_memory_counters counters_at_end = grpc_memory_counters_snapshot();
+ out << " allocs/iter:"
+ << ((double)(counters_at_end.total_allocs_absolute -
+ counters_at_start_.total_allocs_absolute) /
+ (double)state.iterations());
+}
diff --git a/test/cpp/microbenchmarks/helpers.h b/test/cpp/microbenchmarks/helpers.h
index ea9024dce5..42a8fbaf0b 100644
--- a/test/cpp/microbenchmarks/helpers.h
+++ b/test/cpp/microbenchmarks/helpers.h
@@ -74,36 +74,8 @@ extern "C" gpr_atm gpr_counter_atm_add;
class TrackCounters {
public:
- virtual void Finish(benchmark::State& state) {
- std::ostringstream out;
- AddToLabel(out, state);
- auto label = out.str();
- if (label.length() && label[0] == ' ') {
- label = label.substr(1);
- }
- state.SetLabel(label);
- }
-
- virtual void AddToLabel(std::ostream& out, benchmark::State& state) {
-#ifdef GPR_LOW_LEVEL_COUNTERS
- out << " locks/iter:" << ((double)(gpr_atm_no_barrier_load(&gpr_mu_locks) -
- mu_locks_at_start_) /
- (double)state.iterations())
- << " atm_cas/iter:"
- << ((double)(gpr_atm_no_barrier_load(&gpr_counter_atm_cas) -
- atm_cas_at_start_) /
- (double)state.iterations())
- << " atm_add/iter:"
- << ((double)(gpr_atm_no_barrier_load(&gpr_counter_atm_add) -
- atm_add_at_start_) /
- (double)state.iterations());
-#endif
- grpc_memory_counters counters_at_end = grpc_memory_counters_snapshot();
- out << " allocs/iter:"
- << ((double)(counters_at_end.total_allocs_absolute -
- counters_at_start_.total_allocs_absolute) /
- (double)state.iterations());
- }
+ virtual void Finish(benchmark::State& state);
+ virtual void AddToLabel(std::ostream& out, benchmark::State& state);
private:
#ifdef GPR_LOW_LEVEL_COUNTERS
diff --git a/tools/run_tests/generated/sources_and_headers.json b/tools/run_tests/generated/sources_and_headers.json
index 9162c2af60..0a0cba36dc 100644
--- a/tools/run_tests/generated/sources_and_headers.json
+++ b/tools/run_tests/generated/sources_and_headers.json
@@ -5795,6 +5795,7 @@
"src": [
"test/cpp/microbenchmarks/fullstack_context_mutators.h",
"test/cpp/microbenchmarks/fullstack_fixtures.h",
+ "test/cpp/microbenchmarks/helpers.cc",
"test/cpp/microbenchmarks/helpers.h"
],
"third_party": false,
diff --git a/tools/run_tests/run_microbenchmark.py b/tools/run_tests/run_microbenchmark.py
index 9153b5c1f6..4fb1d5fc7c 100755
--- a/tools/run_tests/run_microbenchmark.py
+++ b/tools/run_tests/run_microbenchmark.py
@@ -199,8 +199,7 @@ argp.add_argument('-c', '--collect',
default=sorted(collectors.keys()),
help='Which collectors should be run against each benchmark')
argp.add_argument('-b', '--benchmarks',
- default=['bm_fullstack_trickle',
- 'bm_fullstack_unary_ping_pong',
+ default=['bm_fullstack_unary_ping_pong',
'bm_fullstack_streaming_ping_pong',
'bm_fullstack_streaming_pump',
'bm_closure',
@@ -208,7 +207,9 @@ argp.add_argument('-b', '--benchmarks',
'bm_call_create',
'bm_error',
'bm_chttp2_hpack',
- 'bm_metadata'],
+ 'bm_metadata',
+ 'bm_fullstack_trickle',
+ ],
nargs='+',
type=str,
help='Which microbenchmarks should be run')
diff --git a/vsprojects/vcxproj/test/grpc_benchmark/grpc_benchmark.vcxproj b/vsprojects/vcxproj/test/grpc_benchmark/grpc_benchmark.vcxproj
index d19df9d350..58586f0cb8 100644
--- a/vsprojects/vcxproj/test/grpc_benchmark/grpc_benchmark.vcxproj
+++ b/vsprojects/vcxproj/test/grpc_benchmark/grpc_benchmark.vcxproj
@@ -165,7 +165,7 @@
<ClInclude Include="$(SolutionDir)\..\test\cpp\microbenchmarks\helpers.h" />
</ItemGroup>
<ItemGroup>
- <ClCompile Include="$(SolutionDir)\..\vsprojects\dummy.c">
+ <ClCompile Include="$(SolutionDir)\..\test\cpp\microbenchmarks\helpers.cc">
</ClCompile>
</ItemGroup>
<ItemGroup>
diff --git a/vsprojects/vcxproj/test/grpc_benchmark/grpc_benchmark.vcxproj.filters b/vsprojects/vcxproj/test/grpc_benchmark/grpc_benchmark.vcxproj.filters
index 3e003edd5e..8e865bcc1b 100644
--- a/vsprojects/vcxproj/test/grpc_benchmark/grpc_benchmark.vcxproj.filters
+++ b/vsprojects/vcxproj/test/grpc_benchmark/grpc_benchmark.vcxproj.filters
@@ -1,6 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
+ <ClCompile Include="$(SolutionDir)\..\test\cpp\microbenchmarks\helpers.cc">
+ <Filter>test\cpp\microbenchmarks</Filter>
+ </ClCompile>
+ </ItemGroup>
+ <ItemGroup>
<ClInclude Include="$(SolutionDir)\..\test\cpp\microbenchmarks\fullstack_context_mutators.h">
<Filter>test\cpp\microbenchmarks</Filter>
</ClInclude>