Merge branch 'fssplit' of github.com:ctiller/grpc into fssplit

pull/9977/head
Craig Tiller 8 years ago
commit 5ea6c9f364
  1. 1
      CMakeLists.txt
  2. 2
      Makefile
  3. 2
      build.yaml
  4. 65
      test/cpp/microbenchmarks/helpers.cc
  5. 32
      test/cpp/microbenchmarks/helpers.h
  6. 1
      tools/run_tests/generated/sources_and_headers.json
  7. 7
      tools/run_tests/run_microbenchmark.py
  8. 2
      vsprojects/vcxproj/test/grpc_benchmark/grpc_benchmark.vcxproj
  9. 5
      vsprojects/vcxproj/test/grpc_benchmark/grpc_benchmark.vcxproj.filters

@ -3106,6 +3106,7 @@ endif()
if (gRPC_BUILD_TESTS)
add_library(grpc_benchmark
test/cpp/microbenchmarks/helpers.cc
)
if(WIN32 AND MSVC)

@ -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)

@ -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++

@ -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());
}

@ -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

@ -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,

@ -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')

@ -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>

@ -1,5 +1,10 @@
<?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>

Loading…
Cancel
Save