Esempio n. 1
0
void grpc_init(void) {
  gpr_once_init(&g_basic_init, do_basic_init);

  gpr_mu_lock(&g_init_mu);
  if (++g_initializations == 1) {
    gpr_time_init();
    grpc_resolver_registry_init("dns:///");
    grpc_register_resolver_type("dns", grpc_dns_resolver_factory_create());
#ifdef GPR_POSIX_SOCKET
    grpc_register_resolver_type("unix", grpc_unix_resolver_factory_create());
#endif
    grpc_register_tracer("channel", &grpc_trace_channel);
    grpc_register_tracer("surface", &grpc_surface_trace);
    grpc_register_tracer("http", &grpc_http_trace);
    grpc_register_tracer("flowctl", &grpc_flowctl_trace);
    grpc_register_tracer("batch", &grpc_trace_batch);
    grpc_security_pre_init();
    grpc_iomgr_init();
    grpc_tracer_init("GRPC_TRACE");
    if (census_initialize(CENSUS_NONE)) {
      gpr_log(GPR_ERROR, "Could not initialize census.");
    }
    grpc_timers_global_init();
  }
  gpr_mu_unlock(&g_init_mu);
}
Esempio n. 2
0
File: init.c Progetto: endobson/grpc
void grpc_init(void) {
  int i;
  gpr_once_init(&g_basic_init, do_basic_init);

  grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
  gpr_mu_lock(&g_init_mu);
  if (++g_initializations == 1) {
    gpr_time_init();
    grpc_stats_init();
    grpc_slice_intern_init();
    grpc_mdctx_global_init();
    grpc_channel_init_init();
    grpc_register_tracer(&grpc_api_trace);
    grpc_register_tracer(&grpc_trace_channel);
    grpc_register_tracer(&grpc_connectivity_state_trace);
    grpc_register_tracer(&grpc_trace_channel_stack_builder);
    grpc_register_tracer(&grpc_http1_trace);
    grpc_register_tracer(&grpc_cq_pluck_trace);  // default on
    grpc_register_tracer(&grpc_call_combiner_trace);
    grpc_register_tracer(&grpc_combiner_trace);
    grpc_register_tracer(&grpc_server_channel_trace);
    grpc_register_tracer(&grpc_bdp_estimator_trace);
    grpc_register_tracer(&grpc_cq_event_timeout_trace);  // default on
    grpc_register_tracer(&grpc_trace_operation_failures);
    grpc_register_tracer(&grpc_resource_quota_trace);
    grpc_register_tracer(&grpc_call_error_trace);
#ifndef NDEBUG
    grpc_register_tracer(&grpc_trace_pending_tags);
    grpc_register_tracer(&grpc_trace_alarm_refcount);
    grpc_register_tracer(&grpc_trace_cq_refcount);
    grpc_register_tracer(&grpc_trace_closure);
    grpc_register_tracer(&grpc_trace_error_refcount);
    grpc_register_tracer(&grpc_trace_stream_refcount);
    grpc_register_tracer(&grpc_trace_fd_refcount);
    grpc_register_tracer(&grpc_trace_metadata);
#endif
    grpc_security_pre_init();
    grpc_iomgr_init(&exec_ctx);
    gpr_timers_global_init();
    grpc_handshaker_factory_registry_init();
    grpc_security_init();
    for (i = 0; i < g_number_of_plugins; i++) {
      if (g_all_of_the_plugins[i].init != NULL) {
        g_all_of_the_plugins[i].init();
      }
    }
    /* register channel finalization AFTER all plugins, to ensure that it's run
     * at the appropriate time */
    grpc_register_security_filters();
    register_builtin_channel_init();
    grpc_tracer_init("GRPC_TRACE");
    /* no more changes to channel init pipelines */
    grpc_channel_init_finalize();
    grpc_iomgr_start(&exec_ctx);
  }
  gpr_mu_unlock(&g_init_mu);
  grpc_exec_ctx_finish(&exec_ctx);
  GRPC_API_TRACE("grpc_init(void)", 0, ());
}
Esempio n. 3
0
int main(int argc, char **argv) {
  grpc_test_init(argc, argv);
  gpr_time_init();

  test_constant_backoff();
  test_no_jitter_backoff();

  return 0;
}
Esempio n. 4
0
void grpc_init(void) {
  int i;
  gpr_once_init(&g_basic_init, do_basic_init);

  gpr_mu_lock(&g_init_mu);
  if (++g_initializations == 1) {
    gpr_time_init();
    grpc_slice_intern_init();
    grpc_mdctx_global_init();
    grpc_channel_init_init();
    grpc_register_tracer("api", &grpc_api_trace);
    grpc_register_tracer("channel", &grpc_trace_channel);
    grpc_register_tracer("connectivity_state", &grpc_connectivity_state_trace);
    grpc_register_tracer("channel_stack_builder",
                         &grpc_trace_channel_stack_builder);
    grpc_register_tracer("http1", &grpc_http1_trace);
    grpc_register_tracer("queue_pluck", &grpc_cq_pluck_trace);
    grpc_register_tracer("combiner", &grpc_combiner_trace);
    grpc_register_tracer("server_channel", &grpc_server_channel_trace);
    grpc_register_tracer("bdp_estimator", &grpc_bdp_estimator_trace);
    // Default pluck trace to 1
    grpc_cq_pluck_trace = 1;
    grpc_register_tracer("queue_timeout", &grpc_cq_event_timeout_trace);
    // Default timeout trace to 1
    grpc_cq_event_timeout_trace = 1;
    grpc_register_tracer("op_failure", &grpc_trace_operation_failures);
    grpc_register_tracer("resource_quota", &grpc_resource_quota_trace);
    grpc_register_tracer("call_error", &grpc_call_error_trace);
#ifndef NDEBUG
    grpc_register_tracer("pending_tags", &grpc_trace_pending_tags);
#endif
    grpc_security_pre_init();
    grpc_iomgr_init();
    grpc_executor_init();
    gpr_timers_global_init();
    grpc_handshaker_factory_registry_init();
    grpc_security_init();
    for (i = 0; i < g_number_of_plugins; i++) {
      if (g_all_of_the_plugins[i].init != NULL) {
        g_all_of_the_plugins[i].init();
      }
    }
    /* register channel finalization AFTER all plugins, to ensure that it's run
     * at the appropriate time */
    grpc_register_security_filters();
    register_builtin_channel_init();
    grpc_tracer_init("GRPC_TRACE");
    /* no more changes to channel init pipelines */
    grpc_channel_init_finalize();
  }
  gpr_mu_unlock(&g_init_mu);
  GRPC_API_TRACE("grpc_init(void)", 0, ());
}
Esempio n. 5
0
int main(int argc, char **argv) {
  grpc_test_init(argc, argv);
  gpr_time_init();
  srand((unsigned)gpr_now(GPR_CLOCK_REALTIME).tv_nsec);

  test_empty();
  test_single_item();
  test_two_items();
  test_reset_clear();
  test_extend();
  test_stress();

  return 0;
}
Esempio n. 6
0
File: init.c Progetto: cj525/grpc
void grpc_init(void) {
  int i;
  gpr_once_init(&g_basic_init, do_basic_init);

  gpr_mu_lock(&g_init_mu);
  if (++g_initializations == 1) {
    gpr_time_init();
    grpc_mdctx_global_init();
    grpc_lb_policy_registry_init(grpc_pick_first_lb_factory_create());
    grpc_register_lb_policy(grpc_pick_first_lb_factory_create());
    grpc_register_lb_policy(grpc_round_robin_lb_factory_create());
    grpc_resolver_registry_init(GRPC_DEFAULT_NAME_PREFIX);
    grpc_register_resolver_type(grpc_dns_resolver_factory_create());
    grpc_register_resolver_type(grpc_ipv4_resolver_factory_create());
    grpc_register_resolver_type(grpc_ipv6_resolver_factory_create());
#ifdef GPR_POSIX_SOCKET
    grpc_register_resolver_type(grpc_unix_resolver_factory_create());
#endif
    grpc_register_tracer("api", &grpc_api_trace);
    grpc_register_tracer("channel", &grpc_trace_channel);
    grpc_register_tracer("http", &grpc_http_trace);
    grpc_register_tracer("flowctl", &grpc_flowctl_trace);
    grpc_register_tracer("connectivity_state", &grpc_connectivity_state_trace);
    grpc_security_pre_init();
    grpc_iomgr_init();
    grpc_executor_init();
    grpc_tracer_init("GRPC_TRACE");
    /* Only initialize census if noone else has. */
    if (census_enabled() == CENSUS_FEATURE_NONE) {
      if (census_initialize(census_supported())) { /* enable all features. */
        gpr_log(GPR_ERROR, "Could not initialize census.");
      }
    }
    gpr_timers_global_init();
    grpc_cq_global_init();
    for (i = 0; i < g_number_of_plugins; i++) {
      if (g_all_of_the_plugins[i].init != NULL) {
        g_all_of_the_plugins[i].init();
      }
    }
  }
  gpr_mu_unlock(&g_init_mu);
  GRPC_API_TRACE("grpc_init(void)", 0, ());
}
Esempio n. 7
0
int main(int argc, char** argv) {
  grpc_test_init(argc, argv);
  gpr_time_init();
  srand((unsigned)gpr_now(GPR_CLOCK_REALTIME).tv_nsec);
  test_invalid_record_size();
  test_end_write_with_different_size();
  test_read_pending_record();
  test_read_beyond_pending_record();
  test_detached_while_reading();
  test_fill_log_no_fragmentation();
  test_fill_circular_log_no_fragmentation();
  test_fill_log_with_straddling_records();
  test_fill_circular_log_with_straddling_records();
  test_small_log();
  test_multiple_writers();
  test_multiple_writers_circular_log();
  test_performance();
  return 0;
}
Esempio n. 8
0
void grpc_init(void) {
  int i;
  gpr_once_init(&g_basic_init, do_basic_init);

  gpr_mu_lock(&g_init_mu);
  if (++g_initializations == 1) {
    gpr_time_init();
    grpc_mdctx_global_init();
    grpc_channel_init_init();
    grpc_register_tracer("api", &grpc_api_trace);
    grpc_register_tracer("channel", &grpc_trace_channel);
    grpc_register_tracer("connectivity_state", &grpc_connectivity_state_trace);
    grpc_register_tracer("channel_stack_builder",
                         &grpc_trace_channel_stack_builder);
    grpc_register_tracer("http1", &grpc_http1_trace);
    grpc_register_tracer("compression", &grpc_compression_trace);
    grpc_register_tracer("op_failure", &grpc_trace_operation_failures);
    grpc_security_pre_init();
    grpc_iomgr_init();
    grpc_executor_init();
    gpr_timers_global_init();
    grpc_cq_global_init();
    for (i = 0; i < g_number_of_plugins; i++) {
      if (g_all_of_the_plugins[i].init != NULL) {
        g_all_of_the_plugins[i].init();
      }
    }
    /* register channel finalization AFTER all plugins, to ensure that it's run
     * at the appropriate time */
    grpc_register_security_filters();
    register_builtin_channel_init();
    grpc_tracer_init("GRPC_TRACE");
    /* no more changes to channel init pipelines */
    grpc_channel_init_finalize();
  }
  gpr_mu_unlock(&g_init_mu);
  GRPC_API_TRACE("grpc_init(void)", 0, ());
}