mirror of https://github.com/grpc/grpc.git
commit
e414d6cf00
46 changed files with 1015 additions and 697 deletions
@ -0,0 +1,160 @@ |
||||
# gRPC Error |
||||
|
||||
## Background |
||||
|
||||
`grpc_error` is the c-core's opaque representation of an error. It holds a |
||||
collection of integers, strings, timestamps, and child errors that related to |
||||
the final error. |
||||
|
||||
always present are: |
||||
|
||||
* GRPC_ERROR_STR_FILE and GRPC_ERROR_INT_FILE_LINE - the source location where |
||||
the error was generated |
||||
* GRPC_ERROR_STR_DESCRIPTION - a human readable description of the error |
||||
* GRPC_ERROR_TIME_CREATED - a timestamp indicating when the error happened |
||||
|
||||
An error can also have children; these are other errors that are believed to |
||||
have contributed to this one. By accumulating children, we can begin to root |
||||
cause high level failures from low level failures, without having to derive |
||||
execution paths from log lines. |
||||
|
||||
grpc_errors are refcounted objects, which means they need strict ownership |
||||
semantics. An extra ref on an error can cause a memory leak, and a missing ref |
||||
can cause a crash. |
||||
|
||||
This document serves as a detailed overview of grpc_error's ownership rules. It |
||||
should help people use the errors, as well as help people debug refcount related |
||||
errors. |
||||
|
||||
## Clarification of Ownership |
||||
|
||||
If a particular function is said to "own" an error, that means it has the |
||||
responsibility of calling unref on the error. A function may have access to an |
||||
error without ownership of it. |
||||
|
||||
This means the function may use the error, but must not call unref on it, since |
||||
that will be done elsewhere in the code. A function that does not own an error |
||||
may explicitly take ownership of it by manually calling GRPC_ERROR_REF. |
||||
|
||||
## Ownership Rules |
||||
|
||||
There are three rules of error ownership, which we will go over in detail. |
||||
|
||||
* If `grpc_error` is returned by a function, the caller owns a ref to that |
||||
instance. |
||||
* If a `grpc_error` is passed to a `grpc_closure` callback function, then that |
||||
function does not own a ref to the error. |
||||
* if a `grpc_error` is passed to *any other function*, then that function |
||||
takes ownership of the error. |
||||
|
||||
### Rule 1 |
||||
|
||||
> If `grpc_error` is returned by a function, the caller owns a ref to that |
||||
> instance.* |
||||
|
||||
For example, in the following code block, error1 and error2 are owned by the |
||||
current function. |
||||
|
||||
```C |
||||
grpc_error* error1 = GRPC_ERROR_CREATE("Some error occured"); |
||||
grpc_error* error2 = some_operation_that_might_fail(...); |
||||
``` |
||||
|
||||
The current function would have to explicitly call GRPC_ERROR_UNREF on the |
||||
errors, or pass them along to a function that would take over the ownership. |
||||
|
||||
### Rule 2 |
||||
|
||||
> If a `grpc_error` is passed to a `grpc_closure` callback function, then that |
||||
> function does not own a ref to the error. |
||||
|
||||
A `grpc_closure` callback function is any function that has the signature: |
||||
|
||||
```C |
||||
void (*cb)(grpc_exec_ctx *exec_ctx, void *arg, grpc_error *error); |
||||
``` |
||||
|
||||
This means that the error ownership is NOT transferred when a functions calls: |
||||
|
||||
```C |
||||
c->cb(exec_ctx, c->cb_arg, err); |
||||
``` |
||||
|
||||
The caller is still responsible for unref-ing the error. |
||||
|
||||
However, the above line is currently being phased out! It is safer to invoke |
||||
callbacks with `grpc_closure_run` and `grpc_closure_sched`. These functions are |
||||
not callbacks, so they will take ownership of the error passed to them. |
||||
|
||||
```C |
||||
grpc_error* error = GRPC_ERROR_CREATE("Some error occured"); |
||||
grpc_closure_run(exec_ctx, cb, error); |
||||
// current function no longer has ownership of the error |
||||
``` |
||||
|
||||
If you schedule or run a closure, but still need ownership of the error, then |
||||
you must explicitly take a reference. |
||||
|
||||
```C |
||||
grpc_error* error = GRPC_ERROR_CREATE("Some error occured"); |
||||
grpc_closure_run(exec_ctx, cb, GRPC_ERROR_REF(error)); |
||||
// do some other things with the error |
||||
GRPC_ERROR_UNREF(error); |
||||
``` |
||||
|
||||
Rule 2 is more important to keep in mind when **implementing** `grpc_closure` |
||||
callback functions. You must keep in mind that you do not own the error, and |
||||
must not unref it. More importantly, you cannot pass it to any function that |
||||
would take ownership of the error, without explicitly taking ownership yourself. |
||||
For example: |
||||
|
||||
```C |
||||
void on_some_action(grpc_exec_ctx *exec_ctx, void *arg, grpc_error *error) { |
||||
// this would cause a crash, because some_function will unref the error, |
||||
// and the caller of this callback will also unref it. |
||||
some_function(error); |
||||
|
||||
// this callback function must take ownership, so it can give that |
||||
// ownership to the function it is calling. |
||||
some_function(GRPC_ERROR_REF(error)); |
||||
} |
||||
``` |
||||
|
||||
### Rule 3 |
||||
|
||||
> if a `grpc_error` is passed to *any other function*, then that function takes |
||||
> ownership of the error. |
||||
|
||||
Take the following example: |
||||
|
||||
```C |
||||
grpc_error* error = GRPC_ERROR_CREATE("Some error occured"); |
||||
// do some things |
||||
some_function(error); |
||||
// can't use error anymore! might be gone. |
||||
``` |
||||
|
||||
When some_function is called, it takes over the ownership of the error, and it |
||||
will eventually unref it. So the caller can no longer safely use the error. |
||||
|
||||
If the caller needed to keep using the error (or passing it to other functions), |
||||
if would have to take on a reference to it. This is a common pattern seen. |
||||
|
||||
```C |
||||
void func() { |
||||
grpc_error* error = GRPC_ERROR_CREATE("Some error occured"); |
||||
some_function(GRPC_ERROR_REF(error)); |
||||
// do things |
||||
some_other_function(GRPC_ERROR_REF(error)); |
||||
// do more things |
||||
some_last_function(error); |
||||
} |
||||
``` |
||||
|
||||
The last call takes ownership and will eventually give the error its final |
||||
unref. |
||||
|
||||
When **implementing** a function that takes an error (and is not a |
||||
`grpc_closure` callback function), you must ensure the error is unref-ed either |
||||
by doing it explicitly with GRPC_ERROR_UNREF, or by passing the error to a |
||||
function that takes over the ownership. |
@ -1,7 +1,8 @@ |
||||
This is the static code generation variant of the Node examples. Code in these examples is pre-generated using protoc and the Node gRPC protoc plugin, and the generated code can be found in various `*_pb.js` files. The command line sequence for generating those files is as follows (assuming that `protoc` and `grpc_node_plugin` are present, and starting in the base directory of this package): |
||||
This is the static code generation variant of the Node examples. Code in these examples is pre-generated using protoc and the Node gRPC protoc plugin, and the generated code can be found in various `*_pb.js` files. The command line sequence for generating those files is as follows (assuming that `protoc` and `grpc_node_plugin` are present, and starting in the directory which contains this README.md file): |
||||
|
||||
```sh |
||||
cd ../protos |
||||
protoc --js_out=import_style=commonjs,binary:../node/static_codegen/ --grpc_out=../node/static_codegen --plugin=protoc-gen-grpc=grpc_node_plugin helloworld.proto |
||||
protoc --js_out=import_style=commonjs,binary:../node/static_codegen/route_guide/ --grpc_out=../node/static_codegen/route_guide/ --plugin=protoc-gen-grpc=grpc_node_plugin route_guide.proto |
||||
cd ../../protos |
||||
npm install -g grpc-tools |
||||
grpc_tools_node_protoc --js_out=import_style=commonjs,binary:../node/static_codegen/ --grpc_out=../node/static_codegen --plugin=protoc-gen-grpc=`which grpc_tools_node_protoc_plugin` helloworld.proto |
||||
grpc_tools_node_protoc --js_out=import_style=commonjs,binary:../node/static_codegen/route_guide/ --grpc_out=../node/static_codegen/route_guide/ --plugin=protoc-gen-grpc=`which grpc_tools_node_protoc_plugin` route_guide.proto |
||||
``` |
||||
|
@ -1,38 +0,0 @@ |
||||
/*
|
||||
* |
||||
* Copyright 2015, 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 <grpc/slice.h> |
||||
#include "src/core/lib/iomgr/resolve_address.h" |
||||
|
||||
void grpc_set_default_initial_connect_string(grpc_resolved_address **addr, |
||||
grpc_slice *initial_str) {} |
@ -1,52 +0,0 @@ |
||||
/*
|
||||
* |
||||
* Copyright 2015, 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 "src/core/ext/client_channel/initial_connect_string.h" |
||||
|
||||
#include <stddef.h> |
||||
|
||||
extern void grpc_set_default_initial_connect_string( |
||||
grpc_resolved_address **addr, grpc_slice *initial_str); |
||||
|
||||
static grpc_set_initial_connect_string_func g_set_initial_connect_string_func = |
||||
grpc_set_default_initial_connect_string; |
||||
|
||||
void grpc_test_set_initial_connect_string_function( |
||||
grpc_set_initial_connect_string_func func) { |
||||
g_set_initial_connect_string_func = func; |
||||
} |
||||
|
||||
void grpc_set_initial_connect_string(grpc_resolved_address **addr, |
||||
grpc_slice *initial_str) { |
||||
g_set_initial_connect_string_func(addr, initial_str); |
||||
} |
@ -1,50 +0,0 @@ |
||||
/*
|
||||
* |
||||
* Copyright 2015, 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. |
||||
* |
||||
*/ |
||||
|
||||
#ifndef GRPC_CORE_EXT_CLIENT_CHANNEL_INITIAL_CONNECT_STRING_H |
||||
#define GRPC_CORE_EXT_CLIENT_CHANNEL_INITIAL_CONNECT_STRING_H |
||||
|
||||
#include <grpc/slice.h> |
||||
#include "src/core/lib/iomgr/resolve_address.h" |
||||
|
||||
typedef void (*grpc_set_initial_connect_string_func)( |
||||
grpc_resolved_address **addr, grpc_slice *initial_str); |
||||
|
||||
void grpc_test_set_initial_connect_string_function( |
||||
grpc_set_initial_connect_string_func func); |
||||
|
||||
/** Set a string to be sent once connected. Optionally reset addr. */ |
||||
void grpc_set_initial_connect_string(grpc_resolved_address **addr, |
||||
grpc_slice *connect_string); |
||||
|
||||
#endif /* GRPC_CORE_EXT_CLIENT_CHANNEL_INITIAL_CONNECT_STRING_H */ |
Binary file not shown.
@ -0,0 +1,587 @@ |
||||
/*
|
||||
* |
||||
* Copyright 2015, 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. |
||||
* |
||||
*/ |
||||
|
||||
/* Microbenchmarks around CHTTP2 transport operations */ |
||||
|
||||
#include <grpc++/support/channel_arguments.h> |
||||
#include <grpc/support/alloc.h> |
||||
#include <grpc/support/log.h> |
||||
#include <grpc/support/string_util.h> |
||||
#include <string.h> |
||||
#include <memory> |
||||
#include <queue> |
||||
#include <sstream> |
||||
extern "C" { |
||||
#include "src/core/ext/transport/chttp2/transport/chttp2_transport.h" |
||||
#include "src/core/ext/transport/chttp2/transport/internal.h" |
||||
#include "src/core/lib/iomgr/resource_quota.h" |
||||
#include "src/core/lib/slice/slice_internal.h" |
||||
#include "src/core/lib/transport/static_metadata.h" |
||||
} |
||||
#include "test/cpp/microbenchmarks/helpers.h" |
||||
#include "third_party/benchmark/include/benchmark/benchmark.h" |
||||
|
||||
auto &force_library_initialization = Library::get(); |
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Helper classes
|
||||
//
|
||||
|
||||
class DummyEndpoint : public grpc_endpoint { |
||||
public: |
||||
DummyEndpoint() { |
||||
static const grpc_endpoint_vtable my_vtable = {read, |
||||
write, |
||||
get_workqueue, |
||||
add_to_pollset, |
||||
add_to_pollset_set, |
||||
shutdown, |
||||
destroy, |
||||
get_resource_user, |
||||
get_peer, |
||||
get_fd}; |
||||
grpc_endpoint::vtable = &my_vtable; |
||||
ru_ = grpc_resource_user_create(Library::get().rq(), "dummy_endpoint"); |
||||
} |
||||
|
||||
void PushInput(grpc_exec_ctx *exec_ctx, grpc_slice slice) { |
||||
if (read_cb_ == nullptr) { |
||||
GPR_ASSERT(!have_slice_); |
||||
buffered_slice_ = slice; |
||||
have_slice_ = true; |
||||
return; |
||||
} |
||||
grpc_slice_buffer_add(slices_, slice); |
||||
grpc_closure_sched(exec_ctx, read_cb_, GRPC_ERROR_NONE); |
||||
read_cb_ = nullptr; |
||||
} |
||||
|
||||
private: |
||||
grpc_resource_user *ru_; |
||||
grpc_closure *read_cb_ = nullptr; |
||||
grpc_slice_buffer *slices_ = nullptr; |
||||
bool have_slice_ = false; |
||||
grpc_slice buffered_slice_; |
||||
|
||||
void QueueRead(grpc_exec_ctx *exec_ctx, grpc_slice_buffer *slices, |
||||
grpc_closure *cb) { |
||||
GPR_ASSERT(read_cb_ == nullptr); |
||||
if (have_slice_) { |
||||
have_slice_ = false; |
||||
grpc_slice_buffer_add(slices, buffered_slice_); |
||||
grpc_closure_sched(exec_ctx, cb, GRPC_ERROR_NONE); |
||||
return; |
||||
} |
||||
read_cb_ = cb; |
||||
slices_ = slices; |
||||
} |
||||
|
||||
static void read(grpc_exec_ctx *exec_ctx, grpc_endpoint *ep, |
||||
grpc_slice_buffer *slices, grpc_closure *cb) { |
||||
static_cast<DummyEndpoint *>(ep)->QueueRead(exec_ctx, slices, cb); |
||||
} |
||||
|
||||
static void write(grpc_exec_ctx *exec_ctx, grpc_endpoint *ep, |
||||
grpc_slice_buffer *slices, grpc_closure *cb) { |
||||
grpc_closure_sched(exec_ctx, cb, GRPC_ERROR_NONE); |
||||
} |
||||
|
||||
static grpc_workqueue *get_workqueue(grpc_endpoint *ep) { return NULL; } |
||||
|
||||
static void add_to_pollset(grpc_exec_ctx *exec_ctx, grpc_endpoint *ep, |
||||
grpc_pollset *pollset) {} |
||||
|
||||
static void add_to_pollset_set(grpc_exec_ctx *exec_ctx, grpc_endpoint *ep, |
||||
grpc_pollset_set *pollset) {} |
||||
|
||||
static void shutdown(grpc_exec_ctx *exec_ctx, grpc_endpoint *ep, |
||||
grpc_error *why) { |
||||
grpc_resource_user_shutdown(exec_ctx, |
||||
static_cast<DummyEndpoint *>(ep)->ru_); |
||||
grpc_closure_sched(exec_ctx, static_cast<DummyEndpoint *>(ep)->read_cb_, |
||||
why); |
||||
} |
||||
|
||||
static void destroy(grpc_exec_ctx *exec_ctx, grpc_endpoint *ep) { |
||||
grpc_resource_user_unref(exec_ctx, static_cast<DummyEndpoint *>(ep)->ru_); |
||||
delete static_cast<DummyEndpoint *>(ep); |
||||
} |
||||
|
||||
static grpc_resource_user *get_resource_user(grpc_endpoint *ep) { |
||||
return static_cast<DummyEndpoint *>(ep)->ru_; |
||||
} |
||||
static char *get_peer(grpc_endpoint *ep) { return gpr_strdup("test"); } |
||||
static int get_fd(grpc_endpoint *ep) { return 0; } |
||||
}; |
||||
|
||||
class Fixture { |
||||
public: |
||||
Fixture(const grpc::ChannelArguments &args, bool client) { |
||||
grpc_channel_args c_args = args.c_channel_args(); |
||||
ep_ = new DummyEndpoint; |
||||
t_ = grpc_create_chttp2_transport(exec_ctx(), &c_args, ep_, client); |
||||
grpc_chttp2_transport_start_reading(exec_ctx(), t_, NULL); |
||||
FlushExecCtx(); |
||||
} |
||||
|
||||
void FlushExecCtx() { grpc_exec_ctx_flush(&exec_ctx_); } |
||||
|
||||
~Fixture() { |
||||
grpc_transport_destroy(&exec_ctx_, t_); |
||||
grpc_exec_ctx_finish(&exec_ctx_); |
||||
} |
||||
|
||||
grpc_chttp2_transport *chttp2_transport() { |
||||
return reinterpret_cast<grpc_chttp2_transport *>(t_); |
||||
} |
||||
grpc_transport *transport() { return t_; } |
||||
grpc_exec_ctx *exec_ctx() { return &exec_ctx_; } |
||||
|
||||
void PushInput(grpc_slice slice) { ep_->PushInput(exec_ctx(), slice); } |
||||
|
||||
private: |
||||
DummyEndpoint *ep_; |
||||
grpc_exec_ctx exec_ctx_ = GRPC_EXEC_CTX_INIT; |
||||
grpc_transport *t_; |
||||
}; |
||||
|
||||
static void DoNothing(grpc_exec_ctx *exec_ctx, void *arg, grpc_error *error) {} |
||||
|
||||
class Stream { |
||||
public: |
||||
Stream(Fixture *f) : f_(f) { |
||||
GRPC_STREAM_REF_INIT(&refcount_, 1, DoNothing, nullptr, "test_stream"); |
||||
stream_size_ = grpc_transport_stream_size(f->transport()); |
||||
stream_ = gpr_malloc(stream_size_); |
||||
arena_ = gpr_arena_create(4096); |
||||
} |
||||
|
||||
~Stream() { |
||||
gpr_free(stream_); |
||||
gpr_arena_destroy(arena_); |
||||
} |
||||
|
||||
void Init(benchmark::State &state) { |
||||
memset(stream_, 0, stream_size_); |
||||
if ((state.iterations() & 0xffff) == 0) { |
||||
gpr_arena_destroy(arena_); |
||||
arena_ = gpr_arena_create(4096); |
||||
} |
||||
grpc_transport_init_stream(f_->exec_ctx(), f_->transport(), |
||||
static_cast<grpc_stream *>(stream_), &refcount_, |
||||
NULL, arena_); |
||||
} |
||||
|
||||
void DestroyThen(grpc_closure *closure) { |
||||
grpc_transport_destroy_stream(f_->exec_ctx(), f_->transport(), |
||||
static_cast<grpc_stream *>(stream_), closure); |
||||
} |
||||
|
||||
void Op(grpc_transport_stream_op *op) { |
||||
grpc_transport_perform_stream_op(f_->exec_ctx(), f_->transport(), |
||||
static_cast<grpc_stream *>(stream_), op); |
||||
} |
||||
|
||||
grpc_chttp2_stream *chttp2_stream() { |
||||
return static_cast<grpc_chttp2_stream *>(stream_); |
||||
} |
||||
|
||||
private: |
||||
Fixture *f_; |
||||
grpc_stream_refcount refcount_; |
||||
gpr_arena *arena_; |
||||
size_t stream_size_; |
||||
void *stream_; |
||||
}; |
||||
|
||||
class Closure : public grpc_closure { |
||||
public: |
||||
virtual ~Closure() {} |
||||
}; |
||||
|
||||
template <class F> |
||||
std::unique_ptr<Closure> MakeClosure( |
||||
F f, grpc_closure_scheduler *sched = grpc_schedule_on_exec_ctx) { |
||||
struct C : public Closure { |
||||
C(const F &f, grpc_closure_scheduler *sched) : f_(f) { |
||||
grpc_closure_init(this, Execute, this, sched); |
||||
} |
||||
F f_; |
||||
static void Execute(grpc_exec_ctx *exec_ctx, void *arg, grpc_error *error) { |
||||
static_cast<C *>(arg)->f_(exec_ctx, error); |
||||
} |
||||
}; |
||||
return std::unique_ptr<Closure>(new C(f, sched)); |
||||
} |
||||
|
||||
template <class F> |
||||
grpc_closure *MakeOnceClosure( |
||||
F f, grpc_closure_scheduler *sched = grpc_schedule_on_exec_ctx) { |
||||
struct C : public grpc_closure { |
||||
C(const F &f) : f_(f) {} |
||||
F f_; |
||||
static void Execute(grpc_exec_ctx *exec_ctx, void *arg, grpc_error *error) { |
||||
static_cast<C *>(arg)->f_(exec_ctx, error); |
||||
delete static_cast<C *>(arg); |
||||
} |
||||
}; |
||||
auto *c = new C{f}; |
||||
return grpc_closure_init(c, C::Execute, c, sched); |
||||
} |
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Benchmarks
|
||||
//
|
||||
|
||||
static void BM_StreamCreateDestroy(benchmark::State &state) { |
||||
TrackCounters track_counters; |
||||
Fixture f(grpc::ChannelArguments(), true); |
||||
Stream s(&f); |
||||
std::unique_ptr<Closure> next = |
||||
MakeClosure([&](grpc_exec_ctx *exec_ctx, grpc_error *error) { |
||||
if (!state.KeepRunning()) return; |
||||
s.Init(state); |
||||
s.DestroyThen(next.get()); |
||||
}); |
||||
grpc_closure_run(f.exec_ctx(), next.get(), GRPC_ERROR_NONE); |
||||
f.FlushExecCtx(); |
||||
track_counters.Finish(state); |
||||
} |
||||
BENCHMARK(BM_StreamCreateDestroy); |
||||
|
||||
class RepresentativeClientInitialMetadata { |
||||
public: |
||||
static std::vector<grpc_mdelem> GetElems(grpc_exec_ctx *exec_ctx) { |
||||
return { |
||||
GRPC_MDELEM_SCHEME_HTTP, GRPC_MDELEM_METHOD_POST, |
||||
grpc_mdelem_from_slices( |
||||
exec_ctx, GRPC_MDSTR_PATH, |
||||
grpc_slice_intern(grpc_slice_from_static_string("/foo/bar"))), |
||||
grpc_mdelem_from_slices(exec_ctx, GRPC_MDSTR_AUTHORITY, |
||||
grpc_slice_intern(grpc_slice_from_static_string( |
||||
"foo.test.google.fr:1234"))), |
||||
GRPC_MDELEM_GRPC_ACCEPT_ENCODING_IDENTITY_COMMA_DEFLATE_COMMA_GZIP, |
||||
GRPC_MDELEM_TE_TRAILERS, |
||||
GRPC_MDELEM_CONTENT_TYPE_APPLICATION_SLASH_GRPC, |
||||
grpc_mdelem_from_slices( |
||||
exec_ctx, GRPC_MDSTR_USER_AGENT, |
||||
grpc_slice_intern(grpc_slice_from_static_string( |
||||
"grpc-c/3.0.0-dev (linux; chttp2; green)")))}; |
||||
} |
||||
}; |
||||
|
||||
template <class Metadata> |
||||
static void BM_StreamCreateSendInitialMetadataDestroy(benchmark::State &state) { |
||||
TrackCounters track_counters; |
||||
Fixture f(grpc::ChannelArguments(), true); |
||||
Stream s(&f); |
||||
grpc_transport_stream_op op; |
||||
std::unique_ptr<Closure> start; |
||||
std::unique_ptr<Closure> done; |
||||
|
||||
grpc_metadata_batch b; |
||||
grpc_metadata_batch_init(&b); |
||||
b.deadline = gpr_inf_future(GPR_CLOCK_MONOTONIC); |
||||
std::vector<grpc_mdelem> elems = Metadata::GetElems(f.exec_ctx()); |
||||
std::vector<grpc_linked_mdelem> storage(elems.size()); |
||||
for (size_t i = 0; i < elems.size(); i++) { |
||||
GPR_ASSERT(GRPC_LOG_IF_ERROR( |
||||
"addmd", |
||||
grpc_metadata_batch_add_tail(f.exec_ctx(), &b, &storage[i], elems[i]))); |
||||
} |
||||
|
||||
f.FlushExecCtx(); |
||||
start = MakeClosure([&](grpc_exec_ctx *exec_ctx, grpc_error *error) { |
||||
if (!state.KeepRunning()) return; |
||||
s.Init(state); |
||||
memset(&op, 0, sizeof(op)); |
||||
op.on_complete = done.get(); |
||||
op.send_initial_metadata = &b; |
||||
s.Op(&op); |
||||
}); |
||||
done = MakeClosure([&](grpc_exec_ctx *exec_ctx, grpc_error *error) { |
||||
memset(&op, 0, sizeof(op)); |
||||
op.cancel_error = GRPC_ERROR_CANCELLED; |
||||
s.Op(&op); |
||||
s.DestroyThen(start.get()); |
||||
}); |
||||
grpc_closure_sched(f.exec_ctx(), start.get(), GRPC_ERROR_NONE); |
||||
f.FlushExecCtx(); |
||||
grpc_metadata_batch_destroy(f.exec_ctx(), &b); |
||||
track_counters.Finish(state); |
||||
} |
||||
BENCHMARK_TEMPLATE(BM_StreamCreateSendInitialMetadataDestroy, |
||||
RepresentativeClientInitialMetadata); |
||||
|
||||
static void BM_TransportEmptyOp(benchmark::State &state) { |
||||
TrackCounters track_counters; |
||||
Fixture f(grpc::ChannelArguments(), true); |
||||
Stream s(&f); |
||||
s.Init(state); |
||||
grpc_transport_stream_op op; |
||||
std::unique_ptr<Closure> c = |
||||
MakeClosure([&](grpc_exec_ctx *exec_ctx, grpc_error *error) { |
||||
if (!state.KeepRunning()) return; |
||||
memset(&op, 0, sizeof(op)); |
||||
op.on_complete = c.get(); |
||||
s.Op(&op); |
||||
}); |
||||
grpc_closure_sched(f.exec_ctx(), c.get(), GRPC_ERROR_NONE); |
||||
f.FlushExecCtx(); |
||||
s.DestroyThen( |
||||
MakeOnceClosure([](grpc_exec_ctx *exec_ctx, grpc_error *error) {})); |
||||
f.FlushExecCtx(); |
||||
track_counters.Finish(state); |
||||
} |
||||
BENCHMARK(BM_TransportEmptyOp); |
||||
|
||||
static void BM_TransportStreamSend(benchmark::State &state) { |
||||
TrackCounters track_counters; |
||||
Fixture f(grpc::ChannelArguments(), true); |
||||
Stream s(&f); |
||||
s.Init(state); |
||||
grpc_transport_stream_op op; |
||||
grpc_slice_buffer_stream send_stream; |
||||
grpc_slice_buffer send_buffer; |
||||
grpc_slice_buffer_init(&send_buffer); |
||||
grpc_slice_buffer_add(&send_buffer, gpr_slice_malloc(state.range(0))); |
||||
memset(GRPC_SLICE_START_PTR(send_buffer.slices[0]), 0, |
||||
GRPC_SLICE_LENGTH(send_buffer.slices[0])); |
||||
|
||||
grpc_metadata_batch b; |
||||
grpc_metadata_batch_init(&b); |
||||
b.deadline = gpr_inf_future(GPR_CLOCK_MONOTONIC); |
||||
std::vector<grpc_mdelem> elems = |
||||
RepresentativeClientInitialMetadata::GetElems(f.exec_ctx()); |
||||
std::vector<grpc_linked_mdelem> storage(elems.size()); |
||||
for (size_t i = 0; i < elems.size(); i++) { |
||||
GPR_ASSERT(GRPC_LOG_IF_ERROR( |
||||
"addmd", |
||||
grpc_metadata_batch_add_tail(f.exec_ctx(), &b, &storage[i], elems[i]))); |
||||
} |
||||
|
||||
std::unique_ptr<Closure> c = |
||||
MakeClosure([&](grpc_exec_ctx *exec_ctx, grpc_error *error) { |
||||
if (!state.KeepRunning()) return; |
||||
// force outgoing window to be yuge
|
||||
s.chttp2_stream()->outgoing_window_delta = 1024 * 1024 * 1024; |
||||
f.chttp2_transport()->outgoing_window = 1024 * 1024 * 1024; |
||||
grpc_slice_buffer_stream_init(&send_stream, &send_buffer, 0); |
||||
memset(&op, 0, sizeof(op)); |
||||
op.on_complete = c.get(); |
||||
op.send_message = &send_stream.base; |
||||
s.Op(&op); |
||||
}); |
||||
|
||||
memset(&op, 0, sizeof(op)); |
||||
op.send_initial_metadata = &b; |
||||
op.on_complete = c.get(); |
||||
s.Op(&op); |
||||
|
||||
f.FlushExecCtx(); |
||||
memset(&op, 0, sizeof(op)); |
||||
op.cancel_error = GRPC_ERROR_CANCELLED; |
||||
s.Op(&op); |
||||
s.DestroyThen( |
||||
MakeOnceClosure([](grpc_exec_ctx *exec_ctx, grpc_error *error) {})); |
||||
f.FlushExecCtx(); |
||||
track_counters.Finish(state); |
||||
grpc_metadata_batch_destroy(f.exec_ctx(), &b); |
||||
grpc_slice_buffer_destroy(&send_buffer); |
||||
} |
||||
BENCHMARK(BM_TransportStreamSend)->Range(0, 128 * 1024 * 1024); |
||||
|
||||
#define SLICE_FROM_BUFFER(s) grpc_slice_from_static_buffer(s, sizeof(s) - 1) |
||||
|
||||
static grpc_slice CreateIncomingDataSlice(size_t length, size_t frame_size) { |
||||
std::queue<char> unframed; |
||||
|
||||
unframed.push(static_cast<uint8_t>(0)); |
||||
unframed.push(static_cast<uint8_t>(length >> 24)); |
||||
unframed.push(static_cast<uint8_t>(length >> 16)); |
||||
unframed.push(static_cast<uint8_t>(length >> 8)); |
||||
unframed.push(static_cast<uint8_t>(length)); |
||||
for (size_t i = 0; i < length; i++) { |
||||
unframed.push('a'); |
||||
} |
||||
|
||||
std::vector<char> framed; |
||||
while (unframed.size() > frame_size) { |
||||
// frame size
|
||||
framed.push_back(static_cast<uint8_t>(frame_size >> 16)); |
||||
framed.push_back(static_cast<uint8_t>(frame_size >> 8)); |
||||
framed.push_back(static_cast<uint8_t>(frame_size)); |
||||
// data frame
|
||||
framed.push_back(0); |
||||
// no flags
|
||||
framed.push_back(0); |
||||
// stream id
|
||||
framed.push_back(0); |
||||
framed.push_back(0); |
||||
framed.push_back(0); |
||||
framed.push_back(1); |
||||
// frame data
|
||||
for (size_t i = 0; i < frame_size; i++) { |
||||
framed.push_back(unframed.front()); |
||||
unframed.pop(); |
||||
} |
||||
} |
||||
|
||||
// frame size
|
||||
framed.push_back(static_cast<uint8_t>(unframed.size() >> 16)); |
||||
framed.push_back(static_cast<uint8_t>(unframed.size() >> 8)); |
||||
framed.push_back(static_cast<uint8_t>(unframed.size())); |
||||
// data frame
|
||||
framed.push_back(0); |
||||
// no flags
|
||||
framed.push_back(0); |
||||
// stream id
|
||||
framed.push_back(0); |
||||
framed.push_back(0); |
||||
framed.push_back(0); |
||||
framed.push_back(1); |
||||
while (!unframed.empty()) { |
||||
framed.push_back(unframed.front()); |
||||
unframed.pop(); |
||||
} |
||||
|
||||
return grpc_slice_from_copied_buffer(framed.data(), framed.size()); |
||||
} |
||||
|
||||
static void BM_TransportStreamRecv(benchmark::State &state) { |
||||
TrackCounters track_counters; |
||||
Fixture f(grpc::ChannelArguments(), true); |
||||
Stream s(&f); |
||||
s.Init(state); |
||||
grpc_transport_stream_op op; |
||||
grpc_byte_stream *recv_stream; |
||||
grpc_slice incoming_data = CreateIncomingDataSlice(state.range(0), 16384); |
||||
|
||||
grpc_metadata_batch b; |
||||
grpc_metadata_batch_init(&b); |
||||
grpc_metadata_batch b_recv; |
||||
grpc_metadata_batch_init(&b_recv); |
||||
b.deadline = gpr_inf_future(GPR_CLOCK_MONOTONIC); |
||||
std::vector<grpc_mdelem> elems = |
||||
RepresentativeClientInitialMetadata::GetElems(f.exec_ctx()); |
||||
std::vector<grpc_linked_mdelem> storage(elems.size()); |
||||
for (size_t i = 0; i < elems.size(); i++) { |
||||
GPR_ASSERT(GRPC_LOG_IF_ERROR( |
||||
"addmd", |
||||
grpc_metadata_batch_add_tail(f.exec_ctx(), &b, &storage[i], elems[i]))); |
||||
} |
||||
|
||||
std::unique_ptr<Closure> do_nothing = |
||||
MakeClosure([](grpc_exec_ctx *exec_ctx, grpc_error *error) {}); |
||||
|
||||
uint32_t received; |
||||
|
||||
std::unique_ptr<Closure> drain_start; |
||||
std::unique_ptr<Closure> drain; |
||||
std::unique_ptr<Closure> drain_continue; |
||||
grpc_slice recv_slice; |
||||
|
||||
std::unique_ptr<Closure> c = |
||||
MakeClosure([&](grpc_exec_ctx *exec_ctx, grpc_error *error) { |
||||
if (!state.KeepRunning()) return; |
||||
// force outgoing window to be yuge
|
||||
s.chttp2_stream()->incoming_window_delta = 1024 * 1024 * 1024; |
||||
f.chttp2_transport()->incoming_window = 1024 * 1024 * 1024; |
||||
received = 0; |
||||
memset(&op, 0, sizeof(op)); |
||||
op.on_complete = do_nothing.get(); |
||||
op.recv_message = &recv_stream; |
||||
op.recv_message_ready = drain_start.get(); |
||||
s.Op(&op); |
||||
f.PushInput(grpc_slice_ref(incoming_data)); |
||||
}); |
||||
|
||||
drain_start = MakeClosure([&](grpc_exec_ctx *exec_ctx, grpc_error *error) { |
||||
if (recv_stream == NULL) { |
||||
GPR_ASSERT(!state.KeepRunning()); |
||||
return; |
||||
} |
||||
grpc_closure_run(exec_ctx, drain.get(), GRPC_ERROR_NONE); |
||||
}); |
||||
|
||||
drain = MakeClosure([&](grpc_exec_ctx *exec_ctx, grpc_error *error) { |
||||
do { |
||||
if (received == recv_stream->length) { |
||||
grpc_byte_stream_destroy(exec_ctx, recv_stream); |
||||
grpc_closure_sched(exec_ctx, c.get(), GRPC_ERROR_NONE); |
||||
return; |
||||
} |
||||
} while (grpc_byte_stream_next(exec_ctx, recv_stream, &recv_slice, |
||||
recv_stream->length - received, |
||||
drain_continue.get())); |
||||
}); |
||||
|
||||
drain_continue = MakeClosure([&](grpc_exec_ctx *exec_ctx, grpc_error *error) { |
||||
received += GRPC_SLICE_LENGTH(recv_slice); |
||||
grpc_slice_unref_internal(exec_ctx, recv_slice); |
||||
grpc_closure_run(exec_ctx, drain.get(), GRPC_ERROR_NONE); |
||||
}); |
||||
|
||||
memset(&op, 0, sizeof(op)); |
||||
op.send_initial_metadata = &b; |
||||
op.recv_initial_metadata = &b_recv; |
||||
op.on_complete = c.get(); |
||||
s.Op(&op); |
||||
f.PushInput(SLICE_FROM_BUFFER( |
||||
"\x00\x00\x00\x04\x00\x00\x00\x00\x00" |
||||
// Generated using:
|
||||
// tools/codegen/core/gen_header_frame.py <
|
||||
// test/cpp/microbenchmarks/representative_server_initial_metadata.headers
|
||||
"\x00\x00X\x01\x04\x00\x00\x00\x01" |
||||
"\x10\x07:status\x03" |
||||
"200" |
||||
"\x10\x0c" |
||||
"content-type\x10" |
||||
"application/grpc" |
||||
"\x10\x14grpc-accept-encoding\x15identity,deflate,gzip")); |
||||
|
||||
f.FlushExecCtx(); |
||||
memset(&op, 0, sizeof(op)); |
||||
op.cancel_error = GRPC_ERROR_CANCELLED; |
||||
s.Op(&op); |
||||
s.DestroyThen( |
||||
MakeOnceClosure([](grpc_exec_ctx *exec_ctx, grpc_error *error) {})); |
||||
f.FlushExecCtx(); |
||||
track_counters.Finish(state); |
||||
grpc_metadata_batch_destroy(f.exec_ctx(), &b); |
||||
grpc_metadata_batch_destroy(f.exec_ctx(), &b_recv); |
||||
grpc_slice_unref(incoming_data); |
||||
} |
||||
BENCHMARK(BM_TransportStreamRecv)->Range(0, 128 * 1024 * 1024); |
||||
|
||||
BENCHMARK_MAIN(); |
@ -1,202 +0,0 @@ |
||||
<?xml version="1.0" encoding="utf-8"?> |
||||
<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> |
||||
<Import Project="$(SolutionDir)\..\vsprojects\packages\grpc.dependencies.openssl.1.0.204.1\build\native\grpc.dependencies.openssl.props" Condition="Exists('$(SolutionDir)\..\vsprojects\packages\grpc.dependencies.openssl.1.0.204.1\build\native\1.0.204.1.props')" /> |
||||
<ItemGroup Label="ProjectConfigurations"> |
||||
<ProjectConfiguration Include="Debug|Win32"> |
||||
<Configuration>Debug</Configuration> |
||||
<Platform>Win32</Platform> |
||||
</ProjectConfiguration> |
||||
<ProjectConfiguration Include="Debug|x64"> |
||||
<Configuration>Debug</Configuration> |
||||
<Platform>x64</Platform> |
||||
</ProjectConfiguration> |
||||
<ProjectConfiguration Include="Release|Win32"> |
||||
<Configuration>Release</Configuration> |
||||
<Platform>Win32</Platform> |
||||
</ProjectConfiguration> |
||||
<ProjectConfiguration Include="Release|x64"> |
||||
<Configuration>Release</Configuration> |
||||
<Platform>x64</Platform> |
||||
</ProjectConfiguration> |
||||
</ItemGroup> |
||||
<PropertyGroup Label="Globals"> |
||||
<ProjectGuid>{4A48E5A5-2E69-ED6D-063C-C297180A54D0}</ProjectGuid> |
||||
<IgnoreWarnIntDirInTempDetected>true</IgnoreWarnIntDirInTempDetected> |
||||
<IntDir>$(SolutionDir)IntDir\$(MSBuildProjectName)\</IntDir> |
||||
</PropertyGroup> |
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> |
||||
<PropertyGroup Condition="'$(VisualStudioVersion)' == '10.0'" Label="Configuration"> |
||||
<PlatformToolset>v100</PlatformToolset> |
||||
</PropertyGroup> |
||||
<PropertyGroup Condition="'$(VisualStudioVersion)' == '11.0'" Label="Configuration"> |
||||
<PlatformToolset>v110</PlatformToolset> |
||||
</PropertyGroup> |
||||
<PropertyGroup Condition="'$(VisualStudioVersion)' == '12.0'" Label="Configuration"> |
||||
<PlatformToolset>v120</PlatformToolset> |
||||
</PropertyGroup> |
||||
<PropertyGroup Condition="'$(VisualStudioVersion)' == '14.0'" Label="Configuration"> |
||||
<PlatformToolset>v140</PlatformToolset> |
||||
</PropertyGroup> |
||||
<PropertyGroup Condition="'$(Configuration)'=='Debug'" Label="Configuration"> |
||||
<ConfigurationType>Application</ConfigurationType> |
||||
<UseDebugLibraries>true</UseDebugLibraries> |
||||
<CharacterSet>Unicode</CharacterSet> |
||||
</PropertyGroup> |
||||
<PropertyGroup Condition="'$(Configuration)'=='Release'" Label="Configuration"> |
||||
<ConfigurationType>Application</ConfigurationType> |
||||
<UseDebugLibraries>false</UseDebugLibraries> |
||||
<WholeProgramOptimization>true</WholeProgramOptimization> |
||||
<CharacterSet>Unicode</CharacterSet> |
||||
</PropertyGroup> |
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> |
||||
<ImportGroup Label="ExtensionSettings"> |
||||
</ImportGroup> |
||||
<ImportGroup Label="PropertySheets"> |
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> |
||||
<Import Project="$(SolutionDir)\..\vsprojects\global.props" /> |
||||
<Import Project="$(SolutionDir)\..\vsprojects\openssl.props" /> |
||||
<Import Project="$(SolutionDir)\..\vsprojects\winsock.props" /> |
||||
<Import Project="$(SolutionDir)\..\vsprojects\zlib.props" /> |
||||
</ImportGroup> |
||||
<PropertyGroup Label="UserMacros" /> |
||||
<PropertyGroup Condition="'$(Configuration)'=='Debug'"> |
||||
<TargetName>set_initial_connect_string_test</TargetName> |
||||
<Linkage-grpc_dependencies_zlib>static</Linkage-grpc_dependencies_zlib> |
||||
<Configuration-grpc_dependencies_zlib>Debug</Configuration-grpc_dependencies_zlib> |
||||
<Linkage-grpc_dependencies_openssl>static</Linkage-grpc_dependencies_openssl> |
||||
<Configuration-grpc_dependencies_openssl>Debug</Configuration-grpc_dependencies_openssl> |
||||
</PropertyGroup> |
||||
<PropertyGroup Condition="'$(Configuration)'=='Release'"> |
||||
<TargetName>set_initial_connect_string_test</TargetName> |
||||
<Linkage-grpc_dependencies_zlib>static</Linkage-grpc_dependencies_zlib> |
||||
<Configuration-grpc_dependencies_zlib>Release</Configuration-grpc_dependencies_zlib> |
||||
<Linkage-grpc_dependencies_openssl>static</Linkage-grpc_dependencies_openssl> |
||||
<Configuration-grpc_dependencies_openssl>Release</Configuration-grpc_dependencies_openssl> |
||||
</PropertyGroup> |
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> |
||||
<ClCompile> |
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader> |
||||
<WarningLevel>Level3</WarningLevel> |
||||
<Optimization>Disabled</Optimization> |
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions> |
||||
<SDLCheck>true</SDLCheck> |
||||
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> |
||||
<TreatWarningAsError>true</TreatWarningAsError> |
||||
<DebugInformationFormat Condition="$(Jenkins)">None</DebugInformationFormat> |
||||
<MinimalRebuild Condition="$(Jenkins)">false</MinimalRebuild> |
||||
</ClCompile> |
||||
<Link> |
||||
<SubSystem>Console</SubSystem> |
||||
<GenerateDebugInformation Condition="!$(Jenkins)">true</GenerateDebugInformation> |
||||
<GenerateDebugInformation Condition="$(Jenkins)">false</GenerateDebugInformation> |
||||
</Link> |
||||
</ItemDefinitionGroup> |
||||
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> |
||||
<ClCompile> |
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader> |
||||
<WarningLevel>Level3</WarningLevel> |
||||
<Optimization>Disabled</Optimization> |
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions> |
||||
<SDLCheck>true</SDLCheck> |
||||
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> |
||||
<TreatWarningAsError>true</TreatWarningAsError> |
||||
<DebugInformationFormat Condition="$(Jenkins)">None</DebugInformationFormat> |
||||
<MinimalRebuild Condition="$(Jenkins)">false</MinimalRebuild> |
||||
</ClCompile> |
||||
<Link> |
||||
<SubSystem>Console</SubSystem> |
||||
<GenerateDebugInformation Condition="!$(Jenkins)">true</GenerateDebugInformation> |
||||
<GenerateDebugInformation Condition="$(Jenkins)">false</GenerateDebugInformation> |
||||
</Link> |
||||
</ItemDefinitionGroup> |
||||
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> |
||||
<ClCompile> |
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader> |
||||
<WarningLevel>Level3</WarningLevel> |
||||
<Optimization>MaxSpeed</Optimization> |
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions> |
||||
<FunctionLevelLinking>true</FunctionLevelLinking> |
||||
<IntrinsicFunctions>true</IntrinsicFunctions> |
||||
<SDLCheck>true</SDLCheck> |
||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary> |
||||
<TreatWarningAsError>true</TreatWarningAsError> |
||||
<DebugInformationFormat Condition="$(Jenkins)">None</DebugInformationFormat> |
||||
<MinimalRebuild Condition="$(Jenkins)">false</MinimalRebuild> |
||||
</ClCompile> |
||||
<Link> |
||||
<SubSystem>Console</SubSystem> |
||||
<GenerateDebugInformation Condition="!$(Jenkins)">true</GenerateDebugInformation> |
||||
<GenerateDebugInformation Condition="$(Jenkins)">false</GenerateDebugInformation> |
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding> |
||||
<OptimizeReferences>true</OptimizeReferences> |
||||
</Link> |
||||
</ItemDefinitionGroup> |
||||
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> |
||||
<ClCompile> |
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader> |
||||
<WarningLevel>Level3</WarningLevel> |
||||
<Optimization>MaxSpeed</Optimization> |
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions> |
||||
<FunctionLevelLinking>true</FunctionLevelLinking> |
||||
<IntrinsicFunctions>true</IntrinsicFunctions> |
||||
<SDLCheck>true</SDLCheck> |
||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary> |
||||
<TreatWarningAsError>true</TreatWarningAsError> |
||||
<DebugInformationFormat Condition="$(Jenkins)">None</DebugInformationFormat> |
||||
<MinimalRebuild Condition="$(Jenkins)">false</MinimalRebuild> |
||||
</ClCompile> |
||||
<Link> |
||||
<SubSystem>Console</SubSystem> |
||||
<GenerateDebugInformation Condition="!$(Jenkins)">true</GenerateDebugInformation> |
||||
<GenerateDebugInformation Condition="$(Jenkins)">false</GenerateDebugInformation> |
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding> |
||||
<OptimizeReferences>true</OptimizeReferences> |
||||
</Link> |
||||
</ItemDefinitionGroup> |
||||
|
||||
<ItemGroup> |
||||
<ClCompile Include="$(SolutionDir)\..\test\core\client_channel\set_initial_connect_string_test.c"> |
||||
</ClCompile> |
||||
</ItemGroup> |
||||
<ItemGroup> |
||||
<ProjectReference Include="$(SolutionDir)\..\vsprojects\vcxproj\.\test_tcp_server\test_tcp_server.vcxproj"> |
||||
<Project>{E3110C46-A148-FF65-08FD-3324829BE7FE}</Project> |
||||
</ProjectReference> |
||||
<ProjectReference Include="$(SolutionDir)\..\vsprojects\vcxproj\.\grpc_test_util\grpc_test_util.vcxproj"> |
||||
<Project>{17BCAFC0-5FDC-4C94-AEB9-95F3E220614B}</Project> |
||||
</ProjectReference> |
||||
<ProjectReference Include="$(SolutionDir)\..\vsprojects\vcxproj\.\grpc\grpc.vcxproj"> |
||||
<Project>{29D16885-7228-4C31-81ED-5F9187C7F2A9}</Project> |
||||
</ProjectReference> |
||||
<ProjectReference Include="$(SolutionDir)\..\vsprojects\vcxproj\.\gpr_test_util\gpr_test_util.vcxproj"> |
||||
<Project>{EAB0A629-17A9-44DB-B5FF-E91A721FE037}</Project> |
||||
</ProjectReference> |
||||
<ProjectReference Include="$(SolutionDir)\..\vsprojects\vcxproj\.\gpr\gpr.vcxproj"> |
||||
<Project>{B23D3D1A-9438-4EDA-BEB6-9A0A03D17792}</Project> |
||||
</ProjectReference> |
||||
</ItemGroup> |
||||
<ItemGroup> |
||||
<None Include="packages.config" /> |
||||
</ItemGroup> |
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> |
||||
<ImportGroup Label="ExtensionTargets"> |
||||
<Import Project="$(SolutionDir)\..\vsprojects\packages\grpc.dependencies.zlib.redist.1.2.8.10\build\native\grpc.dependencies.zlib.redist.targets" Condition="Exists('$(SolutionDir)\..\vsprojects\packages\grpc.dependencies.zlib.redist.1.2.8.10\build\native\grpc.dependencies\grpc.dependencies.zlib.targets')" /> |
||||
<Import Project="$(SolutionDir)\..\vsprojects\packages\grpc.dependencies.zlib.1.2.8.10\build\native\grpc.dependencies.zlib.targets" Condition="Exists('$(SolutionDir)\..\vsprojects\packages\grpc.dependencies.zlib.1.2.8.10\build\native\grpc.dependencies\grpc.dependencies.zlib.targets')" /> |
||||
<Import Project="$(SolutionDir)\..\vsprojects\packages\grpc.dependencies.openssl.redist.1.0.204.1\build\native\grpc.dependencies.openssl.redist.targets" Condition="Exists('$(SolutionDir)\..\vsprojects\packages\grpc.dependencies.openssl.redist.1.0.204.1\build\native\grpc.dependencies\grpc.dependencies.openssl.targets')" /> |
||||
<Import Project="$(SolutionDir)\..\vsprojects\packages\grpc.dependencies.openssl.1.0.204.1\build\native\grpc.dependencies.openssl.targets" Condition="Exists('$(SolutionDir)\..\vsprojects\packages\grpc.dependencies.openssl.1.0.204.1\build\native\grpc.dependencies\grpc.dependencies.openssl.targets')" /> |
||||
</ImportGroup> |
||||
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild"> |
||||
<PropertyGroup> |
||||
<ErrorText>This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText> |
||||
</PropertyGroup> |
||||
<Error Condition="!Exists('$(SolutionDir)\..\vsprojects\packages\grpc.dependencies.zlib.redist.1.2.8.10\build\native\grpc.dependencies.zlib.redist.targets')" Text="$([System.String]::Format('$(ErrorText)', '$(SolutionDir)\..\vsprojects\packages\grpc.dependencies.zlib.redist.1.2.8.10\build\native\grpc.dependencies.zlib.redist.targets')" /> |
||||
<Error Condition="!Exists('$(SolutionDir)\..\vsprojects\packages\grpc.dependencies.zlib.1.2.8.10\build\native\grpc.dependencies.zlib.targets')" Text="$([System.String]::Format('$(ErrorText)', '$(SolutionDir)\..\vsprojects\packages\grpc.dependencies.zlib.1.2.8.10\build\native\grpc.dependencies.zlib.targets')" /> |
||||
<Error Condition="!Exists('$(SolutionDir)\..\vsprojects\packages\grpc.dependencies.openssl.redist.1.0.204.1\build\native\grpc.dependencies.openssl.redist.targets')" Text="$([System.String]::Format('$(ErrorText)', '$(SolutionDir)\..\vsprojects\packages\grpc.dependencies.openssl.redist.1.0.204.1\build\native\grpc.dependencies.openssl.redist.targets')" /> |
||||
<Error Condition="!Exists('$(SolutionDir)\..\vsprojects\packages\grpc.dependencies.openssl.1.0.204.1\build\native\grpc.dependencies.openssl.props')" Text="$([System.String]::Format('$(ErrorText)', '$(SolutionDir)\..\vsprojects\packages\grpc.dependencies.openssl.1.0.204.1\build\native\grpc.dependencies.openssl.props')" /> |
||||
<Error Condition="!Exists('$(SolutionDir)\..\vsprojects\packages\grpc.dependencies.openssl.1.0.204.1\build\native\grpc.dependencies.openssl.targets')" Text="$([System.String]::Format('$(ErrorText)', '$(SolutionDir)\..\vsprojects\packages\grpc.dependencies.openssl.1.0.204.1\build\native\grpc.dependencies.openssl.targets')" /> |
||||
</Target> |
||||
</Project> |
||||
|
@ -1,21 +0,0 @@ |
||||
<?xml version="1.0" encoding="utf-8"?> |
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> |
||||
<ItemGroup> |
||||
<ClCompile Include="$(SolutionDir)\..\test\core\client_channel\set_initial_connect_string_test.c"> |
||||
<Filter>test\core\client_channel</Filter> |
||||
</ClCompile> |
||||
</ItemGroup> |
||||
|
||||
<ItemGroup> |
||||
<Filter Include="test"> |
||||
<UniqueIdentifier>{413358e4-3165-f09d-071c-ee4f2ca0b826}</UniqueIdentifier> |
||||
</Filter> |
||||
<Filter Include="test\core"> |
||||
<UniqueIdentifier>{a554b5ef-0c80-ac03-1848-bccd947a06a6}</UniqueIdentifier> |
||||
</Filter> |
||||
<Filter Include="test\core\client_channel"> |
||||
<UniqueIdentifier>{4726253c-a562-0ace-2798-996807381208}</UniqueIdentifier> |
||||
</Filter> |
||||
</ItemGroup> |
||||
</Project> |
||||
|
Loading…
Reference in new issue