Merge pull request #3618 from dgquintas/cq_alarm

Added grpc_alarm (renamed previous one to grpc_timer)
pull/3838/head
Vijay Pai 9 years ago
commit 73596b8d04
  1. 30
      BUILD
  2. 138
      Makefile
  3. 4
      binding.gyp
  4. 50
      build.yaml
  5. 16
      gRPC.podspec
  6. 68
      include/grpc++/alarm.h
  7. 19
      include/grpc/grpc.h
  8. 8
      src/core/client_config/subchannel.c
  9. 2
      src/core/iomgr/iocp_windows.c
  10. 8
      src/core/iomgr/iomgr.c
  11. 4
      src/core/iomgr/pollset_posix.c
  12. 4
      src/core/iomgr/pollset_windows.c
  13. 8
      src/core/iomgr/tcp_client_posix.c
  14. 8
      src/core/iomgr/tcp_client_windows.c
  15. 2
      src/core/iomgr/tcp_windows.c
  16. 172
      src/core/iomgr/timer.c
  17. 50
      src/core/iomgr/timer.h
  18. 82
      src/core/iomgr/timer_heap.c
  19. 32
      src/core/iomgr/timer_heap.h
  20. 24
      src/core/iomgr/timer_internal.h
  21. 83
      src/core/surface/alarm.c
  22. 10
      src/core/surface/call.c
  23. 8
      src/core/surface/channel_connectivity.c
  24. 11
      src/core/surface/completion_queue.c
  25. 49
      src/cpp/common/alarm.cc
  26. 118
      test/core/iomgr/timer_heap_test.c
  27. 56
      test/core/iomgr/timer_list_test.c
  28. 100
      test/core/surface/alarm_test.c
  29. 91
      test/cpp/common/alarm_test.cc
  30. 10
      tools/doxygen/Doxyfile.core.internal
  31. 88
      tools/run_tests/sources_and_headers.json
  32. 72
      tools/run_tests/tests.json
  33. 108
      vsprojects/buildtests_c.sln
  34. 14
      vsprojects/vcxproj/grpc/grpc.vcxproj
  35. 30
      vsprojects/vcxproj/grpc/grpc.vcxproj.filters
  36. 14
      vsprojects/vcxproj/grpc_unsecure/grpc_unsecure.vcxproj
  37. 30
      vsprojects/vcxproj/grpc_unsecure/grpc_unsecure.vcxproj.filters
  38. 8
      vsprojects/vcxproj/test/timer_heap_test/timer_heap_test.vcxproj
  39. 8
      vsprojects/vcxproj/test/timer_heap_test/timer_heap_test.vcxproj.filters
  40. 8
      vsprojects/vcxproj/test/timer_list_test/timer_list_test.vcxproj
  41. 8
      vsprojects/vcxproj/test/timer_list_test/timer_list_test.vcxproj.filters

30
BUILD

@ -181,9 +181,6 @@ cc_library(
"src/core/httpcli/format_request.h",
"src/core/httpcli/httpcli.h",
"src/core/httpcli/parser.h",
"src/core/iomgr/alarm.h",
"src/core/iomgr/alarm_heap.h",
"src/core/iomgr/alarm_internal.h",
"src/core/iomgr/closure.h",
"src/core/iomgr/endpoint.h",
"src/core/iomgr/endpoint_pair.h",
@ -211,6 +208,9 @@ cc_library(
"src/core/iomgr/tcp_server.h",
"src/core/iomgr/tcp_windows.h",
"src/core/iomgr/time_averaged_stats.h",
"src/core/iomgr/timer.h",
"src/core/iomgr/timer_heap.h",
"src/core/iomgr/timer_internal.h",
"src/core/iomgr/udp_server.h",
"src/core/iomgr/wakeup_fd_pipe.h",
"src/core/iomgr/wakeup_fd_posix.h",
@ -316,8 +316,6 @@ cc_library(
"src/core/httpcli/format_request.c",
"src/core/httpcli/httpcli.c",
"src/core/httpcli/parser.c",
"src/core/iomgr/alarm.c",
"src/core/iomgr/alarm_heap.c",
"src/core/iomgr/closure.c",
"src/core/iomgr/endpoint.c",
"src/core/iomgr/endpoint_pair_posix.c",
@ -348,6 +346,8 @@ cc_library(
"src/core/iomgr/tcp_server_windows.c",
"src/core/iomgr/tcp_windows.c",
"src/core/iomgr/time_averaged_stats.c",
"src/core/iomgr/timer.c",
"src/core/iomgr/timer_heap.c",
"src/core/iomgr/udp_server.c",
"src/core/iomgr/wakeup_fd_eventfd.c",
"src/core/iomgr/wakeup_fd_nospecial.c",
@ -465,9 +465,6 @@ cc_library(
"src/core/httpcli/format_request.h",
"src/core/httpcli/httpcli.h",
"src/core/httpcli/parser.h",
"src/core/iomgr/alarm.h",
"src/core/iomgr/alarm_heap.h",
"src/core/iomgr/alarm_internal.h",
"src/core/iomgr/closure.h",
"src/core/iomgr/endpoint.h",
"src/core/iomgr/endpoint_pair.h",
@ -495,6 +492,9 @@ cc_library(
"src/core/iomgr/tcp_server.h",
"src/core/iomgr/tcp_windows.h",
"src/core/iomgr/time_averaged_stats.h",
"src/core/iomgr/timer.h",
"src/core/iomgr/timer_heap.h",
"src/core/iomgr/timer_internal.h",
"src/core/iomgr/udp_server.h",
"src/core/iomgr/wakeup_fd_pipe.h",
"src/core/iomgr/wakeup_fd_posix.h",
@ -580,8 +580,6 @@ cc_library(
"src/core/httpcli/format_request.c",
"src/core/httpcli/httpcli.c",
"src/core/httpcli/parser.c",
"src/core/iomgr/alarm.c",
"src/core/iomgr/alarm_heap.c",
"src/core/iomgr/closure.c",
"src/core/iomgr/endpoint.c",
"src/core/iomgr/endpoint_pair_posix.c",
@ -612,6 +610,8 @@ cc_library(
"src/core/iomgr/tcp_server_windows.c",
"src/core/iomgr/tcp_windows.c",
"src/core/iomgr/time_averaged_stats.c",
"src/core/iomgr/timer.c",
"src/core/iomgr/timer_heap.c",
"src/core/iomgr/udp_server.c",
"src/core/iomgr/wakeup_fd_eventfd.c",
"src/core/iomgr/wakeup_fd_nospecial.c",
@ -1106,8 +1106,6 @@ objc_library(
"src/core/httpcli/format_request.c",
"src/core/httpcli/httpcli.c",
"src/core/httpcli/parser.c",
"src/core/iomgr/alarm.c",
"src/core/iomgr/alarm_heap.c",
"src/core/iomgr/closure.c",
"src/core/iomgr/endpoint.c",
"src/core/iomgr/endpoint_pair_posix.c",
@ -1138,6 +1136,8 @@ objc_library(
"src/core/iomgr/tcp_server_windows.c",
"src/core/iomgr/tcp_windows.c",
"src/core/iomgr/time_averaged_stats.c",
"src/core/iomgr/timer.c",
"src/core/iomgr/timer_heap.c",
"src/core/iomgr/udp_server.c",
"src/core/iomgr/wakeup_fd_eventfd.c",
"src/core/iomgr/wakeup_fd_nospecial.c",
@ -1252,9 +1252,6 @@ objc_library(
"src/core/httpcli/format_request.h",
"src/core/httpcli/httpcli.h",
"src/core/httpcli/parser.h",
"src/core/iomgr/alarm.h",
"src/core/iomgr/alarm_heap.h",
"src/core/iomgr/alarm_internal.h",
"src/core/iomgr/closure.h",
"src/core/iomgr/endpoint.h",
"src/core/iomgr/endpoint_pair.h",
@ -1282,6 +1279,9 @@ objc_library(
"src/core/iomgr/tcp_server.h",
"src/core/iomgr/tcp_windows.h",
"src/core/iomgr/time_averaged_stats.h",
"src/core/iomgr/timer.h",
"src/core/iomgr/timer_heap.h",
"src/core/iomgr/timer_internal.h",
"src/core/iomgr/udp_server.h",
"src/core/iomgr/wakeup_fd_pipe.h",
"src/core/iomgr/wakeup_fd_posix.h",

File diff suppressed because one or more lines are too long

@ -186,8 +186,6 @@
'src/core/httpcli/format_request.c',
'src/core/httpcli/httpcli.c',
'src/core/httpcli/parser.c',
'src/core/iomgr/alarm.c',
'src/core/iomgr/alarm_heap.c',
'src/core/iomgr/closure.c',
'src/core/iomgr/endpoint.c',
'src/core/iomgr/endpoint_pair_posix.c',
@ -218,6 +216,8 @@
'src/core/iomgr/tcp_server_windows.c',
'src/core/iomgr/tcp_windows.c',
'src/core/iomgr/time_averaged_stats.c',
'src/core/iomgr/timer.c',
'src/core/iomgr/timer_heap.c',
'src/core/iomgr/udp_server.c',
'src/core/iomgr/wakeup_fd_eventfd.c',
'src/core/iomgr/wakeup_fd_nospecial.c',

@ -137,9 +137,6 @@ filegroups:
- src/core/httpcli/format_request.h
- src/core/httpcli/httpcli.h
- src/core/httpcli/parser.h
- src/core/iomgr/alarm.h
- src/core/iomgr/alarm_heap.h
- src/core/iomgr/alarm_internal.h
- src/core/iomgr/closure.h
- src/core/iomgr/endpoint.h
- src/core/iomgr/endpoint_pair.h
@ -167,6 +164,9 @@ filegroups:
- src/core/iomgr/tcp_server.h
- src/core/iomgr/tcp_windows.h
- src/core/iomgr/time_averaged_stats.h
- src/core/iomgr/timer.h
- src/core/iomgr/timer_heap.h
- src/core/iomgr/timer_internal.h
- src/core/iomgr/udp_server.h
- src/core/iomgr/wakeup_fd_pipe.h
- src/core/iomgr/wakeup_fd_posix.h
@ -249,8 +249,6 @@ filegroups:
- src/core/httpcli/format_request.c
- src/core/httpcli/httpcli.c
- src/core/httpcli/parser.c
- src/core/iomgr/alarm.c
- src/core/iomgr/alarm_heap.c
- src/core/iomgr/closure.c
- src/core/iomgr/endpoint.c
- src/core/iomgr/endpoint_pair_posix.c
@ -281,6 +279,8 @@ filegroups:
- src/core/iomgr/tcp_server_windows.c
- src/core/iomgr/tcp_windows.c
- src/core/iomgr/time_averaged_stats.c
- src/core/iomgr/timer.c
- src/core/iomgr/timer_heap.c
- src/core/iomgr/udp_server.c
- src/core/iomgr/wakeup_fd_eventfd.c
- src/core/iomgr/wakeup_fd_nospecial.c
@ -783,26 +783,6 @@ libs:
- winsock
- global
targets:
- name: alarm_heap_test
build: test
language: c
src:
- test/core/iomgr/alarm_heap_test.c
deps:
- grpc_test_util
- grpc
- gpr_test_util
- gpr
- name: alarm_list_test
build: test
language: c
src:
- test/core/iomgr/alarm_list_test.c
deps:
- grpc_test_util
- grpc
- gpr_test_util
- gpr
- name: alpn_test
build: test
language: c
@ -1510,6 +1490,26 @@ targets:
- grpc
- gpr_test_util
- gpr
- name: timer_heap_test
build: test
language: c
src:
- test/core/iomgr/timer_heap_test.c
deps:
- grpc_test_util
- grpc
- gpr_test_util
- gpr
- name: timer_list_test
build: test
language: c
src:
- test/core/iomgr/timer_list_test.c
deps:
- grpc_test_util
- grpc
- gpr_test_util
- gpr
- name: timers_test
build: test
language: c

@ -185,9 +185,6 @@ Pod::Spec.new do |s|
'src/core/httpcli/format_request.h',
'src/core/httpcli/httpcli.h',
'src/core/httpcli/parser.h',
'src/core/iomgr/alarm.h',
'src/core/iomgr/alarm_heap.h',
'src/core/iomgr/alarm_internal.h',
'src/core/iomgr/closure.h',
'src/core/iomgr/endpoint.h',
'src/core/iomgr/endpoint_pair.h',
@ -215,6 +212,9 @@ Pod::Spec.new do |s|
'src/core/iomgr/tcp_server.h',
'src/core/iomgr/tcp_windows.h',
'src/core/iomgr/time_averaged_stats.h',
'src/core/iomgr/timer.h',
'src/core/iomgr/timer_heap.h',
'src/core/iomgr/timer_internal.h',
'src/core/iomgr/udp_server.h',
'src/core/iomgr/wakeup_fd_pipe.h',
'src/core/iomgr/wakeup_fd_posix.h',
@ -327,8 +327,6 @@ Pod::Spec.new do |s|
'src/core/httpcli/format_request.c',
'src/core/httpcli/httpcli.c',
'src/core/httpcli/parser.c',
'src/core/iomgr/alarm.c',
'src/core/iomgr/alarm_heap.c',
'src/core/iomgr/closure.c',
'src/core/iomgr/endpoint.c',
'src/core/iomgr/endpoint_pair_posix.c',
@ -359,6 +357,8 @@ Pod::Spec.new do |s|
'src/core/iomgr/tcp_server_windows.c',
'src/core/iomgr/tcp_windows.c',
'src/core/iomgr/time_averaged_stats.c',
'src/core/iomgr/timer.c',
'src/core/iomgr/timer_heap.c',
'src/core/iomgr/udp_server.c',
'src/core/iomgr/wakeup_fd_eventfd.c',
'src/core/iomgr/wakeup_fd_nospecial.c',
@ -475,9 +475,6 @@ Pod::Spec.new do |s|
'src/core/httpcli/format_request.h',
'src/core/httpcli/httpcli.h',
'src/core/httpcli/parser.h',
'src/core/iomgr/alarm.h',
'src/core/iomgr/alarm_heap.h',
'src/core/iomgr/alarm_internal.h',
'src/core/iomgr/closure.h',
'src/core/iomgr/endpoint.h',
'src/core/iomgr/endpoint_pair.h',
@ -505,6 +502,9 @@ Pod::Spec.new do |s|
'src/core/iomgr/tcp_server.h',
'src/core/iomgr/tcp_windows.h',
'src/core/iomgr/time_averaged_stats.h',
'src/core/iomgr/timer.h',
'src/core/iomgr/timer_heap.h',
'src/core/iomgr/timer_internal.h',
'src/core/iomgr/udp_server.h',
'src/core/iomgr/wakeup_fd_pipe.h',
'src/core/iomgr/wakeup_fd_posix.h',

@ -0,0 +1,68 @@
/*
*
* 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.
*
*/
/// An Alarm posts the user provided tag to its associated completion queue upon
/// expiry or cancellation.
#ifndef GRPCXX_ALARM_H
#define GRPCXX_ALARM_H
#include <grpc++/completion_queue.h>
#include <grpc++/impl/grpc_library.h>
#include <grpc++/support/time.h>
namespace grpc {
/// A thin wrapper around \a grpc_alarm (see / \a / src/core/surface/alarm.h).
class Alarm: public GrpcLibrary {
public:
/// Create a completion queue alarm instance associated to \a cq.
///
/// Once the alarm expires (at \a deadline) or it's cancelled (see \a Cancel),
/// an event with tag \a tag will be added to \a cq. If the alarm expired, the
/// event's success bit will be true, false otherwise (ie, upon cancellation).
Alarm(CompletionQueue* cq, gpr_timespec deadline, void* tag);
/// Destroy the given completion queue alarm, cancelling it in the process.
~Alarm();
/// Cancel a completion queue alarm. Calling this function over an alarm that
/// has already fired has no effect.
void Cancel();
private:
grpc_alarm* const alarm_; // owned
};
} // namespace grpc
#endif // GRPCXX_ALARM_H

@ -56,6 +56,9 @@ extern "C" {
actions. */
typedef struct grpc_completion_queue grpc_completion_queue;
/** An alarm associated with a completion queue. */
typedef struct grpc_alarm grpc_alarm;
/** The Channel interface allows creation of Call objects. */
typedef struct grpc_channel grpc_channel;
@ -475,6 +478,22 @@ void grpc_completion_queue_shutdown(grpc_completion_queue *cq);
drained and no threads are executing grpc_completion_queue_next */
void grpc_completion_queue_destroy(grpc_completion_queue *cq);
/** Create a completion queue alarm instance associated to \a cq.
*
* Once the alarm expires (at \a deadline) or it's cancelled (see \a
* grpc_alarm_cancel), an event with tag \a tag will be added to \a cq. If the
* alarm expired, the event's success bit will be true, false otherwise (ie,
* upon cancellation). */
grpc_alarm *grpc_alarm_create(grpc_completion_queue *cq, gpr_timespec deadline,
void *tag);
/** Cancel a completion queue alarm. Calling this function over an alarm that
* has already fired has no effect. */
void grpc_alarm_cancel(grpc_alarm *alarm);
/** Destroy the given completion queue alarm, cancelling it in the process. */
void grpc_alarm_destroy(grpc_alarm *alarm);
/** Check the connectivity state of a channel. */
grpc_connectivity_state grpc_channel_check_connectivity_state(
grpc_channel *channel, int try_to_connect);

@ -40,7 +40,7 @@
#include "src/core/channel/channel_args.h"
#include "src/core/channel/client_channel.h"
#include "src/core/channel/connected_channel.h"
#include "src/core/iomgr/alarm.h"
#include "src/core/iomgr/timer.h"
#include "src/core/transport/connectivity_state.h"
#include "src/core/surface/channel.h"
@ -130,7 +130,7 @@ struct grpc_subchannel {
/** do we have an active alarm? */
int have_alarm;
/** our alarm */
grpc_alarm alarm;
grpc_timer alarm;
/** current random value */
gpr_uint32 random;
};
@ -462,7 +462,7 @@ void grpc_subchannel_process_transport_op(grpc_exec_ctx *exec_ctx,
}
if (cancel_alarm) {
grpc_alarm_cancel(exec_ctx, &c->alarm);
grpc_timer_cancel(exec_ctx, &c->alarm);
}
if (op->disconnect) {
@ -693,7 +693,7 @@ static void subchannel_connected(grpc_exec_ctx *exec_ctx, void *arg,
GPR_ASSERT(!c->have_alarm);
c->have_alarm = 1;
connectivity_state_changed_locked(exec_ctx, c, "connect_failed");
grpc_alarm_init(exec_ctx, &c->alarm, c->next_attempt, on_alarm, c, now);
grpc_timer_init(exec_ctx, &c->alarm, c->next_attempt, on_alarm, c, now);
gpr_mu_unlock(&c->mu);
}
}

@ -42,7 +42,7 @@
#include <grpc/support/alloc.h>
#include <grpc/support/thd.h>
#include "src/core/iomgr/alarm_internal.h"
#include "src/core/iomgr/timer_internal.h"
#include "src/core/iomgr/iocp_windows.h"
#include "src/core/iomgr/iomgr_internal.h"
#include "src/core/iomgr/socket_windows.h"

@ -43,7 +43,7 @@
#include <grpc/support/thd.h>
#include "src/core/iomgr/iomgr_internal.h"
#include "src/core/iomgr/alarm_internal.h"
#include "src/core/iomgr/timer_internal.h"
#include "src/core/support/string.h"
static gpr_mu g_mu;
@ -55,7 +55,7 @@ void grpc_iomgr_init(void) {
g_shutdown = 0;
gpr_mu_init(&g_mu);
gpr_cv_init(&g_rcv);
grpc_alarm_list_init(gpr_now(GPR_CLOCK_MONOTONIC));
grpc_timer_list_init(gpr_now(GPR_CLOCK_MONOTONIC));
g_root_object.next = g_root_object.prev = &g_root_object;
g_root_object.name = "root";
grpc_iomgr_platform_init();
@ -98,7 +98,7 @@ void grpc_iomgr_shutdown(void) {
}
last_warning_time = gpr_now(GPR_CLOCK_REALTIME);
}
if (grpc_alarm_check(&exec_ctx, gpr_inf_future(GPR_CLOCK_MONOTONIC),
if (grpc_timer_check(&exec_ctx, gpr_inf_future(GPR_CLOCK_MONOTONIC),
NULL)) {
gpr_mu_unlock(&g_mu);
grpc_exec_ctx_flush(&exec_ctx);
@ -124,7 +124,7 @@ void grpc_iomgr_shutdown(void) {
}
gpr_mu_unlock(&g_mu);
grpc_alarm_list_shutdown(&exec_ctx);
grpc_timer_list_shutdown(&exec_ctx);
grpc_exec_ctx_finish(&exec_ctx);
/* ensure all threads have left g_mu */

@ -42,7 +42,7 @@
#include <string.h>
#include <unistd.h>
#include "src/core/iomgr/alarm_internal.h"
#include "src/core/iomgr/timer_internal.h"
#include "src/core/iomgr/fd_posix.h"
#include "src/core/iomgr/iomgr_internal.h"
#include "src/core/iomgr/socket_utils_posix.h"
@ -255,7 +255,7 @@ void grpc_pollset_work(grpc_exec_ctx *exec_ctx, grpc_pollset *pollset,
each time through on every pollset.
May update deadline to ensure timely wakeups.
TODO(ctiller): can this work be localized? */
if (grpc_alarm_check(exec_ctx, now, &deadline)) {
if (grpc_timer_check(exec_ctx, now, &deadline)) {
gpr_mu_unlock(&pollset->mu);
locked = 0;
goto done;

@ -37,7 +37,7 @@
#include <grpc/support/thd.h>
#include "src/core/iomgr/alarm_internal.h"
#include "src/core/iomgr/timer_internal.h"
#include "src/core/iomgr/iomgr_internal.h"
#include "src/core/iomgr/iocp_windows.h"
#include "src/core/iomgr/pollset.h"
@ -136,7 +136,7 @@ void grpc_pollset_work(grpc_exec_ctx *exec_ctx, grpc_pollset *pollset,
worker->kicked = 0;
worker->pollset = pollset;
gpr_cv_init(&worker->cv);
if (grpc_alarm_check(exec_ctx, now, &deadline)) {
if (grpc_timer_check(exec_ctx, now, &deadline)) {
goto done;
}
if (!pollset->kicked_without_pollers && !pollset->shutting_down) {

@ -42,7 +42,7 @@
#include <string.h>
#include <unistd.h>
#include "src/core/iomgr/alarm.h"
#include "src/core/iomgr/timer.h"
#include "src/core/iomgr/iomgr_posix.h"
#include "src/core/iomgr/pollset_posix.h"
#include "src/core/iomgr/sockaddr_utils.h"
@ -60,7 +60,7 @@ typedef struct {
gpr_mu mu;
grpc_fd *fd;
gpr_timespec deadline;
grpc_alarm alarm;
grpc_timer alarm;
int refs;
grpc_closure write_closure;
grpc_pollset_set *interested_parties;
@ -132,7 +132,7 @@ static void on_writable(grpc_exec_ctx *exec_ctx, void *acp, int success) {
ac->fd = NULL;
gpr_mu_unlock(&ac->mu);
grpc_alarm_cancel(exec_ctx, &ac->alarm);
grpc_timer_cancel(exec_ctx, &ac->alarm);
gpr_mu_lock(&ac->mu);
if (success) {
@ -290,7 +290,7 @@ void grpc_tcp_client_connect(grpc_exec_ctx *exec_ctx, grpc_closure *closure,
}
gpr_mu_lock(&ac->mu);
grpc_alarm_init(exec_ctx, &ac->alarm,
grpc_timer_init(exec_ctx, &ac->alarm,
gpr_convert_clock_type(deadline, GPR_CLOCK_MONOTONIC),
tc_on_alarm, ac, gpr_now(GPR_CLOCK_MONOTONIC));
grpc_fd_notify_on_write(exec_ctx, ac->fd, &ac->write_closure);

@ -43,7 +43,7 @@
#include <grpc/support/slice_buffer.h>
#include <grpc/support/useful.h>
#include "src/core/iomgr/alarm.h"
#include "src/core/iomgr/timer.h"
#include "src/core/iomgr/iocp_windows.h"
#include "src/core/iomgr/tcp_client.h"
#include "src/core/iomgr/tcp_windows.h"
@ -56,7 +56,7 @@ typedef struct {
gpr_mu mu;
grpc_winsocket *socket;
gpr_timespec deadline;
grpc_alarm alarm;
grpc_timer alarm;
char *addr_name;
int refs;
grpc_closure on_connect;
@ -91,7 +91,7 @@ static void on_connect(grpc_exec_ctx *exec_ctx, void *acp, int from_iocp) {
grpc_winsocket_callback_info *info = &ac->socket->write_info;
grpc_closure *on_done = ac->on_done;
grpc_alarm_cancel(exec_ctx, &ac->alarm);
grpc_timer_cancel(exec_ctx, &ac->alarm);
gpr_mu_lock(&ac->mu);
@ -201,7 +201,7 @@ void grpc_tcp_client_connect(grpc_exec_ctx *exec_ctx, grpc_closure *on_done,
ac->endpoint = endpoint;
grpc_closure_init(&ac->on_connect, on_connect, ac);
grpc_alarm_init(exec_ctx, &ac->alarm, deadline, on_alarm, ac,
grpc_timer_init(exec_ctx, &ac->alarm, deadline, on_alarm, ac,
gpr_now(GPR_CLOCK_MONOTONIC));
grpc_socket_notify_on_write(exec_ctx, socket, &ac->on_connect);
return;

@ -44,7 +44,7 @@
#include <grpc/support/string_util.h>
#include <grpc/support/useful.h>
#include "src/core/iomgr/alarm.h"
#include "src/core/iomgr/timer.h"
#include "src/core/iomgr/iocp_windows.h"
#include "src/core/iomgr/sockaddr.h"
#include "src/core/iomgr/sockaddr_utils.h"

@ -31,10 +31,10 @@
*
*/
#include "src/core/iomgr/alarm.h"
#include "src/core/iomgr/timer.h"
#include "src/core/iomgr/alarm_heap.h"
#include "src/core/iomgr/alarm_internal.h"
#include "src/core/iomgr/timer_heap.h"
#include "src/core/iomgr/timer_internal.h"
#include "src/core/iomgr/time_averaged_stats.h"
#include <grpc/support/log.h>
#include <grpc/support/sync.h>
@ -51,37 +51,37 @@
typedef struct {
gpr_mu mu;
grpc_time_averaged_stats stats;
/* All and only alarms with deadlines <= this will be in the heap. */
/* All and only timers with deadlines <= this will be in the heap. */
gpr_timespec queue_deadline_cap;
gpr_timespec min_deadline;
/* Index in the g_shard_queue */
gpr_uint32 shard_queue_index;
/* This holds all alarms with deadlines < queue_deadline_cap. Alarms in this
/* This holds all timers with deadlines < queue_deadline_cap. Timers in this
list have the top bit of their deadline set to 0. */
grpc_alarm_heap heap;
/* This holds alarms whose deadline is >= queue_deadline_cap. */
grpc_alarm list;
grpc_timer_heap heap;
/* This holds timers whose deadline is >= queue_deadline_cap. */
grpc_timer list;
} shard_type;
/* Protects g_shard_queue */
static gpr_mu g_mu;
/* Allow only one run_some_expired_alarms at once */
/* Allow only one run_some_expired_timers at once */
static gpr_mu g_checker_mu;
static gpr_clock_type g_clock_type;
static shard_type g_shards[NUM_SHARDS];
/* Protected by g_mu */
static shard_type *g_shard_queue[NUM_SHARDS];
static int run_some_expired_alarms(grpc_exec_ctx *exec_ctx, gpr_timespec now,
static int run_some_expired_timers(grpc_exec_ctx *exec_ctx, gpr_timespec now,
gpr_timespec *next, int success);
static gpr_timespec compute_min_deadline(shard_type *shard) {
return grpc_alarm_heap_is_empty(&shard->heap)
return grpc_timer_heap_is_empty(&shard->heap)
? shard->queue_deadline_cap
: grpc_alarm_heap_top(&shard->heap)->deadline;
: grpc_timer_heap_top(&shard->heap)->deadline;
}
void grpc_alarm_list_init(gpr_timespec now) {
void grpc_timer_list_init(gpr_timespec now) {
gpr_uint32 i;
gpr_mu_init(&g_mu);
@ -95,27 +95,27 @@ void grpc_alarm_list_init(gpr_timespec now) {
0.5);
shard->queue_deadline_cap = now;
shard->shard_queue_index = i;
grpc_alarm_heap_init(&shard->heap);
grpc_timer_heap_init(&shard->heap);
shard->list.next = shard->list.prev = &shard->list;
shard->min_deadline = compute_min_deadline(shard);
g_shard_queue[i] = shard;
}
}
void grpc_alarm_list_shutdown(grpc_exec_ctx *exec_ctx) {
void grpc_timer_list_shutdown(grpc_exec_ctx *exec_ctx) {
int i;
run_some_expired_alarms(exec_ctx, gpr_inf_future(g_clock_type), NULL, 0);
run_some_expired_timers(exec_ctx, gpr_inf_future(g_clock_type), NULL, 0);
for (i = 0; i < NUM_SHARDS; i++) {
shard_type *shard = &g_shards[i];
gpr_mu_destroy(&shard->mu);
grpc_alarm_heap_destroy(&shard->heap);
grpc_timer_heap_destroy(&shard->heap);
}
gpr_mu_destroy(&g_mu);
gpr_mu_destroy(&g_checker_mu);
}
/* This is a cheap, but good enough, pointer hash for sharding the tasks: */
static size_t shard_idx(const grpc_alarm *info) {
static size_t shard_idx(const grpc_timer *info) {
size_t x = (size_t)info;
return ((x >> 4) ^ (x >> 9) ^ (x >> 14)) & (NUM_SHARDS - 1);
}
@ -132,15 +132,15 @@ static gpr_timespec dbl_to_ts(double d) {
return ts;
}
static void list_join(grpc_alarm *head, grpc_alarm *alarm) {
alarm->next = head;
alarm->prev = head->prev;
alarm->next->prev = alarm->prev->next = alarm;
static void list_join(grpc_timer *head, grpc_timer *timer) {
timer->next = head;
timer->prev = head->prev;
timer->next->prev = timer->prev->next = timer;
}
static void list_remove(grpc_alarm *alarm) {
alarm->next->prev = alarm->prev;
alarm->prev->next = alarm->next;
static void list_remove(grpc_timer *timer) {
timer->next->prev = timer->prev;
timer->prev->next = timer->next;
}
static void swap_adjacent_shards_in_queue(gpr_uint32 first_shard_queue_index) {
@ -170,16 +170,16 @@ static void note_deadline_change(shard_type *shard) {
}
}
void grpc_alarm_init(grpc_exec_ctx *exec_ctx, grpc_alarm *alarm,
gpr_timespec deadline, grpc_iomgr_cb_func alarm_cb,
void *alarm_cb_arg, gpr_timespec now) {
int is_first_alarm = 0;
shard_type *shard = &g_shards[shard_idx(alarm)];
void grpc_timer_init(grpc_exec_ctx *exec_ctx, grpc_timer *timer,
gpr_timespec deadline, grpc_iomgr_cb_func timer_cb,
void *timer_cb_arg, gpr_timespec now) {
int is_first_timer = 0;
shard_type *shard = &g_shards[shard_idx(timer)];
GPR_ASSERT(deadline.clock_type == g_clock_type);
GPR_ASSERT(now.clock_type == g_clock_type);
grpc_closure_init(&alarm->closure, alarm_cb, alarm_cb_arg);
alarm->deadline = deadline;
alarm->triggered = 0;
grpc_closure_init(&timer->closure, timer_cb, timer_cb_arg);
timer->deadline = deadline;
timer->triggered = 0;
/* TODO(ctiller): check deadline expired */
@ -187,25 +187,25 @@ void grpc_alarm_init(grpc_exec_ctx *exec_ctx, grpc_alarm *alarm,
grpc_time_averaged_stats_add_sample(&shard->stats,
ts_to_dbl(gpr_time_sub(deadline, now)));
if (gpr_time_cmp(deadline, shard->queue_deadline_cap) < 0) {
is_first_alarm = grpc_alarm_heap_add(&shard->heap, alarm);
is_first_timer = grpc_timer_heap_add(&shard->heap, timer);
} else {
alarm->heap_index = INVALID_HEAP_INDEX;
list_join(&shard->list, alarm);
timer->heap_index = INVALID_HEAP_INDEX;
list_join(&shard->list, timer);
}
gpr_mu_unlock(&shard->mu);
/* Deadline may have decreased, we need to adjust the master queue. Note
that there is a potential racy unlocked region here. There could be a
reordering of multiple grpc_alarm_init calls, at this point, but the < test
reordering of multiple grpc_timer_init calls, at this point, but the < test
below should ensure that we err on the side of caution. There could
also be a race with grpc_alarm_check, which might beat us to the lock. In
that case, it is possible that the alarm that we added will have already
also be a race with grpc_timer_check, which might beat us to the lock. In
that case, it is possible that the timer that we added will have already
run by the time we hold the lock, but that too is a safe error.
Finally, it's possible that the grpc_alarm_check that intervened failed to
trigger the new alarm because the min_deadline hadn't yet been reduced.
In that case, the alarm will simply have to wait for the next
grpc_alarm_check. */
if (is_first_alarm) {
Finally, it's possible that the grpc_timer_check that intervened failed to
trigger the new timer because the min_deadline hadn't yet been reduced.
In that case, the timer will simply have to wait for the next
grpc_timer_check. */
if (is_first_timer) {
gpr_mu_lock(&g_mu);
if (gpr_time_cmp(deadline, shard->min_deadline) < 0) {
gpr_timespec old_min_deadline = g_shard_queue[0]->min_deadline;
@ -220,16 +220,16 @@ void grpc_alarm_init(grpc_exec_ctx *exec_ctx, grpc_alarm *alarm,
}
}
void grpc_alarm_cancel(grpc_exec_ctx *exec_ctx, grpc_alarm *alarm) {
shard_type *shard = &g_shards[shard_idx(alarm)];
void grpc_timer_cancel(grpc_exec_ctx *exec_ctx, grpc_timer *timer) {
shard_type *shard = &g_shards[shard_idx(timer)];
gpr_mu_lock(&shard->mu);
if (!alarm->triggered) {
grpc_exec_ctx_enqueue(exec_ctx, &alarm->closure, 0);
alarm->triggered = 1;
if (alarm->heap_index == INVALID_HEAP_INDEX) {
list_remove(alarm);
if (!timer->triggered) {
grpc_exec_ctx_enqueue(exec_ctx, &timer->closure, 0);
timer->triggered = 1;
if (timer->heap_index == INVALID_HEAP_INDEX) {
list_remove(timer);
} else {
grpc_alarm_heap_remove(&shard->heap, alarm);
grpc_timer_heap_remove(&shard->heap, timer);
}
}
gpr_mu_unlock(&shard->mu);
@ -237,7 +237,7 @@ void grpc_alarm_cancel(grpc_exec_ctx *exec_ctx, grpc_alarm *alarm) {
/* This is called when the queue is empty and "now" has reached the
queue_deadline_cap. We compute a new queue deadline and then scan the map
for alarms that fall at or under it. Returns true if the queue is no
for timers that fall at or under it. Returns true if the queue is no
longer empty.
REQUIRES: shard->mu locked */
static int refill_queue(shard_type *shard, gpr_timespec now) {
@ -248,49 +248,49 @@ static int refill_queue(shard_type *shard, gpr_timespec now) {
double deadline_delta =
GPR_CLAMP(computed_deadline_delta, MIN_QUEUE_WINDOW_DURATION,
MAX_QUEUE_WINDOW_DURATION);
grpc_alarm *alarm, *next;
grpc_timer *timer, *next;
/* Compute the new cap and put all alarms under it into the queue: */
/* Compute the new cap and put all timers under it into the queue: */
shard->queue_deadline_cap = gpr_time_add(
gpr_time_max(now, shard->queue_deadline_cap), dbl_to_ts(deadline_delta));
for (alarm = shard->list.next; alarm != &shard->list; alarm = next) {
next = alarm->next;
for (timer = shard->list.next; timer != &shard->list; timer = next) {
next = timer->next;
if (gpr_time_cmp(alarm->deadline, shard->queue_deadline_cap) < 0) {
list_remove(alarm);
grpc_alarm_heap_add(&shard->heap, alarm);
if (gpr_time_cmp(timer->deadline, shard->queue_deadline_cap) < 0) {
list_remove(timer);
grpc_timer_heap_add(&shard->heap, timer);
}
}
return !grpc_alarm_heap_is_empty(&shard->heap);
return !grpc_timer_heap_is_empty(&shard->heap);
}
/* This pops the next non-cancelled alarm with deadline <= now from the queue,
/* This pops the next non-cancelled timer with deadline <= now from the queue,
or returns NULL if there isn't one.
REQUIRES: shard->mu locked */
static grpc_alarm *pop_one(shard_type *shard, gpr_timespec now) {
grpc_alarm *alarm;
static grpc_timer *pop_one(shard_type *shard, gpr_timespec now) {
grpc_timer *timer;
for (;;) {
if (grpc_alarm_heap_is_empty(&shard->heap)) {
if (grpc_timer_heap_is_empty(&shard->heap)) {
if (gpr_time_cmp(now, shard->queue_deadline_cap) < 0) return NULL;
if (!refill_queue(shard, now)) return NULL;
}
alarm = grpc_alarm_heap_top(&shard->heap);
if (gpr_time_cmp(alarm->deadline, now) > 0) return NULL;
alarm->triggered = 1;
grpc_alarm_heap_pop(&shard->heap);
return alarm;
timer = grpc_timer_heap_top(&shard->heap);
if (gpr_time_cmp(timer->deadline, now) > 0) return NULL;
timer->triggered = 1;
grpc_timer_heap_pop(&shard->heap);
return timer;
}
}
/* REQUIRES: shard->mu unlocked */
static size_t pop_alarms(grpc_exec_ctx *exec_ctx, shard_type *shard,
static size_t pop_timers(grpc_exec_ctx *exec_ctx, shard_type *shard,
gpr_timespec now, gpr_timespec *new_min_deadline,
int success) {
size_t n = 0;
grpc_alarm *alarm;
grpc_timer *timer;
gpr_mu_lock(&shard->mu);
while ((alarm = pop_one(shard, now))) {
grpc_exec_ctx_enqueue(exec_ctx, &alarm->closure, success);
while ((timer = pop_one(shard, now))) {
grpc_exec_ctx_enqueue(exec_ctx, &timer->closure, success);
n++;
}
*new_min_deadline = compute_min_deadline(shard);
@ -298,11 +298,11 @@ static size_t pop_alarms(grpc_exec_ctx *exec_ctx, shard_type *shard,
return n;
}
static int run_some_expired_alarms(grpc_exec_ctx *exec_ctx, gpr_timespec now,
static int run_some_expired_timers(grpc_exec_ctx *exec_ctx, gpr_timespec now,
gpr_timespec *next, int success) {
size_t n = 0;
/* TODO(ctiller): verify that there are any alarms (atomically) here */
/* TODO(ctiller): verify that there are any timers (atomically) here */
if (gpr_mu_trylock(&g_checker_mu)) {
gpr_mu_lock(&g_mu);
@ -310,16 +310,16 @@ static int run_some_expired_alarms(grpc_exec_ctx *exec_ctx, gpr_timespec now,
while (gpr_time_cmp(g_shard_queue[0]->min_deadline, now) < 0) {
gpr_timespec new_min_deadline;
/* For efficiency, we pop as many available alarms as we can from the
shard. This may violate perfect alarm deadline ordering, but that
/* For efficiency, we pop as many available timers as we can from the
shard. This may violate perfect timer deadline ordering, but that
shouldn't be a big deal because we don't make ordering guarantees. */
n += pop_alarms(exec_ctx, g_shard_queue[0], now, &new_min_deadline,
n += pop_timers(exec_ctx, g_shard_queue[0], now, &new_min_deadline,
success);
/* An grpc_alarm_init() on the shard could intervene here, adding a new
alarm that is earlier than new_min_deadline. However,
grpc_alarm_init() will block on the master_lock before it can call
set_min_deadline, so this one will complete first and then the AddAlarm
/* An grpc_timer_init() on the shard could intervene here, adding a new
timer that is earlier than new_min_deadline. However,
grpc_timer_init() will block on the master_lock before it can call
set_min_deadline, so this one will complete first and then the Addtimer
will reduce the min_deadline (perhaps unnecessarily). */
g_shard_queue[0]->min_deadline = new_min_deadline;
note_deadline_change(g_shard_queue[0]);
@ -336,15 +336,15 @@ static int run_some_expired_alarms(grpc_exec_ctx *exec_ctx, gpr_timespec now,
return (int)n;
}
int grpc_alarm_check(grpc_exec_ctx *exec_ctx, gpr_timespec now,
int grpc_timer_check(grpc_exec_ctx *exec_ctx, gpr_timespec now,
gpr_timespec *next) {
GPR_ASSERT(now.clock_type == g_clock_type);
return run_some_expired_alarms(
return run_some_expired_timers(
exec_ctx, now, next,
gpr_time_cmp(now, gpr_inf_future(now.clock_type)) != 0);
}
gpr_timespec grpc_alarm_list_next_timeout(void) {
gpr_timespec grpc_timer_list_next_timeout(void) {
gpr_timespec out;
gpr_mu_lock(&g_mu);
out = g_shard_queue[0]->min_deadline;

@ -31,59 +31,59 @@
*
*/
#ifndef GRPC_INTERNAL_CORE_IOMGR_ALARM_H
#define GRPC_INTERNAL_CORE_IOMGR_ALARM_H
#ifndef GRPC_INTERNAL_CORE_IOMGR_TIMER_H
#define GRPC_INTERNAL_CORE_IOMGR_TIMER_H
#include "src/core/iomgr/iomgr.h"
#include "src/core/iomgr/exec_ctx.h"
#include <grpc/support/port_platform.h>
#include <grpc/support/time.h>
typedef struct grpc_alarm {
typedef struct grpc_timer {
gpr_timespec deadline;
gpr_uint32 heap_index; /* INVALID_HEAP_INDEX if not in heap */
int triggered;
struct grpc_alarm *next;
struct grpc_alarm *prev;
struct grpc_timer *next;
struct grpc_timer *prev;
grpc_closure closure;
} grpc_alarm;
} grpc_timer;
/* Initialize *alarm. When expired or canceled, alarm_cb will be called with
*alarm_cb_arg and status to indicate if it expired (SUCCESS) or was
canceled (CANCELLED). alarm_cb is guaranteed to be called exactly once,
/* Initialize *timer. When expired or canceled, timer_cb will be called with
*timer_cb_arg and status to indicate if it expired (SUCCESS) or was
canceled (CANCELLED). timer_cb is guaranteed to be called exactly once,
and application code should check the status to determine how it was
invoked. The application callback is also responsible for maintaining
information about when to free up any user-level state. */
void grpc_alarm_init(grpc_exec_ctx *exec_ctx, grpc_alarm *alarm,
gpr_timespec deadline, grpc_iomgr_cb_func alarm_cb,
void *alarm_cb_arg, gpr_timespec now);
void grpc_timer_init(grpc_exec_ctx *exec_ctx, grpc_timer *timer,
gpr_timespec deadline, grpc_iomgr_cb_func timer_cb,
void *timer_cb_arg, gpr_timespec now);
/* Note that there is no alarm destroy function. This is because the
alarm is a one-time occurrence with a guarantee that the callback will
/* Note that there is no timer destroy function. This is because the
timer is a one-time occurrence with a guarantee that the callback will
be called exactly once, either at expiration or cancellation. Thus, all
the internal alarm event management state is destroyed just before
the internal timer event management state is destroyed just before
that callback is invoked. If the user has additional state associated with
the alarm, the user is responsible for determining when it is safe to
the timer, the user is responsible for determining when it is safe to
destroy that state. */
/* Cancel an *alarm.
/* Cancel an *timer.
There are three cases:
1. We normally cancel the alarm
2. The alarm has already run
3. We can't cancel the alarm because it is "in flight".
1. We normally cancel the timer
2. The timer has already run
3. We can't cancel the timer because it is "in flight".
In all of these cases, the cancellation is still considered successful.
They are essentially distinguished in that the alarm_cb will be run
They are essentially distinguished in that the timer_cb will be run
exactly once from either the cancellation (with status CANCELLED)
or from the activation (with status SUCCESS)
Note carefully that the callback function MAY occur in the same callstack
as grpc_alarm_cancel. It's expected that most alarms will be cancelled (their
as grpc_timer_cancel. It's expected that most timers will be cancelled (their
primary use is to implement deadlines), and so this code is optimized such
that cancellation costs as little as possible. Making callbacks run inline
matches this aim.
Requires: cancel() must happen after add() on a given alarm */
void grpc_alarm_cancel(grpc_exec_ctx *exec_ctx, grpc_alarm *alarm);
Requires: cancel() must happen after add() on a given timer */
void grpc_timer_cancel(grpc_exec_ctx *exec_ctx, grpc_timer *timer);
#endif /* GRPC_INTERNAL_CORE_IOMGR_ALARM_H */
#endif /* GRPC_INTERNAL_CORE_IOMGR_TIMER_H */

@ -31,7 +31,7 @@
*
*/
#include "src/core/iomgr/alarm_heap.h"
#include "src/core/iomgr/timer_heap.h"
#include <string.h>
@ -43,7 +43,7 @@
position. This functor is called each time immediately after modifying a
value in the underlying container, with the offset of the modified element as
its argument. */
static void adjust_upwards(grpc_alarm **first, gpr_uint32 i, grpc_alarm *t) {
static void adjust_upwards(grpc_timer **first, gpr_uint32 i, grpc_timer *t) {
while (i > 0) {
gpr_uint32 parent = (gpr_uint32)(((int)i - 1) / 2);
if (gpr_time_cmp(first[parent]->deadline, t->deadline) >= 0) break;
@ -58,8 +58,8 @@ static void adjust_upwards(grpc_alarm **first, gpr_uint32 i, grpc_alarm *t) {
/* Adjusts a heap so as to move a hole at position i farther away from the root,
until a suitable position is found for element t. Then, copies t into that
position. */
static void adjust_downwards(grpc_alarm **first, gpr_uint32 i,
gpr_uint32 length, grpc_alarm *t) {
static void adjust_downwards(grpc_timer **first, gpr_uint32 i,
gpr_uint32 length, grpc_timer *t) {
for (;;) {
gpr_uint32 left_child = 1u + 2u * i;
gpr_uint32 right_child;
@ -83,66 +83,66 @@ static void adjust_downwards(grpc_alarm **first, gpr_uint32 i,
#define SHRINK_MIN_ELEMS 8
#define SHRINK_FULLNESS_FACTOR 2
static void maybe_shrink(grpc_alarm_heap *heap) {
if (heap->alarm_count >= 8 &&
heap->alarm_count <= heap->alarm_capacity / SHRINK_FULLNESS_FACTOR / 2) {
heap->alarm_capacity = heap->alarm_count * SHRINK_FULLNESS_FACTOR;
heap->alarms =
gpr_realloc(heap->alarms, heap->alarm_capacity * sizeof(grpc_alarm *));
static void maybe_shrink(grpc_timer_heap *heap) {
if (heap->timer_count >= 8 &&
heap->timer_count <= heap->timer_capacity / SHRINK_FULLNESS_FACTOR / 2) {
heap->timer_capacity = heap->timer_count * SHRINK_FULLNESS_FACTOR;
heap->timers =
gpr_realloc(heap->timers, heap->timer_capacity * sizeof(grpc_timer *));
}
}
static void note_changed_priority(grpc_alarm_heap *heap, grpc_alarm *alarm) {
gpr_uint32 i = alarm->heap_index;
static void note_changed_priority(grpc_timer_heap *heap, grpc_timer *timer) {
gpr_uint32 i = timer->heap_index;
gpr_uint32 parent = (gpr_uint32)(((int)i - 1) / 2);
if (gpr_time_cmp(heap->alarms[parent]->deadline, alarm->deadline) < 0) {
adjust_upwards(heap->alarms, i, alarm);
if (gpr_time_cmp(heap->timers[parent]->deadline, timer->deadline) < 0) {
adjust_upwards(heap->timers, i, timer);
} else {
adjust_downwards(heap->alarms, i, heap->alarm_count, alarm);
adjust_downwards(heap->timers, i, heap->timer_count, timer);
}
}
void grpc_alarm_heap_init(grpc_alarm_heap *heap) {
void grpc_timer_heap_init(grpc_timer_heap *heap) {
memset(heap, 0, sizeof(*heap));
}
void grpc_alarm_heap_destroy(grpc_alarm_heap *heap) { gpr_free(heap->alarms); }
void grpc_timer_heap_destroy(grpc_timer_heap *heap) { gpr_free(heap->timers); }
int grpc_alarm_heap_add(grpc_alarm_heap *heap, grpc_alarm *alarm) {
if (heap->alarm_count == heap->alarm_capacity) {
heap->alarm_capacity =
GPR_MAX(heap->alarm_capacity + 1, heap->alarm_capacity * 3 / 2);
heap->alarms =
gpr_realloc(heap->alarms, heap->alarm_capacity * sizeof(grpc_alarm *));
int grpc_timer_heap_add(grpc_timer_heap *heap, grpc_timer *timer) {
if (heap->timer_count == heap->timer_capacity) {
heap->timer_capacity =
GPR_MAX(heap->timer_capacity + 1, heap->timer_capacity * 3 / 2);
heap->timers =
gpr_realloc(heap->timers, heap->timer_capacity * sizeof(grpc_timer *));
}
alarm->heap_index = heap->alarm_count;
adjust_upwards(heap->alarms, heap->alarm_count, alarm);
heap->alarm_count++;
return alarm->heap_index == 0;
timer->heap_index = heap->timer_count;
adjust_upwards(heap->timers, heap->timer_count, timer);
heap->timer_count++;
return timer->heap_index == 0;
}
void grpc_alarm_heap_remove(grpc_alarm_heap *heap, grpc_alarm *alarm) {
gpr_uint32 i = alarm->heap_index;
if (i == heap->alarm_count - 1) {
heap->alarm_count--;
void grpc_timer_heap_remove(grpc_timer_heap *heap, grpc_timer *timer) {
gpr_uint32 i = timer->heap_index;
if (i == heap->timer_count - 1) {
heap->timer_count--;
maybe_shrink(heap);
return;
}
heap->alarms[i] = heap->alarms[heap->alarm_count - 1];
heap->alarms[i]->heap_index = i;
heap->alarm_count--;
heap->timers[i] = heap->timers[heap->timer_count - 1];
heap->timers[i]->heap_index = i;
heap->timer_count--;
maybe_shrink(heap);
note_changed_priority(heap, heap->alarms[i]);
note_changed_priority(heap, heap->timers[i]);
}
int grpc_alarm_heap_is_empty(grpc_alarm_heap *heap) {
return heap->alarm_count == 0;
int grpc_timer_heap_is_empty(grpc_timer_heap *heap) {
return heap->timer_count == 0;
}
grpc_alarm *grpc_alarm_heap_top(grpc_alarm_heap *heap) {
return heap->alarms[0];
grpc_timer *grpc_timer_heap_top(grpc_timer_heap *heap) {
return heap->timers[0];
}
void grpc_alarm_heap_pop(grpc_alarm_heap *heap) {
grpc_alarm_heap_remove(heap, grpc_alarm_heap_top(heap));
void grpc_timer_heap_pop(grpc_timer_heap *heap) {
grpc_timer_heap_remove(heap, grpc_timer_heap_top(heap));
}

@ -31,27 +31,27 @@
*
*/
#ifndef GRPC_INTERNAL_CORE_IOMGR_ALARM_HEAP_H
#define GRPC_INTERNAL_CORE_IOMGR_ALARM_HEAP_H
#ifndef GRPC_INTERNAL_CORE_IOMGR_TIMER_HEAP_H
#define GRPC_INTERNAL_CORE_IOMGR_TIMER_HEAP_H
#include "src/core/iomgr/alarm.h"
#include "src/core/iomgr/timer.h"
typedef struct {
grpc_alarm **alarms;
gpr_uint32 alarm_count;
gpr_uint32 alarm_capacity;
} grpc_alarm_heap;
grpc_timer **timers;
gpr_uint32 timer_count;
gpr_uint32 timer_capacity;
} grpc_timer_heap;
/* return 1 if the new alarm is the first alarm in the heap */
int grpc_alarm_heap_add(grpc_alarm_heap *heap, grpc_alarm *alarm);
/* return 1 if the new timer is the first timer in the heap */
int grpc_timer_heap_add(grpc_timer_heap *heap, grpc_timer *timer);
void grpc_alarm_heap_init(grpc_alarm_heap *heap);
void grpc_alarm_heap_destroy(grpc_alarm_heap *heap);
void grpc_timer_heap_init(grpc_timer_heap *heap);
void grpc_timer_heap_destroy(grpc_timer_heap *heap);
void grpc_alarm_heap_remove(grpc_alarm_heap *heap, grpc_alarm *alarm);
grpc_alarm *grpc_alarm_heap_top(grpc_alarm_heap *heap);
void grpc_alarm_heap_pop(grpc_alarm_heap *heap);
void grpc_timer_heap_remove(grpc_timer_heap *heap, grpc_timer *timer);
grpc_timer *grpc_timer_heap_top(grpc_timer_heap *heap);
void grpc_timer_heap_pop(grpc_timer_heap *heap);
int grpc_alarm_heap_is_empty(grpc_alarm_heap *heap);
int grpc_timer_heap_is_empty(grpc_timer_heap *heap);
#endif /* GRPC_INTERNAL_CORE_IOMGR_ALARM_HEAP_H */
#endif /* GRPC_INTERNAL_CORE_IOMGR_TIMER_HEAP_H */

@ -31,33 +31,33 @@
*
*/
#ifndef GRPC_INTERNAL_CORE_IOMGR_ALARM_INTERNAL_H
#define GRPC_INTERNAL_CORE_IOMGR_ALARM_INTERNAL_H
#ifndef GRPC_INTERNAL_CORE_IOMGR_TIMER_INTERNAL_H
#define GRPC_INTERNAL_CORE_IOMGR_TIMER_INTERNAL_H
#include "src/core/iomgr/exec_ctx.h"
#include <grpc/support/sync.h>
#include <grpc/support/time.h>
/* iomgr internal api for dealing with alarms */
/* iomgr internal api for dealing with timers */
/* Check for alarms to be run, and run them.
Return non zero if alarm callbacks were executed.
/* Check for timers to be run, and run them.
Return non zero if timer callbacks were executed.
Drops drop_mu if it is non-null before executing callbacks.
If next is non-null, TRY to update *next with the next running alarm
IF that alarm occurs before *next current value.
If next is non-null, TRY to update *next with the next running timer
IF that timer occurs before *next current value.
*next is never guaranteed to be updated on any given execution; however,
with high probability at least one thread in the system will see an update
at any time slice. */
int grpc_alarm_check(grpc_exec_ctx* exec_ctx, gpr_timespec now,
int grpc_timer_check(grpc_exec_ctx* exec_ctx, gpr_timespec now,
gpr_timespec* next);
void grpc_alarm_list_init(gpr_timespec now);
void grpc_alarm_list_shutdown(grpc_exec_ctx* exec_ctx);
void grpc_timer_list_init(gpr_timespec now);
void grpc_timer_list_shutdown(grpc_exec_ctx* exec_ctx);
gpr_timespec grpc_alarm_list_next_timeout(void);
gpr_timespec grpc_timer_list_next_timeout(void);
/* the following must be implemented by each iomgr implementation */
void grpc_kick_poller(void);
#endif /* GRPC_INTERNAL_CORE_IOMGR_ALARM_INTERNAL_H */
#endif /* GRPC_INTERNAL_CORE_IOMGR_TIMER_INTERNAL_H */

@ -0,0 +1,83 @@
/*
*
* 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/iomgr/timer.h"
#include "src/core/surface/completion_queue.h"
#include <grpc/grpc.h>
#include <grpc/support/alloc.h>
struct grpc_alarm {
grpc_timer alarm;
grpc_cq_completion completion;
/** completion queue where events about this alarm will be posted */
grpc_completion_queue *cq;
/** user supplied tag */
void *tag;
};
static void do_nothing_end_completion(grpc_exec_ctx *exec_ctx, void *arg,
grpc_cq_completion *c) {}
static void alarm_cb(grpc_exec_ctx *exec_ctx, void *arg, int success) {
grpc_alarm *alarm = arg;
grpc_cq_end_op(exec_ctx, alarm->cq, alarm->tag, success,
do_nothing_end_completion, NULL, &alarm->completion);
}
grpc_alarm *grpc_alarm_create(grpc_completion_queue *cq, gpr_timespec deadline,
void *tag) {
grpc_alarm *alarm = gpr_malloc(sizeof(grpc_alarm));
grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
GRPC_CQ_INTERNAL_REF(cq, "alarm");
alarm->cq = cq;
alarm->tag = tag;
grpc_timer_init(&exec_ctx, &alarm->alarm, deadline, alarm_cb, alarm,
gpr_now(GPR_CLOCK_MONOTONIC));
grpc_cq_begin_op(cq);
grpc_exec_ctx_finish(&exec_ctx);
return alarm;
}
void grpc_alarm_cancel(grpc_alarm *alarm) {
grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
grpc_timer_cancel(&exec_ctx, &alarm->alarm);
grpc_exec_ctx_finish(&exec_ctx);
}
void grpc_alarm_destroy(grpc_alarm *alarm) {
grpc_alarm_cancel(alarm);
GRPC_CQ_INTERNAL_UNREF(alarm->cq, "alarm");
gpr_free(alarm);
}

@ -42,7 +42,7 @@
#include <grpc/support/useful.h>
#include "src/core/channel/channel_stack.h"
#include "src/core/iomgr/alarm.h"
#include "src/core/iomgr/timer.h"
#include "src/core/profiling/timers.h"
#include "src/core/support/string.h"
#include "src/core/surface/api_trace.h"
@ -237,7 +237,7 @@ struct grpc_call {
grpc_call_context_element context[GRPC_CONTEXT_COUNT];
/* Deadline alarm - if have_alarm is non-zero */
grpc_alarm alarm;
grpc_timer alarm;
/* Call refcount - to keep the call alive during asynchronous operations */
gpr_refcount internal_refcount;
@ -1027,7 +1027,7 @@ static void call_on_done_recv(grpc_exec_ctx *exec_ctx, void *pc, int success) {
GPR_ASSERT(call->read_state <= READ_STATE_STREAM_CLOSED);
call->read_state = READ_STATE_STREAM_CLOSED;
if (call->have_alarm) {
grpc_alarm_cancel(exec_ctx, &call->alarm);
grpc_timer_cancel(exec_ctx, &call->alarm);
}
/* propagate cancellation to any interested children */
child_call = call->first_child;
@ -1345,7 +1345,7 @@ void grpc_call_destroy(grpc_call *c) {
GPR_ASSERT(!c->destroy_called);
c->destroy_called = 1;
if (c->have_alarm) {
grpc_alarm_cancel(&exec_ctx, &c->alarm);
grpc_timer_cancel(&exec_ctx, &c->alarm);
}
cancel = c->read_state != READ_STATE_STREAM_CLOSED;
unlock(&exec_ctx, c);
@ -1470,7 +1470,7 @@ static void set_deadline_alarm(grpc_exec_ctx *exec_ctx, grpc_call *call,
GRPC_CALL_INTERNAL_REF(call, "alarm");
call->have_alarm = 1;
call->send_deadline = gpr_convert_clock_type(deadline, GPR_CLOCK_MONOTONIC);
grpc_alarm_init(exec_ctx, &call->alarm, call->send_deadline, call_alarm, call,
grpc_timer_init(exec_ctx, &call->alarm, call->send_deadline, call_alarm, call,
gpr_now(GPR_CLOCK_MONOTONIC));
}

@ -37,7 +37,7 @@
#include <grpc/support/log.h>
#include "src/core/channel/client_channel.h"
#include "src/core/iomgr/alarm.h"
#include "src/core/iomgr/timer.h"
#include "src/core/surface/api_trace.h"
#include "src/core/surface/completion_queue.h"
@ -78,7 +78,7 @@ typedef struct {
int success;
int removed;
grpc_closure on_complete;
grpc_alarm alarm;
grpc_timer alarm;
grpc_connectivity_state state;
grpc_completion_queue *cq;
grpc_cq_completion completion_storage;
@ -133,7 +133,7 @@ static void partly_done(grpc_exec_ctx *exec_ctx, state_watcher *w,
gpr_mu_lock(&w->mu);
w->success = 1;
gpr_mu_unlock(&w->mu);
grpc_alarm_cancel(exec_ctx, &w->alarm);
grpc_timer_cancel(exec_ctx, &w->alarm);
}
gpr_mu_lock(&w->mu);
@ -195,7 +195,7 @@ void grpc_channel_watch_connectivity_state(
w->tag = tag;
w->channel = channel;
grpc_alarm_init(&exec_ctx, &w->alarm,
grpc_timer_init(&exec_ctx, &w->alarm,
gpr_convert_clock_type(deadline, GPR_CLOCK_MONOTONIC),
timeout_complete, w, gpr_now(GPR_CLOCK_MONOTONIC));

@ -36,6 +36,7 @@
#include <stdio.h>
#include <string.h>
#include "src/core/iomgr/timer.h"
#include "src/core/iomgr/pollset.h"
#include "src/core/support/string.h"
#include "src/core/surface/api_trace.h"
@ -46,6 +47,7 @@
#include <grpc/support/alloc.h>
#include <grpc/support/atm.h>
#include <grpc/support/log.h>
#include <grpc/support/time.h>
typedef struct {
grpc_pollset_worker *worker;
@ -72,6 +74,15 @@ struct grpc_completion_queue {
grpc_closure pollset_destroy_done;
};
struct grpc_cq_alarm {
grpc_timer alarm;
grpc_cq_completion completion;
/** completion queue where events about this alarm will be posted */
grpc_completion_queue *cq;
/** user supplied tag */
void *tag;
};
static void on_pollset_destroy_done(grpc_exec_ctx *exec_ctx, void *cc,
int success);

@ -0,0 +1,49 @@
/*
* 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/grpc.h>
#include <grpc++/alarm.h>
namespace grpc {
Alarm::Alarm(CompletionQueue* cq, gpr_timespec deadline, void* tag)
: alarm_(grpc_alarm_create(cq->cq(), deadline, tag)) {}
Alarm::~Alarm() {
grpc_alarm_destroy(alarm_);
}
void Alarm::Cancel() {
grpc_alarm_cancel(alarm_);
}
} // namespace grpc

@ -31,7 +31,7 @@
*
*/
#include "src/core/iomgr/alarm_heap.h"
#include "src/core/iomgr/timer_heap.h"
#include <stdlib.h>
#include <string.h>
@ -48,8 +48,8 @@ static gpr_timespec random_deadline(void) {
return ts;
}
static grpc_alarm *create_test_elements(size_t num_elements) {
grpc_alarm *elems = gpr_malloc(num_elements * sizeof(grpc_alarm));
static grpc_timer *create_test_elements(size_t num_elements) {
grpc_timer *elems = gpr_malloc(num_elements * sizeof(grpc_timer));
size_t i;
for (i = 0; i < num_elements; i++) {
elems[i].deadline = random_deadline();
@ -63,17 +63,17 @@ static int cmp_elem(const void *a, const void *b) {
return i - j;
}
static size_t *all_top(grpc_alarm_heap *pq, size_t *n) {
static size_t *all_top(grpc_timer_heap *pq, size_t *n) {
size_t *vec = NULL;
size_t *need_to_check_children;
size_t num_need_to_check_children = 0;
*n = 0;
if (pq->alarm_count == 0) return vec;
if (pq->timer_count == 0) return vec;
need_to_check_children =
gpr_malloc(pq->alarm_count * sizeof(*need_to_check_children));
gpr_malloc(pq->timer_count * sizeof(*need_to_check_children));
need_to_check_children[num_need_to_check_children++] = 0;
vec = gpr_malloc(pq->alarm_count * sizeof(*vec));
vec = gpr_malloc(pq->timer_count * sizeof(*vec));
while (num_need_to_check_children > 0) {
size_t ind = need_to_check_children[0];
size_t leftchild, rightchild;
@ -82,15 +82,15 @@ static size_t *all_top(grpc_alarm_heap *pq, size_t *n) {
num_need_to_check_children * sizeof(*need_to_check_children));
vec[(*n)++] = ind;
leftchild = 1u + 2u * ind;
if (leftchild < pq->alarm_count) {
if (gpr_time_cmp(pq->alarms[leftchild]->deadline,
pq->alarms[ind]->deadline) >= 0) {
if (leftchild < pq->timer_count) {
if (gpr_time_cmp(pq->timers[leftchild]->deadline,
pq->timers[ind]->deadline) >= 0) {
need_to_check_children[num_need_to_check_children++] = leftchild;
}
rightchild = leftchild + 1;
if (rightchild < pq->alarm_count &&
gpr_time_cmp(pq->alarms[rightchild]->deadline,
pq->alarms[ind]->deadline) >= 0) {
if (rightchild < pq->timer_count &&
gpr_time_cmp(pq->timers[rightchild]->deadline,
pq->timers[ind]->deadline) >= 0) {
need_to_check_children[num_need_to_check_children++] = rightchild;
}
}
@ -101,7 +101,7 @@ static size_t *all_top(grpc_alarm_heap *pq, size_t *n) {
return vec;
}
static void check_pq_top(grpc_alarm *elements, grpc_alarm_heap *pq,
static void check_pq_top(grpc_timer *elements, grpc_timer_heap *pq,
gpr_uint8 *inpq, size_t num_elements) {
gpr_timespec max_deadline = gpr_inf_past(GPR_CLOCK_REALTIME);
size_t *max_deadline_indices =
@ -130,45 +130,45 @@ static void check_pq_top(grpc_alarm *elements, grpc_alarm_heap *pq,
gpr_free(top_elements);
}
static int contains(grpc_alarm_heap *pq, grpc_alarm *el) {
static int contains(grpc_timer_heap *pq, grpc_timer *el) {
size_t i;
for (i = 0; i < pq->alarm_count; i++) {
if (pq->alarms[i] == el) return 1;
for (i = 0; i < pq->timer_count; i++) {
if (pq->timers[i] == el) return 1;
}
return 0;
}
static void check_valid(grpc_alarm_heap *pq) {
static void check_valid(grpc_timer_heap *pq) {
size_t i;
for (i = 0; i < pq->alarm_count; ++i) {
for (i = 0; i < pq->timer_count; ++i) {
size_t left_child = 1u + 2u * i;
size_t right_child = left_child + 1u;
if (left_child < pq->alarm_count) {
GPR_ASSERT(gpr_time_cmp(pq->alarms[i]->deadline,
pq->alarms[left_child]->deadline) >= 0);
if (left_child < pq->timer_count) {
GPR_ASSERT(gpr_time_cmp(pq->timers[i]->deadline,
pq->timers[left_child]->deadline) >= 0);
}
if (right_child < pq->alarm_count) {
GPR_ASSERT(gpr_time_cmp(pq->alarms[i]->deadline,
pq->alarms[right_child]->deadline) >= 0);
if (right_child < pq->timer_count) {
GPR_ASSERT(gpr_time_cmp(pq->timers[i]->deadline,
pq->timers[right_child]->deadline) >= 0);
}
}
}
static void test1(void) {
grpc_alarm_heap pq;
grpc_timer_heap pq;
const size_t num_test_elements = 200;
const size_t num_test_operations = 10000;
size_t i;
grpc_alarm *test_elements = create_test_elements(num_test_elements);
grpc_timer *test_elements = create_test_elements(num_test_elements);
gpr_uint8 *inpq = gpr_malloc(num_test_elements);
grpc_alarm_heap_init(&pq);
grpc_timer_heap_init(&pq);
memset(inpq, 0, num_test_elements);
GPR_ASSERT(grpc_alarm_heap_is_empty(&pq));
GPR_ASSERT(grpc_timer_heap_is_empty(&pq));
check_valid(&pq);
for (i = 0; i < num_test_elements; ++i) {
GPR_ASSERT(!contains(&pq, &test_elements[i]));
grpc_alarm_heap_add(&pq, &test_elements[i]);
grpc_timer_heap_add(&pq, &test_elements[i]);
check_valid(&pq);
GPR_ASSERT(contains(&pq, &test_elements[i]));
inpq[i] = 1;
@ -180,24 +180,24 @@ static void test1(void) {
GPR_ASSERT(contains(&pq, &test_elements[i]));
}
GPR_ASSERT(pq.alarm_count == num_test_elements);
GPR_ASSERT(pq.timer_count == num_test_elements);
check_pq_top(test_elements, &pq, inpq, num_test_elements);
for (i = 0; i < num_test_operations; ++i) {
size_t elem_num = (size_t)rand() % num_test_elements;
grpc_alarm *el = &test_elements[elem_num];
grpc_timer *el = &test_elements[elem_num];
if (!inpq[elem_num]) { /* not in pq */
GPR_ASSERT(!contains(&pq, el));
el->deadline = random_deadline();
grpc_alarm_heap_add(&pq, el);
grpc_timer_heap_add(&pq, el);
GPR_ASSERT(contains(&pq, el));
inpq[elem_num] = 1;
check_pq_top(test_elements, &pq, inpq, num_test_elements);
check_valid(&pq);
} else {
GPR_ASSERT(contains(&pq, el));
grpc_alarm_heap_remove(&pq, el);
grpc_timer_heap_remove(&pq, el);
GPR_ASSERT(!contains(&pq, el));
inpq[elem_num] = 0;
check_pq_top(test_elements, &pq, inpq, num_test_elements);
@ -205,66 +205,66 @@ static void test1(void) {
}
}
grpc_alarm_heap_destroy(&pq);
grpc_timer_heap_destroy(&pq);
gpr_free(test_elements);
gpr_free(inpq);
}
static void shrink_test(void) {
grpc_alarm_heap pq;
grpc_timer_heap pq;
size_t i;
size_t expected_size;
/* A large random number to allow for multiple shrinkages, at least 512. */
const size_t num_elements = (size_t)rand() % 2000 + 512;
grpc_alarm_heap_init(&pq);
grpc_timer_heap_init(&pq);
/* Create a priority queue with many elements. Make sure the Size() is
correct. */
for (i = 0; i < num_elements; ++i) {
GPR_ASSERT(i == pq.alarm_count);
grpc_alarm_heap_add(&pq, create_test_elements(1));
GPR_ASSERT(i == pq.timer_count);
grpc_timer_heap_add(&pq, create_test_elements(1));
}
GPR_ASSERT(num_elements == pq.alarm_count);
GPR_ASSERT(num_elements == pq.timer_count);
/* Remove elements until the Size is 1/4 the original size. */
while (pq.alarm_count > num_elements / 4) {
grpc_alarm *const te = pq.alarms[pq.alarm_count - 1];
grpc_alarm_heap_remove(&pq, te);
while (pq.timer_count > num_elements / 4) {
grpc_timer *const te = pq.timers[pq.timer_count - 1];
grpc_timer_heap_remove(&pq, te);
gpr_free(te);
}
GPR_ASSERT(num_elements / 4 == pq.alarm_count);
GPR_ASSERT(num_elements / 4 == pq.timer_count);
/* Expect that Capacity is in the right range:
Size * 2 <= Capacity <= Size * 4 */
GPR_ASSERT(pq.alarm_count * 2 <= pq.alarm_capacity);
GPR_ASSERT(pq.alarm_capacity <= pq.alarm_count * 4);
GPR_ASSERT(pq.timer_count * 2 <= pq.timer_capacity);
GPR_ASSERT(pq.timer_capacity <= pq.timer_count * 4);
check_valid(&pq);
/* Remove the rest of the elements. Check that the Capacity is not more than
4 times the Size and not less than 2 times, but never goes below 16. */
expected_size = pq.alarm_count;
while (pq.alarm_count > 0) {
const size_t which = (size_t)rand() % pq.alarm_count;
grpc_alarm *te = pq.alarms[which];
grpc_alarm_heap_remove(&pq, te);
expected_size = pq.timer_count;
while (pq.timer_count > 0) {
const size_t which = (size_t)rand() % pq.timer_count;
grpc_timer *te = pq.timers[which];
grpc_timer_heap_remove(&pq, te);
gpr_free(te);
expected_size--;
GPR_ASSERT(expected_size == pq.alarm_count);
GPR_ASSERT(pq.alarm_count * 2 <= pq.alarm_capacity);
if (pq.alarm_count >= 8) {
GPR_ASSERT(pq.alarm_capacity <= pq.alarm_count * 4);
GPR_ASSERT(expected_size == pq.timer_count);
GPR_ASSERT(pq.timer_count * 2 <= pq.timer_capacity);
if (pq.timer_count >= 8) {
GPR_ASSERT(pq.timer_capacity <= pq.timer_count * 4);
} else {
GPR_ASSERT(16 <= pq.alarm_capacity);
GPR_ASSERT(16 <= pq.timer_capacity);
}
check_valid(&pq);
}
GPR_ASSERT(0 == pq.alarm_count);
GPR_ASSERT(pq.alarm_capacity >= 16 && pq.alarm_capacity < 32);
GPR_ASSERT(0 == pq.timer_count);
GPR_ASSERT(pq.timer_capacity >= 16 && pq.timer_capacity < 32);
grpc_alarm_heap_destroy(&pq);
grpc_timer_heap_destroy(&pq);
}
int main(int argc, char **argv) {

@ -31,11 +31,11 @@
*
*/
#include "src/core/iomgr/alarm.h"
#include "src/core/iomgr/timer.h"
#include <string.h>
#include "src/core/iomgr/alarm_internal.h"
#include "src/core/iomgr/timer_internal.h"
#include <grpc/support/log.h>
#include "test/core/util/test_config.h"
@ -50,29 +50,29 @@ static void cb(grpc_exec_ctx *exec_ctx, void *arg, int success) {
static void add_test(void) {
gpr_timespec start = gpr_now(GPR_CLOCK_REALTIME);
int i;
grpc_alarm alarms[20];
grpc_timer timers[20];
grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
grpc_alarm_list_init(start);
grpc_timer_list_init(start);
memset(cb_called, 0, sizeof(cb_called));
/* 10 ms alarms. will expire in the current epoch */
/* 10 ms timers. will expire in the current epoch */
for (i = 0; i < 10; i++) {
grpc_alarm_init(&exec_ctx, &alarms[i],
grpc_timer_init(&exec_ctx, &timers[i],
gpr_time_add(start, gpr_time_from_millis(10, GPR_TIMESPAN)),
cb, (void *)(gpr_intptr)i, start);
}
/* 1010 ms alarms. will expire in the next epoch */
/* 1010 ms timers. will expire in the next epoch */
for (i = 10; i < 20; i++) {
grpc_alarm_init(
&exec_ctx, &alarms[i],
grpc_timer_init(
&exec_ctx, &timers[i],
gpr_time_add(start, gpr_time_from_millis(1010, GPR_TIMESPAN)), cb,
(void *)(gpr_intptr)i, start);
}
/* collect alarms. Only the first batch should be ready. */
GPR_ASSERT(10 == grpc_alarm_check(&exec_ctx,
/* collect timers. Only the first batch should be ready. */
GPR_ASSERT(10 == grpc_timer_check(&exec_ctx,
gpr_time_add(start, gpr_time_from_millis(
500, GPR_TIMESPAN)),
NULL));
@ -82,7 +82,7 @@ static void add_test(void) {
GPR_ASSERT(cb_called[i][0] == 0);
}
GPR_ASSERT(0 == grpc_alarm_check(&exec_ctx,
GPR_ASSERT(0 == grpc_timer_check(&exec_ctx,
gpr_time_add(start, gpr_time_from_millis(
600, GPR_TIMESPAN)),
NULL));
@ -92,8 +92,8 @@ static void add_test(void) {
GPR_ASSERT(cb_called[i][0] == 0);
}
/* collect the rest of the alarms */
GPR_ASSERT(10 == grpc_alarm_check(
/* collect the rest of the timers */
GPR_ASSERT(10 == grpc_timer_check(
&exec_ctx, gpr_time_add(start, gpr_time_from_millis(
1500, GPR_TIMESPAN)),
NULL));
@ -103,7 +103,7 @@ static void add_test(void) {
GPR_ASSERT(cb_called[i][0] == 0);
}
GPR_ASSERT(0 == grpc_alarm_check(&exec_ctx,
GPR_ASSERT(0 == grpc_timer_check(&exec_ctx,
gpr_time_add(start, gpr_time_from_millis(
1600, GPR_TIMESPAN)),
NULL));
@ -112,7 +112,7 @@ static void add_test(void) {
GPR_ASSERT(cb_called[i][0] == 0);
}
grpc_alarm_list_shutdown(&exec_ctx);
grpc_timer_list_shutdown(&exec_ctx);
grpc_exec_ctx_finish(&exec_ctx);
}
@ -122,34 +122,34 @@ static gpr_timespec tfm(int m) {
return t;
}
/* Cleaning up a list with pending alarms. */
/* Cleaning up a list with pending timers. */
void destruction_test(void) {
grpc_alarm alarms[5];
grpc_timer timers[5];
grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
grpc_alarm_list_init(gpr_time_0(GPR_CLOCK_REALTIME));
grpc_timer_list_init(gpr_time_0(GPR_CLOCK_REALTIME));
memset(cb_called, 0, sizeof(cb_called));
grpc_alarm_init(&exec_ctx, &alarms[0], tfm(100), cb, (void *)(gpr_intptr)0,
grpc_timer_init(&exec_ctx, &timers[0], tfm(100), cb, (void *)(gpr_intptr)0,
gpr_time_0(GPR_CLOCK_REALTIME));
grpc_alarm_init(&exec_ctx, &alarms[1], tfm(3), cb, (void *)(gpr_intptr)1,
grpc_timer_init(&exec_ctx, &timers[1], tfm(3), cb, (void *)(gpr_intptr)1,
gpr_time_0(GPR_CLOCK_REALTIME));
grpc_alarm_init(&exec_ctx, &alarms[2], tfm(100), cb, (void *)(gpr_intptr)2,
grpc_timer_init(&exec_ctx, &timers[2], tfm(100), cb, (void *)(gpr_intptr)2,
gpr_time_0(GPR_CLOCK_REALTIME));
grpc_alarm_init(&exec_ctx, &alarms[3], tfm(3), cb, (void *)(gpr_intptr)3,
grpc_timer_init(&exec_ctx, &timers[3], tfm(3), cb, (void *)(gpr_intptr)3,
gpr_time_0(GPR_CLOCK_REALTIME));
grpc_alarm_init(&exec_ctx, &alarms[4], tfm(1), cb, (void *)(gpr_intptr)4,
grpc_timer_init(&exec_ctx, &timers[4], tfm(1), cb, (void *)(gpr_intptr)4,
gpr_time_0(GPR_CLOCK_REALTIME));
GPR_ASSERT(1 == grpc_alarm_check(&exec_ctx, tfm(2), NULL));
GPR_ASSERT(1 == grpc_timer_check(&exec_ctx, tfm(2), NULL));
grpc_exec_ctx_finish(&exec_ctx);
GPR_ASSERT(1 == cb_called[4][1]);
grpc_alarm_cancel(&exec_ctx, &alarms[0]);
grpc_alarm_cancel(&exec_ctx, &alarms[3]);
grpc_timer_cancel(&exec_ctx, &timers[0]);
grpc_timer_cancel(&exec_ctx, &timers[3]);
grpc_exec_ctx_finish(&exec_ctx);
GPR_ASSERT(1 == cb_called[0][0]);
GPR_ASSERT(1 == cb_called[3][0]);
grpc_alarm_list_shutdown(&exec_ctx);
grpc_timer_list_shutdown(&exec_ctx);
grpc_exec_ctx_finish(&exec_ctx);
GPR_ASSERT(1 == cb_called[1][0]);
GPR_ASSERT(1 == cb_called[2][0]);

@ -0,0 +1,100 @@
/*
*
* 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/grpc.h>
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
#include <grpc/support/time.h>
#include <grpc/support/useful.h>
#include "test/core/util/test_config.h"
#define LOG_TEST(x) gpr_log(GPR_INFO, "%s", x)
static void *create_test_tag(void) {
static gpr_intptr i = 0;
return (void *)(++i);
}
/* helper for tests to shutdown correctly and tersely */
static void shutdown_and_destroy(grpc_completion_queue *cc) {
grpc_event ev;
grpc_completion_queue_shutdown(cc);
ev = grpc_completion_queue_next(cc, gpr_inf_past(GPR_CLOCK_REALTIME), NULL);
GPR_ASSERT(ev.type == GRPC_QUEUE_SHUTDOWN);
grpc_completion_queue_destroy(cc);
}
static void test_alarm(void) {
grpc_completion_queue *cc;
LOG_TEST("test_alarm");
cc = grpc_completion_queue_create(NULL);
{
/* regular expiry */
grpc_event ev;
void *tag = create_test_tag();
grpc_alarm *alarm =
grpc_alarm_create(cc, GRPC_TIMEOUT_SECONDS_TO_DEADLINE(1), tag);
ev = grpc_completion_queue_next(cc, GRPC_TIMEOUT_SECONDS_TO_DEADLINE(2),
NULL);
GPR_ASSERT(ev.type == GRPC_OP_COMPLETE);
GPR_ASSERT(ev.tag == tag);
GPR_ASSERT(ev.success);
grpc_alarm_destroy(alarm);
}
{
/* cancellation */
grpc_event ev;
void *tag = create_test_tag();
grpc_alarm *alarm =
grpc_alarm_create(cc, GRPC_TIMEOUT_SECONDS_TO_DEADLINE(2), tag);
grpc_alarm_cancel(alarm);
ev = grpc_completion_queue_next(cc, GRPC_TIMEOUT_SECONDS_TO_DEADLINE(1),
NULL);
GPR_ASSERT(ev.type == GRPC_OP_COMPLETE);
GPR_ASSERT(ev.tag == tag);
GPR_ASSERT(ev.success == 0);
grpc_alarm_destroy(alarm);
}
shutdown_and_destroy(cc);
}
int main(int argc, char **argv) {
grpc_test_init(argc, argv);
grpc_init();
test_alarm();
grpc_shutdown();
return 0;
}

@ -0,0 +1,91 @@
/*
*
* 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++/alarm.h>
#include <grpc++/completion_queue.h>
#include <gtest/gtest.h>
#include "test/core/util/test_config.h"
namespace grpc {
namespace {
class TestTag : public CompletionQueueTag {
public:
TestTag() : tag_(0) {}
TestTag(gpr_intptr tag) : tag_(tag) {}
bool FinalizeResult(void** tag, bool* status) { return true; }
gpr_intptr tag() { return tag_; }
private:
gpr_intptr tag_;
};
TEST(AlarmTest, RegularExpiry) {
CompletionQueue cq;
TestTag input_tag(1618033);
Alarm alarm(&cq, GRPC_TIMEOUT_SECONDS_TO_DEADLINE(1), &input_tag);
TestTag* output_tag;
bool ok;
const CompletionQueue::NextStatus status = cq.AsyncNext(
(void**)&output_tag, &ok, GRPC_TIMEOUT_SECONDS_TO_DEADLINE(2));
EXPECT_EQ(status, CompletionQueue::GOT_EVENT);
EXPECT_TRUE(ok);
EXPECT_EQ(output_tag->tag(), input_tag.tag());
}
TEST(AlarmTest, Cancellation) {
CompletionQueue cq;
TestTag input_tag(1618033);
Alarm alarm(&cq, GRPC_TIMEOUT_SECONDS_TO_DEADLINE(2), &input_tag);
alarm.Cancel();
TestTag* output_tag;
bool ok;
const CompletionQueue::NextStatus status = cq.AsyncNext(
(void**)&output_tag, &ok, GRPC_TIMEOUT_SECONDS_TO_DEADLINE(1));
EXPECT_EQ(status, CompletionQueue::GOT_EVENT);
EXPECT_FALSE(ok);
EXPECT_EQ(output_tag->tag(), input_tag.tag());
}
} // namespace
} // namespace grpc
int main(int argc, char** argv) {
::testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();
}

@ -812,9 +812,6 @@ src/core/debug/trace.h \
src/core/httpcli/format_request.h \
src/core/httpcli/httpcli.h \
src/core/httpcli/parser.h \
src/core/iomgr/alarm.h \
src/core/iomgr/alarm_heap.h \
src/core/iomgr/alarm_internal.h \
src/core/iomgr/closure.h \
src/core/iomgr/endpoint.h \
src/core/iomgr/endpoint_pair.h \
@ -842,6 +839,9 @@ src/core/iomgr/tcp_posix.h \
src/core/iomgr/tcp_server.h \
src/core/iomgr/tcp_windows.h \
src/core/iomgr/time_averaged_stats.h \
src/core/iomgr/timer.h \
src/core/iomgr/timer_heap.h \
src/core/iomgr/timer_internal.h \
src/core/iomgr/udp_server.h \
src/core/iomgr/wakeup_fd_pipe.h \
src/core/iomgr/wakeup_fd_posix.h \
@ -947,8 +947,6 @@ src/core/debug/trace.c \
src/core/httpcli/format_request.c \
src/core/httpcli/httpcli.c \
src/core/httpcli/parser.c \
src/core/iomgr/alarm.c \
src/core/iomgr/alarm_heap.c \
src/core/iomgr/closure.c \
src/core/iomgr/endpoint.c \
src/core/iomgr/endpoint_pair_posix.c \
@ -979,6 +977,8 @@ src/core/iomgr/tcp_server_posix.c \
src/core/iomgr/tcp_server_windows.c \
src/core/iomgr/tcp_windows.c \
src/core/iomgr/time_averaged_stats.c \
src/core/iomgr/timer.c \
src/core/iomgr/timer_heap.c \
src/core/iomgr/udp_server.c \
src/core/iomgr/wakeup_fd_eventfd.c \
src/core/iomgr/wakeup_fd_nospecial.c \

@ -1,34 +1,6 @@
[
{
"deps": [
"gpr",
"gpr_test_util",
"grpc",
"grpc_test_util"
],
"headers": [],
"language": "c",
"name": "alarm_heap_test",
"src": [
"test/core/iomgr/alarm_heap_test.c"
]
},
{
"deps": [
"gpr",
"gpr_test_util",
"grpc",
"grpc_test_util"
],
"headers": [],
"language": "c",
"name": "alarm_list_test",
"src": [
"test/core/iomgr/alarm_list_test.c"
]
},
{
"deps": [
"gpr",
@ -968,6 +940,34 @@
"test/core/transport/chttp2/timeout_encoding_test.c"
]
},
{
"deps": [
"gpr",
"gpr_test_util",
"grpc",
"grpc_test_util"
],
"headers": [],
"language": "c",
"name": "timer_heap_test",
"src": [
"test/core/iomgr/timer_heap_test.c"
]
},
{
"deps": [
"gpr",
"gpr_test_util",
"grpc",
"grpc_test_util"
],
"headers": [],
"language": "c",
"name": "timer_list_test",
"src": [
"test/core/iomgr/timer_list_test.c"
]
},
{
"deps": [
"gpr",
@ -12315,9 +12315,6 @@
"src/core/httpcli/format_request.h",
"src/core/httpcli/httpcli.h",
"src/core/httpcli/parser.h",
"src/core/iomgr/alarm.h",
"src/core/iomgr/alarm_heap.h",
"src/core/iomgr/alarm_internal.h",
"src/core/iomgr/closure.h",
"src/core/iomgr/endpoint.h",
"src/core/iomgr/endpoint_pair.h",
@ -12345,6 +12342,9 @@
"src/core/iomgr/tcp_server.h",
"src/core/iomgr/tcp_windows.h",
"src/core/iomgr/time_averaged_stats.h",
"src/core/iomgr/timer.h",
"src/core/iomgr/timer_heap.h",
"src/core/iomgr/timer_internal.h",
"src/core/iomgr/udp_server.h",
"src/core/iomgr/wakeup_fd_pipe.h",
"src/core/iomgr/wakeup_fd_posix.h",
@ -12490,11 +12490,6 @@
"src/core/httpcli/httpcli_security_connector.c",
"src/core/httpcli/parser.c",
"src/core/httpcli/parser.h",
"src/core/iomgr/alarm.c",
"src/core/iomgr/alarm.h",
"src/core/iomgr/alarm_heap.c",
"src/core/iomgr/alarm_heap.h",
"src/core/iomgr/alarm_internal.h",
"src/core/iomgr/closure.c",
"src/core/iomgr/closure.h",
"src/core/iomgr/endpoint.c",
@ -12552,6 +12547,11 @@
"src/core/iomgr/tcp_windows.h",
"src/core/iomgr/time_averaged_stats.c",
"src/core/iomgr/time_averaged_stats.h",
"src/core/iomgr/timer.c",
"src/core/iomgr/timer.h",
"src/core/iomgr/timer_heap.c",
"src/core/iomgr/timer_heap.h",
"src/core/iomgr/timer_internal.h",
"src/core/iomgr/udp_server.c",
"src/core/iomgr/udp_server.h",
"src/core/iomgr/wakeup_fd_eventfd.c",
@ -12818,9 +12818,6 @@
"src/core/httpcli/format_request.h",
"src/core/httpcli/httpcli.h",
"src/core/httpcli/parser.h",
"src/core/iomgr/alarm.h",
"src/core/iomgr/alarm_heap.h",
"src/core/iomgr/alarm_internal.h",
"src/core/iomgr/closure.h",
"src/core/iomgr/endpoint.h",
"src/core/iomgr/endpoint_pair.h",
@ -12848,6 +12845,9 @@
"src/core/iomgr/tcp_server.h",
"src/core/iomgr/tcp_windows.h",
"src/core/iomgr/time_averaged_stats.h",
"src/core/iomgr/timer.h",
"src/core/iomgr/timer_heap.h",
"src/core/iomgr/timer_internal.h",
"src/core/iomgr/udp_server.h",
"src/core/iomgr/wakeup_fd_pipe.h",
"src/core/iomgr/wakeup_fd_posix.h",
@ -12978,11 +12978,6 @@
"src/core/httpcli/httpcli.h",
"src/core/httpcli/parser.c",
"src/core/httpcli/parser.h",
"src/core/iomgr/alarm.c",
"src/core/iomgr/alarm.h",
"src/core/iomgr/alarm_heap.c",
"src/core/iomgr/alarm_heap.h",
"src/core/iomgr/alarm_internal.h",
"src/core/iomgr/closure.c",
"src/core/iomgr/closure.h",
"src/core/iomgr/endpoint.c",
@ -13040,6 +13035,11 @@
"src/core/iomgr/tcp_windows.h",
"src/core/iomgr/time_averaged_stats.c",
"src/core/iomgr/time_averaged_stats.h",
"src/core/iomgr/timer.c",
"src/core/iomgr/timer.h",
"src/core/iomgr/timer_heap.c",
"src/core/iomgr/timer_heap.h",
"src/core/iomgr/timer_internal.h",
"src/core/iomgr/udp_server.c",
"src/core/iomgr/udp_server.h",
"src/core/iomgr/wakeup_fd_eventfd.c",

@ -1,42 +1,6 @@
[
{
"ci_platforms": [
"linux",
"mac",
"posix",
"windows"
],
"exclude_configs": [],
"flaky": false,
"language": "c",
"name": "alarm_heap_test",
"platforms": [
"linux",
"mac",
"posix",
"windows"
]
},
{
"ci_platforms": [
"linux",
"mac",
"posix",
"windows"
],
"exclude_configs": [],
"flaky": false,
"language": "c",
"name": "alarm_list_test",
"platforms": [
"linux",
"mac",
"posix",
"windows"
]
},
{
"ci_platforms": [
"linux",
@ -1097,6 +1061,42 @@
"windows"
]
},
{
"ci_platforms": [
"linux",
"mac",
"posix",
"windows"
],
"exclude_configs": [],
"flaky": false,
"language": "c",
"name": "timer_heap_test",
"platforms": [
"linux",
"mac",
"posix",
"windows"
]
},
{
"ci_platforms": [
"linux",
"mac",
"posix",
"windows"
],
"exclude_configs": [],
"flaky": false,
"language": "c",
"name": "timer_list_test",
"platforms": [
"linux",
"mac",
"posix",
"windows"
]
},
{
"ci_platforms": [
"linux",

@ -575,28 +575,6 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "bad_client_test", "vcxproj\
{B23D3D1A-9438-4EDA-BEB6-9A0A03D17792} = {B23D3D1A-9438-4EDA-BEB6-9A0A03D17792}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "alarm_heap_test", "vcxproj\test\alarm_heap_test\alarm_heap_test.vcxproj", "{B1746F03-DFBD-83E6-9886-2BB0F9D70B57}"
ProjectSection(myProperties) = preProject
lib = "False"
EndProjectSection
ProjectSection(ProjectDependencies) = postProject
{17BCAFC0-5FDC-4C94-AEB9-95F3E220614B} = {17BCAFC0-5FDC-4C94-AEB9-95F3E220614B}
{29D16885-7228-4C31-81ED-5F9187C7F2A9} = {29D16885-7228-4C31-81ED-5F9187C7F2A9}
{EAB0A629-17A9-44DB-B5FF-E91A721FE037} = {EAB0A629-17A9-44DB-B5FF-E91A721FE037}
{B23D3D1A-9438-4EDA-BEB6-9A0A03D17792} = {B23D3D1A-9438-4EDA-BEB6-9A0A03D17792}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "alarm_list_test", "vcxproj\test\alarm_list_test\alarm_list_test.vcxproj", "{E6F27D86-476F-CB60-AC56-ED3A210C0E96}"
ProjectSection(myProperties) = preProject
lib = "False"
EndProjectSection
ProjectSection(ProjectDependencies) = postProject
{17BCAFC0-5FDC-4C94-AEB9-95F3E220614B} = {17BCAFC0-5FDC-4C94-AEB9-95F3E220614B}
{29D16885-7228-4C31-81ED-5F9187C7F2A9} = {29D16885-7228-4C31-81ED-5F9187C7F2A9}
{EAB0A629-17A9-44DB-B5FF-E91A721FE037} = {EAB0A629-17A9-44DB-B5FF-E91A721FE037}
{B23D3D1A-9438-4EDA-BEB6-9A0A03D17792} = {B23D3D1A-9438-4EDA-BEB6-9A0A03D17792}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "alpn_test", "vcxproj\test\alpn_test\alpn_test.vcxproj", "{5BAAE7EA-A972-DD80-F190-29B9E3110BB3}"
ProjectSection(myProperties) = preProject
lib = "False"
@ -1204,6 +1182,28 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "timeout_encoding_test", "vc
{B23D3D1A-9438-4EDA-BEB6-9A0A03D17792} = {B23D3D1A-9438-4EDA-BEB6-9A0A03D17792}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "timer_heap_test", "vcxproj\test\timer_heap_test\timer_heap_test.vcxproj", "{A2110C60-E75A-F76E-205E-1836F86C4D53}"
ProjectSection(myProperties) = preProject
lib = "False"
EndProjectSection
ProjectSection(ProjectDependencies) = postProject
{17BCAFC0-5FDC-4C94-AEB9-95F3E220614B} = {17BCAFC0-5FDC-4C94-AEB9-95F3E220614B}
{29D16885-7228-4C31-81ED-5F9187C7F2A9} = {29D16885-7228-4C31-81ED-5F9187C7F2A9}
{EAB0A629-17A9-44DB-B5FF-E91A721FE037} = {EAB0A629-17A9-44DB-B5FF-E91A721FE037}
{B23D3D1A-9438-4EDA-BEB6-9A0A03D17792} = {B23D3D1A-9438-4EDA-BEB6-9A0A03D17792}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "timer_list_test", "vcxproj\test\timer_list_test\timer_list_test.vcxproj", "{C43EA45B-1E72-C58D-8CE3-A879D1B1E2DB}"
ProjectSection(myProperties) = preProject
lib = "False"
EndProjectSection
ProjectSection(ProjectDependencies) = postProject
{17BCAFC0-5FDC-4C94-AEB9-95F3E220614B} = {17BCAFC0-5FDC-4C94-AEB9-95F3E220614B}
{29D16885-7228-4C31-81ED-5F9187C7F2A9} = {29D16885-7228-4C31-81ED-5F9187C7F2A9}
{EAB0A629-17A9-44DB-B5FF-E91A721FE037} = {EAB0A629-17A9-44DB-B5FF-E91A721FE037}
{B23D3D1A-9438-4EDA-BEB6-9A0A03D17792} = {B23D3D1A-9438-4EDA-BEB6-9A0A03D17792}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "timers_test", "vcxproj\test\timers_test\timers_test.vcxproj", "{FFE98236-3F4D-2CBA-29FB-D0A7467D2FA5}"
ProjectSection(myProperties) = preProject
lib = "False"
@ -8765,38 +8765,6 @@ Global
{BA67B418-B699-E41A-9CC4-0279C49481A5}.Release-DLL|Win32.Build.0 = Release|Win32
{BA67B418-B699-E41A-9CC4-0279C49481A5}.Release-DLL|x64.ActiveCfg = Release|x64
{BA67B418-B699-E41A-9CC4-0279C49481A5}.Release-DLL|x64.Build.0 = Release|x64
{B1746F03-DFBD-83E6-9886-2BB0F9D70B57}.Debug|Win32.ActiveCfg = Debug|Win32
{B1746F03-DFBD-83E6-9886-2BB0F9D70B57}.Debug|x64.ActiveCfg = Debug|x64
{B1746F03-DFBD-83E6-9886-2BB0F9D70B57}.Release|Win32.ActiveCfg = Release|Win32
{B1746F03-DFBD-83E6-9886-2BB0F9D70B57}.Release|x64.ActiveCfg = Release|x64
{B1746F03-DFBD-83E6-9886-2BB0F9D70B57}.Debug|Win32.Build.0 = Debug|Win32
{B1746F03-DFBD-83E6-9886-2BB0F9D70B57}.Debug|x64.Build.0 = Debug|x64
{B1746F03-DFBD-83E6-9886-2BB0F9D70B57}.Release|Win32.Build.0 = Release|Win32
{B1746F03-DFBD-83E6-9886-2BB0F9D70B57}.Release|x64.Build.0 = Release|x64
{B1746F03-DFBD-83E6-9886-2BB0F9D70B57}.Debug-DLL|Win32.ActiveCfg = Debug|Win32
{B1746F03-DFBD-83E6-9886-2BB0F9D70B57}.Debug-DLL|Win32.Build.0 = Debug|Win32
{B1746F03-DFBD-83E6-9886-2BB0F9D70B57}.Debug-DLL|x64.ActiveCfg = Debug|x64
{B1746F03-DFBD-83E6-9886-2BB0F9D70B57}.Debug-DLL|x64.Build.0 = Debug|x64
{B1746F03-DFBD-83E6-9886-2BB0F9D70B57}.Release-DLL|Win32.ActiveCfg = Release|Win32
{B1746F03-DFBD-83E6-9886-2BB0F9D70B57}.Release-DLL|Win32.Build.0 = Release|Win32
{B1746F03-DFBD-83E6-9886-2BB0F9D70B57}.Release-DLL|x64.ActiveCfg = Release|x64
{B1746F03-DFBD-83E6-9886-2BB0F9D70B57}.Release-DLL|x64.Build.0 = Release|x64
{E6F27D86-476F-CB60-AC56-ED3A210C0E96}.Debug|Win32.ActiveCfg = Debug|Win32
{E6F27D86-476F-CB60-AC56-ED3A210C0E96}.Debug|x64.ActiveCfg = Debug|x64
{E6F27D86-476F-CB60-AC56-ED3A210C0E96}.Release|Win32.ActiveCfg = Release|Win32
{E6F27D86-476F-CB60-AC56-ED3A210C0E96}.Release|x64.ActiveCfg = Release|x64
{E6F27D86-476F-CB60-AC56-ED3A210C0E96}.Debug|Win32.Build.0 = Debug|Win32
{E6F27D86-476F-CB60-AC56-ED3A210C0E96}.Debug|x64.Build.0 = Debug|x64
{E6F27D86-476F-CB60-AC56-ED3A210C0E96}.Release|Win32.Build.0 = Release|Win32
{E6F27D86-476F-CB60-AC56-ED3A210C0E96}.Release|x64.Build.0 = Release|x64
{E6F27D86-476F-CB60-AC56-ED3A210C0E96}.Debug-DLL|Win32.ActiveCfg = Debug|Win32
{E6F27D86-476F-CB60-AC56-ED3A210C0E96}.Debug-DLL|Win32.Build.0 = Debug|Win32
{E6F27D86-476F-CB60-AC56-ED3A210C0E96}.Debug-DLL|x64.ActiveCfg = Debug|x64
{E6F27D86-476F-CB60-AC56-ED3A210C0E96}.Debug-DLL|x64.Build.0 = Debug|x64
{E6F27D86-476F-CB60-AC56-ED3A210C0E96}.Release-DLL|Win32.ActiveCfg = Release|Win32
{E6F27D86-476F-CB60-AC56-ED3A210C0E96}.Release-DLL|Win32.Build.0 = Release|Win32
{E6F27D86-476F-CB60-AC56-ED3A210C0E96}.Release-DLL|x64.ActiveCfg = Release|x64
{E6F27D86-476F-CB60-AC56-ED3A210C0E96}.Release-DLL|x64.Build.0 = Release|x64
{5BAAE7EA-A972-DD80-F190-29B9E3110BB3}.Debug|Win32.ActiveCfg = Debug|Win32
{5BAAE7EA-A972-DD80-F190-29B9E3110BB3}.Debug|x64.ActiveCfg = Debug|x64
{5BAAE7EA-A972-DD80-F190-29B9E3110BB3}.Release|Win32.ActiveCfg = Release|Win32
@ -9741,6 +9709,38 @@ Global
{EA073C36-A527-F749-AD4A-243A38B9BFF5}.Release-DLL|Win32.Build.0 = Release|Win32
{EA073C36-A527-F749-AD4A-243A38B9BFF5}.Release-DLL|x64.ActiveCfg = Release|x64
{EA073C36-A527-F749-AD4A-243A38B9BFF5}.Release-DLL|x64.Build.0 = Release|x64
{A2110C60-E75A-F76E-205E-1836F86C4D53}.Debug|Win32.ActiveCfg = Debug|Win32
{A2110C60-E75A-F76E-205E-1836F86C4D53}.Debug|x64.ActiveCfg = Debug|x64
{A2110C60-E75A-F76E-205E-1836F86C4D53}.Release|Win32.ActiveCfg = Release|Win32
{A2110C60-E75A-F76E-205E-1836F86C4D53}.Release|x64.ActiveCfg = Release|x64
{A2110C60-E75A-F76E-205E-1836F86C4D53}.Debug|Win32.Build.0 = Debug|Win32
{A2110C60-E75A-F76E-205E-1836F86C4D53}.Debug|x64.Build.0 = Debug|x64
{A2110C60-E75A-F76E-205E-1836F86C4D53}.Release|Win32.Build.0 = Release|Win32
{A2110C60-E75A-F76E-205E-1836F86C4D53}.Release|x64.Build.0 = Release|x64
{A2110C60-E75A-F76E-205E-1836F86C4D53}.Debug-DLL|Win32.ActiveCfg = Debug|Win32
{A2110C60-E75A-F76E-205E-1836F86C4D53}.Debug-DLL|Win32.Build.0 = Debug|Win32
{A2110C60-E75A-F76E-205E-1836F86C4D53}.Debug-DLL|x64.ActiveCfg = Debug|x64
{A2110C60-E75A-F76E-205E-1836F86C4D53}.Debug-DLL|x64.Build.0 = Debug|x64
{A2110C60-E75A-F76E-205E-1836F86C4D53}.Release-DLL|Win32.ActiveCfg = Release|Win32
{A2110C60-E75A-F76E-205E-1836F86C4D53}.Release-DLL|Win32.Build.0 = Release|Win32
{A2110C60-E75A-F76E-205E-1836F86C4D53}.Release-DLL|x64.ActiveCfg = Release|x64
{A2110C60-E75A-F76E-205E-1836F86C4D53}.Release-DLL|x64.Build.0 = Release|x64
{C43EA45B-1E72-C58D-8CE3-A879D1B1E2DB}.Debug|Win32.ActiveCfg = Debug|Win32
{C43EA45B-1E72-C58D-8CE3-A879D1B1E2DB}.Debug|x64.ActiveCfg = Debug|x64
{C43EA45B-1E72-C58D-8CE3-A879D1B1E2DB}.Release|Win32.ActiveCfg = Release|Win32
{C43EA45B-1E72-C58D-8CE3-A879D1B1E2DB}.Release|x64.ActiveCfg = Release|x64
{C43EA45B-1E72-C58D-8CE3-A879D1B1E2DB}.Debug|Win32.Build.0 = Debug|Win32
{C43EA45B-1E72-C58D-8CE3-A879D1B1E2DB}.Debug|x64.Build.0 = Debug|x64
{C43EA45B-1E72-C58D-8CE3-A879D1B1E2DB}.Release|Win32.Build.0 = Release|Win32
{C43EA45B-1E72-C58D-8CE3-A879D1B1E2DB}.Release|x64.Build.0 = Release|x64
{C43EA45B-1E72-C58D-8CE3-A879D1B1E2DB}.Debug-DLL|Win32.ActiveCfg = Debug|Win32
{C43EA45B-1E72-C58D-8CE3-A879D1B1E2DB}.Debug-DLL|Win32.Build.0 = Debug|Win32
{C43EA45B-1E72-C58D-8CE3-A879D1B1E2DB}.Debug-DLL|x64.ActiveCfg = Debug|x64
{C43EA45B-1E72-C58D-8CE3-A879D1B1E2DB}.Debug-DLL|x64.Build.0 = Debug|x64
{C43EA45B-1E72-C58D-8CE3-A879D1B1E2DB}.Release-DLL|Win32.ActiveCfg = Release|Win32
{C43EA45B-1E72-C58D-8CE3-A879D1B1E2DB}.Release-DLL|Win32.Build.0 = Release|Win32
{C43EA45B-1E72-C58D-8CE3-A879D1B1E2DB}.Release-DLL|x64.ActiveCfg = Release|x64
{C43EA45B-1E72-C58D-8CE3-A879D1B1E2DB}.Release-DLL|x64.Build.0 = Release|x64
{FFE98236-3F4D-2CBA-29FB-D0A7467D2FA5}.Debug|Win32.ActiveCfg = Debug|Win32
{FFE98236-3F4D-2CBA-29FB-D0A7467D2FA5}.Debug|x64.ActiveCfg = Debug|x64
{FFE98236-3F4D-2CBA-29FB-D0A7467D2FA5}.Release|Win32.ActiveCfg = Release|Win32

@ -298,9 +298,6 @@
<ClInclude Include="..\..\..\src\core\httpcli\format_request.h" />
<ClInclude Include="..\..\..\src\core\httpcli\httpcli.h" />
<ClInclude Include="..\..\..\src\core\httpcli\parser.h" />
<ClInclude Include="..\..\..\src\core\iomgr\alarm.h" />
<ClInclude Include="..\..\..\src\core\iomgr\alarm_heap.h" />
<ClInclude Include="..\..\..\src\core\iomgr\alarm_internal.h" />
<ClInclude Include="..\..\..\src\core\iomgr\closure.h" />
<ClInclude Include="..\..\..\src\core\iomgr\endpoint.h" />
<ClInclude Include="..\..\..\src\core\iomgr\endpoint_pair.h" />
@ -328,6 +325,9 @@
<ClInclude Include="..\..\..\src\core\iomgr\tcp_server.h" />
<ClInclude Include="..\..\..\src\core\iomgr\tcp_windows.h" />
<ClInclude Include="..\..\..\src\core\iomgr\time_averaged_stats.h" />
<ClInclude Include="..\..\..\src\core\iomgr\timer.h" />
<ClInclude Include="..\..\..\src\core\iomgr\timer_heap.h" />
<ClInclude Include="..\..\..\src\core\iomgr\timer_internal.h" />
<ClInclude Include="..\..\..\src\core\iomgr\udp_server.h" />
<ClInclude Include="..\..\..\src\core\iomgr\wakeup_fd_pipe.h" />
<ClInclude Include="..\..\..\src\core\iomgr\wakeup_fd_posix.h" />
@ -489,10 +489,6 @@
</ClCompile>
<ClCompile Include="..\..\..\src\core\httpcli\parser.c">
</ClCompile>
<ClCompile Include="..\..\..\src\core\iomgr\alarm.c">
</ClCompile>
<ClCompile Include="..\..\..\src\core\iomgr\alarm_heap.c">
</ClCompile>
<ClCompile Include="..\..\..\src\core\iomgr\closure.c">
</ClCompile>
<ClCompile Include="..\..\..\src\core\iomgr\endpoint.c">
@ -553,6 +549,10 @@
</ClCompile>
<ClCompile Include="..\..\..\src\core\iomgr\time_averaged_stats.c">
</ClCompile>
<ClCompile Include="..\..\..\src\core\iomgr\timer.c">
</ClCompile>
<ClCompile Include="..\..\..\src\core\iomgr\timer_heap.c">
</ClCompile>
<ClCompile Include="..\..\..\src\core\iomgr\udp_server.c">
</ClCompile>
<ClCompile Include="..\..\..\src\core\iomgr\wakeup_fd_eventfd.c">

@ -163,12 +163,6 @@
<ClCompile Include="..\..\..\src\core\httpcli\parser.c">
<Filter>src\core\httpcli</Filter>
</ClCompile>
<ClCompile Include="..\..\..\src\core\iomgr\alarm.c">
<Filter>src\core\iomgr</Filter>
</ClCompile>
<ClCompile Include="..\..\..\src\core\iomgr\alarm_heap.c">
<Filter>src\core\iomgr</Filter>
</ClCompile>
<ClCompile Include="..\..\..\src\core\iomgr\closure.c">
<Filter>src\core\iomgr</Filter>
</ClCompile>
@ -259,6 +253,12 @@
<ClCompile Include="..\..\..\src\core\iomgr\time_averaged_stats.c">
<Filter>src\core\iomgr</Filter>
</ClCompile>
<ClCompile Include="..\..\..\src\core\iomgr\timer.c">
<Filter>src\core\iomgr</Filter>
</ClCompile>
<ClCompile Include="..\..\..\src\core\iomgr\timer_heap.c">
<Filter>src\core\iomgr</Filter>
</ClCompile>
<ClCompile Include="..\..\..\src\core\iomgr\udp_server.c">
<Filter>src\core\iomgr</Filter>
</ClCompile>
@ -599,15 +599,6 @@
<ClInclude Include="..\..\..\src\core\httpcli\parser.h">
<Filter>src\core\httpcli</Filter>
</ClInclude>
<ClInclude Include="..\..\..\src\core\iomgr\alarm.h">
<Filter>src\core\iomgr</Filter>
</ClInclude>
<ClInclude Include="..\..\..\src\core\iomgr\alarm_heap.h">
<Filter>src\core\iomgr</Filter>
</ClInclude>
<ClInclude Include="..\..\..\src\core\iomgr\alarm_internal.h">
<Filter>src\core\iomgr</Filter>
</ClInclude>
<ClInclude Include="..\..\..\src\core\iomgr\closure.h">
<Filter>src\core\iomgr</Filter>
</ClInclude>
@ -689,6 +680,15 @@
<ClInclude Include="..\..\..\src\core\iomgr\time_averaged_stats.h">
<Filter>src\core\iomgr</Filter>
</ClInclude>
<ClInclude Include="..\..\..\src\core\iomgr\timer.h">
<Filter>src\core\iomgr</Filter>
</ClInclude>
<ClInclude Include="..\..\..\src\core\iomgr\timer_heap.h">
<Filter>src\core\iomgr</Filter>
</ClInclude>
<ClInclude Include="..\..\..\src\core\iomgr\timer_internal.h">
<Filter>src\core\iomgr</Filter>
</ClInclude>
<ClInclude Include="..\..\..\src\core\iomgr\udp_server.h">
<Filter>src\core\iomgr</Filter>
</ClInclude>

@ -277,9 +277,6 @@
<ClInclude Include="..\..\..\src\core\httpcli\format_request.h" />
<ClInclude Include="..\..\..\src\core\httpcli\httpcli.h" />
<ClInclude Include="..\..\..\src\core\httpcli\parser.h" />
<ClInclude Include="..\..\..\src\core\iomgr\alarm.h" />
<ClInclude Include="..\..\..\src\core\iomgr\alarm_heap.h" />
<ClInclude Include="..\..\..\src\core\iomgr\alarm_internal.h" />
<ClInclude Include="..\..\..\src\core\iomgr\closure.h" />
<ClInclude Include="..\..\..\src\core\iomgr\endpoint.h" />
<ClInclude Include="..\..\..\src\core\iomgr\endpoint_pair.h" />
@ -307,6 +304,9 @@
<ClInclude Include="..\..\..\src\core\iomgr\tcp_server.h" />
<ClInclude Include="..\..\..\src\core\iomgr\tcp_windows.h" />
<ClInclude Include="..\..\..\src\core\iomgr\time_averaged_stats.h" />
<ClInclude Include="..\..\..\src\core\iomgr\timer.h" />
<ClInclude Include="..\..\..\src\core\iomgr\timer_heap.h" />
<ClInclude Include="..\..\..\src\core\iomgr\timer_internal.h" />
<ClInclude Include="..\..\..\src\core\iomgr\udp_server.h" />
<ClInclude Include="..\..\..\src\core\iomgr\wakeup_fd_pipe.h" />
<ClInclude Include="..\..\..\src\core\iomgr\wakeup_fd_posix.h" />
@ -428,10 +428,6 @@
</ClCompile>
<ClCompile Include="..\..\..\src\core\httpcli\parser.c">
</ClCompile>
<ClCompile Include="..\..\..\src\core\iomgr\alarm.c">
</ClCompile>
<ClCompile Include="..\..\..\src\core\iomgr\alarm_heap.c">
</ClCompile>
<ClCompile Include="..\..\..\src\core\iomgr\closure.c">
</ClCompile>
<ClCompile Include="..\..\..\src\core\iomgr\endpoint.c">
@ -492,6 +488,10 @@
</ClCompile>
<ClCompile Include="..\..\..\src\core\iomgr\time_averaged_stats.c">
</ClCompile>
<ClCompile Include="..\..\..\src\core\iomgr\timer.c">
</ClCompile>
<ClCompile Include="..\..\..\src\core\iomgr\timer_heap.c">
</ClCompile>
<ClCompile Include="..\..\..\src\core\iomgr\udp_server.c">
</ClCompile>
<ClCompile Include="..\..\..\src\core\iomgr\wakeup_fd_eventfd.c">

@ -103,12 +103,6 @@
<ClCompile Include="..\..\..\src\core\httpcli\parser.c">
<Filter>src\core\httpcli</Filter>
</ClCompile>
<ClCompile Include="..\..\..\src\core\iomgr\alarm.c">
<Filter>src\core\iomgr</Filter>
</ClCompile>
<ClCompile Include="..\..\..\src\core\iomgr\alarm_heap.c">
<Filter>src\core\iomgr</Filter>
</ClCompile>
<ClCompile Include="..\..\..\src\core\iomgr\closure.c">
<Filter>src\core\iomgr</Filter>
</ClCompile>
@ -199,6 +193,12 @@
<ClCompile Include="..\..\..\src\core\iomgr\time_averaged_stats.c">
<Filter>src\core\iomgr</Filter>
</ClCompile>
<ClCompile Include="..\..\..\src\core\iomgr\timer.c">
<Filter>src\core\iomgr</Filter>
</ClCompile>
<ClCompile Include="..\..\..\src\core\iomgr\timer_heap.c">
<Filter>src\core\iomgr</Filter>
</ClCompile>
<ClCompile Include="..\..\..\src\core\iomgr\udp_server.c">
<Filter>src\core\iomgr</Filter>
</ClCompile>
@ -497,15 +497,6 @@
<ClInclude Include="..\..\..\src\core\httpcli\parser.h">
<Filter>src\core\httpcli</Filter>
</ClInclude>
<ClInclude Include="..\..\..\src\core\iomgr\alarm.h">
<Filter>src\core\iomgr</Filter>
</ClInclude>
<ClInclude Include="..\..\..\src\core\iomgr\alarm_heap.h">
<Filter>src\core\iomgr</Filter>
</ClInclude>
<ClInclude Include="..\..\..\src\core\iomgr\alarm_internal.h">
<Filter>src\core\iomgr</Filter>
</ClInclude>
<ClInclude Include="..\..\..\src\core\iomgr\closure.h">
<Filter>src\core\iomgr</Filter>
</ClInclude>
@ -587,6 +578,15 @@
<ClInclude Include="..\..\..\src\core\iomgr\time_averaged_stats.h">
<Filter>src\core\iomgr</Filter>
</ClInclude>
<ClInclude Include="..\..\..\src\core\iomgr\timer.h">
<Filter>src\core\iomgr</Filter>
</ClInclude>
<ClInclude Include="..\..\..\src\core\iomgr\timer_heap.h">
<Filter>src\core\iomgr</Filter>
</ClInclude>
<ClInclude Include="..\..\..\src\core\iomgr\timer_internal.h">
<Filter>src\core\iomgr</Filter>
</ClInclude>
<ClInclude Include="..\..\..\src\core\iomgr\udp_server.h">
<Filter>src\core\iomgr</Filter>
</ClInclude>

@ -20,7 +20,7 @@
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{E6F27D86-476F-CB60-AC56-ED3A210C0E96}</ProjectGuid>
<ProjectGuid>{A2110C60-E75A-F76E-205E-1836F86C4D53}</ProjectGuid>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(VisualStudioVersion)' == '10.0'" Label="Configuration">
@ -55,13 +55,13 @@
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)'=='Debug'">
<TargetName>alarm_list_test</TargetName>
<TargetName>timer_heap_test</TargetName>
<Linkage-grpc_dependencies_zlib>static</Linkage-grpc_dependencies_zlib>
<Configuration-grpc_dependencies_zlib>Debug</Configuration-grpc_dependencies_zlib>
<Configuration-grpc_dependencies_openssl>Debug</Configuration-grpc_dependencies_openssl>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)'=='Release'">
<TargetName>alarm_list_test</TargetName>
<TargetName>timer_heap_test</TargetName>
<Linkage-grpc_dependencies_zlib>static</Linkage-grpc_dependencies_zlib>
<Configuration-grpc_dependencies_zlib>Debug</Configuration-grpc_dependencies_zlib>
<Configuration-grpc_dependencies_openssl>Debug</Configuration-grpc_dependencies_openssl>
@ -143,7 +143,7 @@
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="..\..\..\..\test\core\iomgr\alarm_list_test.c">
<ClCompile Include="..\..\..\..\test\core\iomgr\timer_heap_test.c">
</ClCompile>
</ItemGroup>
<ItemGroup>

@ -1,20 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<ClCompile Include="..\..\..\..\test\core\iomgr\alarm_heap_test.c">
<ClCompile Include="..\..\..\..\test\core\iomgr\timer_heap_test.c">
<Filter>test\core\iomgr</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<Filter Include="test">
<UniqueIdentifier>{39c80086-e80b-b26f-6db8-7057b2bd93b3}</UniqueIdentifier>
<UniqueIdentifier>{c7789d63-cb31-a5ba-a830-4a6223e5561c}</UniqueIdentifier>
</Filter>
<Filter Include="test\core">
<UniqueIdentifier>{c551e414-1de0-a7c1-a69b-3ba69c55e5d4}</UniqueIdentifier>
<UniqueIdentifier>{320a9cb8-0041-acb0-79d5-6cff8f1fdeba}</UniqueIdentifier>
</Filter>
<Filter Include="test\core\iomgr">
<UniqueIdentifier>{1330dfd2-f26b-7973-17c9-97c8809e9b74}</UniqueIdentifier>
<UniqueIdentifier>{df867a7c-861e-6482-a5b2-35a8ca345a6a}</UniqueIdentifier>
</Filter>
</ItemGroup>
</Project>

@ -20,7 +20,7 @@
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{B1746F03-DFBD-83E6-9886-2BB0F9D70B57}</ProjectGuid>
<ProjectGuid>{C43EA45B-1E72-C58D-8CE3-A879D1B1E2DB}</ProjectGuid>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(VisualStudioVersion)' == '10.0'" Label="Configuration">
@ -55,13 +55,13 @@
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)'=='Debug'">
<TargetName>alarm_heap_test</TargetName>
<TargetName>timer_list_test</TargetName>
<Linkage-grpc_dependencies_zlib>static</Linkage-grpc_dependencies_zlib>
<Configuration-grpc_dependencies_zlib>Debug</Configuration-grpc_dependencies_zlib>
<Configuration-grpc_dependencies_openssl>Debug</Configuration-grpc_dependencies_openssl>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)'=='Release'">
<TargetName>alarm_heap_test</TargetName>
<TargetName>timer_list_test</TargetName>
<Linkage-grpc_dependencies_zlib>static</Linkage-grpc_dependencies_zlib>
<Configuration-grpc_dependencies_zlib>Debug</Configuration-grpc_dependencies_zlib>
<Configuration-grpc_dependencies_openssl>Debug</Configuration-grpc_dependencies_openssl>
@ -143,7 +143,7 @@
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="..\..\..\..\test\core\iomgr\alarm_heap_test.c">
<ClCompile Include="..\..\..\..\test\core\iomgr\timer_list_test.c">
</ClCompile>
</ItemGroup>
<ItemGroup>

@ -1,20 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<ClCompile Include="..\..\..\..\test\core\iomgr\alarm_list_test.c">
<ClCompile Include="..\..\..\..\test\core\iomgr\timer_list_test.c">
<Filter>test\core\iomgr</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<Filter Include="test">
<UniqueIdentifier>{5599c85d-915e-7ef2-1b2c-061b82987e1d}</UniqueIdentifier>
<UniqueIdentifier>{ce536631-1d52-1c3c-8eed-efe2f4bae6ed}</UniqueIdentifier>
</Filter>
<Filter Include="test\core">
<UniqueIdentifier>{46744e86-73cb-67b0-cddb-72655b2ded40}</UniqueIdentifier>
<UniqueIdentifier>{b877a050-4172-3910-dede-77628e0ef150}</UniqueIdentifier>
</Filter>
<Filter Include="test\core\iomgr">
<UniqueIdentifier>{26291b48-8dd4-079f-bbfa-a07190367bd7}</UniqueIdentifier>
<UniqueIdentifier>{087dd179-d26d-8e56-707b-6059afbfd70a}</UniqueIdentifier>
</Filter>
</ItemGroup>
</Project>
Loading…
Cancel
Save