aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorGravatar Yang Gao <yangg@google.com>2018-01-30 13:57:37 -0800
committerGravatar GitHub <noreply@github.com>2018-01-30 13:57:37 -0800
commit8d98bf2379c257fbd65b71a6707ef34ca4718da7 (patch)
treee10966529ee8f9ab1039e93bc9bbd94710a8f659 /src
parent680d2cba135a8cb20d99c0d650f40391d7328eb3 (diff)
parent041c3ede861112c572b932acc0858fd8754c56ec (diff)
Merge pull request #14237 from yang-g/epollex_timer_anno
Add timer trace annotations to epollex
Diffstat (limited to 'src')
-rw-r--r--src/core/lib/iomgr/ev_epollex_linux.cc17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/core/lib/iomgr/ev_epollex_linux.cc b/src/core/lib/iomgr/ev_epollex_linux.cc
index 5412358ab8..982612f402 100644
--- a/src/core/lib/iomgr/ev_epollex_linux.cc
+++ b/src/core/lib/iomgr/ev_epollex_linux.cc
@@ -561,6 +561,7 @@ static void pollset_maybe_finish_shutdown(grpc_pollset* pollset) {
}
if (pollset->shutdown_closure != nullptr && pollset->root_worker == nullptr &&
pollset->containing_pollset_set_count == 0) {
+ GPR_TIMER_MARK("pollset_finish_shutdown", 0);
GRPC_CLOSURE_SCHED(pollset->shutdown_closure, GRPC_ERROR_NONE);
pollset->shutdown_closure = nullptr;
pollset->already_shutdown = true;
@@ -571,6 +572,7 @@ static void pollset_maybe_finish_shutdown(grpc_pollset* pollset) {
* pollset->active_pollable->mu & specific_worker->pollable_obj->mu must not be
* held */
static grpc_error* kick_one_worker(grpc_pollset_worker* specific_worker) {
+ GPR_TIMER_SCOPE("kick_one_worker", 0);
pollable* p = specific_worker->pollable_obj;
grpc_core::mu_guard lock(&p->mu);
GPR_ASSERT(specific_worker != nullptr);
@@ -614,6 +616,7 @@ static grpc_error* kick_one_worker(grpc_pollset_worker* specific_worker) {
static grpc_error* pollset_kick(grpc_pollset* pollset,
grpc_pollset_worker* specific_worker) {
+ GPR_TIMER_SCOPE("pollset_kick", 0);
GRPC_STATS_INC_POLLSET_KICK();
if (grpc_polling_trace.enabled()) {
gpr_log(GPR_DEBUG,
@@ -663,6 +666,7 @@ static grpc_error* pollset_kick(grpc_pollset* pollset,
}
static grpc_error* pollset_kick_all(grpc_pollset* pollset) {
+ GPR_TIMER_SCOPE("pollset_kick_all", 0);
grpc_error* error = GRPC_ERROR_NONE;
const char* err_desc = "pollset_kick_all";
grpc_pollset_worker* w = pollset->root_worker;
@@ -740,6 +744,7 @@ static grpc_error* fd_get_or_become_pollable(grpc_fd* fd, pollable** p) {
/* pollset->po.mu lock must be held by the caller before calling this */
static void pollset_shutdown(grpc_pollset* pollset, grpc_closure* closure) {
+ GPR_TIMER_SCOPE("pollset_shutdown", 0);
GPR_ASSERT(pollset->shutdown_closure == nullptr);
pollset->shutdown_closure = closure;
GRPC_LOG_IF_ERROR("pollset_shutdown", pollset_kick_all(pollset));
@@ -748,6 +753,7 @@ static void pollset_shutdown(grpc_pollset* pollset, grpc_closure* closure) {
static grpc_error* pollable_process_events(grpc_pollset* pollset,
pollable* pollable_obj, bool drain) {
+ GPR_TIMER_SCOPE("pollable_process_events", 0);
static const char* err_desc = "pollset_process_events";
grpc_error* error = GRPC_ERROR_NONE;
for (int i = 0; (drain || i < MAX_EPOLL_EVENTS_HANDLED_EACH_POLL_CALL) &&
@@ -794,6 +800,7 @@ static void pollset_destroy(grpc_pollset* pollset) {
}
static grpc_error* pollable_epoll(pollable* p, grpc_millis deadline) {
+ GPR_TIMER_SCOPE("pollable_epoll", 0);
int timeout = poll_deadline_to_millis_timeout(deadline);
if (grpc_polling_trace.enabled()) {
@@ -869,6 +876,7 @@ static worker_remove_result worker_remove(grpc_pollset_worker** root_worker,
static bool begin_worker(grpc_pollset* pollset, grpc_pollset_worker* worker,
grpc_pollset_worker** worker_hdl,
grpc_millis deadline) {
+ GPR_TIMER_SCOPE("begin_worker", 0);
bool do_poll =
(pollset->shutdown_closure == nullptr && !pollset->already_shutdown);
if (worker_hdl != nullptr) *worker_hdl = worker;
@@ -921,6 +929,7 @@ static bool begin_worker(grpc_pollset* pollset, grpc_pollset_worker* worker,
static void end_worker(grpc_pollset* pollset, grpc_pollset_worker* worker,
grpc_pollset_worker** worker_hdl) {
+ GPR_TIMER_SCOPE("end_worker", 0);
gpr_mu_lock(&pollset->mu);
gpr_mu_lock(&worker->pollable_obj->mu);
switch (worker_remove(&worker->pollable_obj->root_worker, worker,
@@ -963,6 +972,7 @@ static long gettid(void) { return syscall(__NR_gettid); }
static grpc_error* pollset_work(grpc_pollset* pollset,
grpc_pollset_worker** worker_hdl,
grpc_millis deadline) {
+ GPR_TIMER_SCOPE("pollset_work", 0);
#ifdef GRPC_EPOLLEX_CREATE_WORKERS_ON_HEAP
grpc_pollset_worker* worker =
(grpc_pollset_worker*)gpr_malloc(sizeof(*worker));
@@ -1128,6 +1138,7 @@ static grpc_error* pollset_as_multipollable_locked(grpc_pollset* pollset,
}
static void pollset_add_fd(grpc_pollset* pollset, grpc_fd* fd) {
+ GPR_TIMER_SCOPE("pollset_add_fd", 0);
gpr_mu_lock(&pollset->mu);
grpc_error* error = pollset_add_fd_locked(pollset, fd);
gpr_mu_unlock(&pollset->mu);
@@ -1176,6 +1187,7 @@ static void pollset_set_unref(grpc_pollset_set* pss) {
}
static void pollset_set_add_fd(grpc_pollset_set* pss, grpc_fd* fd) {
+ GPR_TIMER_SCOPE("pollset_set_add_fd", 0);
if (grpc_polling_trace.enabled()) {
gpr_log(GPR_DEBUG, "PSS:%p: add fd %p (%d)", pss, fd, fd->fd);
}
@@ -1199,6 +1211,7 @@ static void pollset_set_add_fd(grpc_pollset_set* pss, grpc_fd* fd) {
}
static void pollset_set_del_fd(grpc_pollset_set* pss, grpc_fd* fd) {
+ GPR_TIMER_SCOPE("pollset_set_del_fd", 0);
if (grpc_polling_trace.enabled()) {
gpr_log(GPR_DEBUG, "PSS:%p: del fd %p", pss, fd);
}
@@ -1219,6 +1232,7 @@ static void pollset_set_del_fd(grpc_pollset_set* pss, grpc_fd* fd) {
}
static void pollset_set_del_pollset(grpc_pollset_set* pss, grpc_pollset* ps) {
+ GPR_TIMER_SCOPE("pollset_set_del_pollset", 0);
if (grpc_polling_trace.enabled()) {
gpr_log(GPR_DEBUG, "PSS:%p: del pollset %p", pss, ps);
}
@@ -1249,6 +1263,7 @@ static grpc_error* add_fds_to_pollsets(grpc_fd** fds, size_t fd_count,
size_t pollset_count,
const char* err_desc, grpc_fd** out_fds,
size_t* out_fd_count) {
+ GPR_TIMER_SCOPE("add_fds_to_pollsets", 0);
grpc_error* error = GRPC_ERROR_NONE;
for (size_t i = 0; i < fd_count; i++) {
gpr_mu_lock(&fds[i]->orphan_mu);
@@ -1269,6 +1284,7 @@ static grpc_error* add_fds_to_pollsets(grpc_fd** fds, size_t fd_count,
}
static void pollset_set_add_pollset(grpc_pollset_set* pss, grpc_pollset* ps) {
+ GPR_TIMER_SCOPE("pollset_set_add_pollset", 0);
if (grpc_polling_trace.enabled()) {
gpr_log(GPR_DEBUG, "PSS:%p: add pollset %p", pss, ps);
}
@@ -1305,6 +1321,7 @@ static void pollset_set_add_pollset(grpc_pollset_set* pss, grpc_pollset* ps) {
static void pollset_set_add_pollset_set(grpc_pollset_set* a,
grpc_pollset_set* b) {
+ GPR_TIMER_SCOPE("pollset_set_add_pollset_set", 0);
if (grpc_polling_trace.enabled()) {
gpr_log(GPR_DEBUG, "PSS: merge (%p, %p)", a, b);
}