Merge pull request #1180 from vjpai/perf-0402

Trace and trim locks, properly handle SIGINT
pull/1184/merge
Yang Gao 10 years ago
commit a4b0909db9
  1. 9
      Makefile
  2. 4
      src/core/iomgr/alarm.c
  3. 8
      src/core/transport/metadata.c
  4. 9
      templates/Makefile.template
  5. 4
      test/cpp/qps/worker.cc

@ -94,6 +94,15 @@ CPPFLAGS_dbg = -O0
LDFLAGS_dbg =
DEFINES_dbg = _DEBUG DEBUG
VALID_CONFIG_mutrace = 1
CC_mutrace = $(DEFAULT_CC)
CXX_mutrace = $(DEFAULT_CXX)
LD_mutrace = $(DEFAULT_CC)
LDXX_mutrace = $(DEFAULT_CXX)
CPPFLAGS_mutrace = -O0
LDFLAGS_mutrace = -rdynamic
DEFINES_mutrace = _DEBUG DEBUG
VALID_CONFIG_valgrind = 1
REQUIRE_CUSTOM_LIBRARIES_valgrind = 1
CC_valgrind = $(DEFAULT_CC)

@ -307,6 +307,10 @@ static int run_some_expired_alarms(gpr_mu *drop_mu, gpr_timespec now,
/* TODO(ctiller): verify that there are any alarms (atomically) here */
if (gpr_time_cmp(g_shard_queue[0]->min_deadline, now) >= 0) {
return 0;
}
if (gpr_mu_trylock(&g_checker_mu)) {
gpr_mu_lock(&g_mu);

@ -97,7 +97,7 @@ static void internal_string_ref(internal_string *s);
static void internal_string_unref(internal_string *s);
static void discard_metadata(grpc_mdctx *ctx);
static void gc_mdtab(grpc_mdctx *ctx);
static void metadata_context_destroy(grpc_mdctx *ctx);
static void metadata_context_destroy_locked(grpc_mdctx *ctx);
static void lock(grpc_mdctx *ctx) { gpr_mu_lock(&ctx->mu); }
@ -122,8 +122,7 @@ static void unlock(grpc_mdctx *ctx) {
discard_metadata(ctx);
}
if (ctx->strtab_count == 0) {
gpr_mu_unlock(&ctx->mu);
metadata_context_destroy(ctx);
metadata_context_destroy_locked(ctx);
return;
}
}
@ -185,8 +184,7 @@ static void discard_metadata(grpc_mdctx *ctx) {
}
}
static void metadata_context_destroy(grpc_mdctx *ctx) {
gpr_mu_lock(&ctx->mu);
static void metadata_context_destroy_locked(grpc_mdctx *ctx) {
GPR_ASSERT(ctx->strtab_count == 0);
GPR_ASSERT(ctx->mdtab_count == 0);
GPR_ASSERT(ctx->mdtab_free == 0);

@ -111,6 +111,15 @@ CPPFLAGS_dbg = -O0
LDFLAGS_dbg =
DEFINES_dbg = _DEBUG DEBUG
VALID_CONFIG_mutrace = 1
CC_mutrace = $(DEFAULT_CC)
CXX_mutrace = $(DEFAULT_CXX)
LD_mutrace = $(DEFAULT_CC)
LDXX_mutrace = $(DEFAULT_CXX)
CPPFLAGS_mutrace = -O0
LDFLAGS_mutrace = -rdynamic
DEFINES_mutrace = _DEBUG DEBUG
VALID_CONFIG_valgrind = 1
REQUIRE_CUSTOM_LIBRARIES_valgrind = 1
CC_valgrind = $(DEFAULT_CC)

@ -71,6 +71,8 @@ using namespace gflags;
static bool got_sigint = false;
static void sigint_handler(int x) {got_sigint = true;}
namespace grpc {
namespace testing {
@ -248,6 +250,8 @@ int main(int argc, char** argv) {
grpc_init();
ParseCommandLineFlags(&argc, &argv, true);
signal(SIGINT, sigint_handler);
grpc::testing::RunServer();
grpc_shutdown();

Loading…
Cancel
Save