diff options
author | Eugene Tarassov | 2018-02-27 20:54:36 +0000 |
---|---|---|
committer | Eugene Tarassov | 2018-02-27 20:54:36 +0000 |
commit | 7802f84dfae9b827ce5e73b3cc7a297002b5beb1 (patch) | |
tree | 31c5be187b90d2877521695475d992361346f1dc | |
parent | 45d57103fe4c344b95d39bf8615b5f6bad138027 (diff) | |
download | org.eclipse.tcf.agent-7802f84dfae9b827ce5e73b3cc7a297002b5beb1.tar.gz org.eclipse.tcf.agent-7802f84dfae9b827ce5e73b3cc7a297002b5beb1.tar.xz org.eclipse.tcf.agent-7802f84dfae9b827ce5e73b3cc7a297002b5beb1.zip |
TCF Agent: RunControl service: performance optimizations in implementation of "safe events"
-rw-r--r-- | agent/tcf/services/runctrl.c | 45 |
1 files changed, 23 insertions, 22 deletions
diff --git a/agent/tcf/services/runctrl.c b/agent/tcf/services/runctrl.c index 573c4793..fa9a4035 100644 --- a/agent/tcf/services/runctrl.c +++ b/agent/tcf/services/runctrl.c @@ -82,6 +82,7 @@ typedef struct ContextExtensionRC { int step_repeat_cnt; int step_into_hidden; int stop_group_mark; + Context * stop_group_ctx; int run_ctrl_ctx_lock_cnt; ContextAddress step_range_start; ContextAddress step_range_end; @@ -2398,21 +2399,6 @@ static void sync_run_state_event(void * args) { cache_enter(sync_run_state_cache_client, NULL, NULL, 0); } -static void mark_stop_groups(void) { - LINK * l = context_root.next; - SafeEvent * e = safe_event_list; - while (l != &context_root) { - Context * grp = context_get_group(ctxl2ctxp(l), CONTEXT_GROUP_STOP); - EXT(grp)->stop_group_mark = 0; - l = l->next; - } - while (e != NULL) { - Context * grp = context_get_group(e->ctx, CONTEXT_GROUP_STOP); - EXT(grp)->stop_group_mark = 1; - e = e->next; - } -} - static void mark_cannot_stop(Context * ctx, const char * err_msg) { ContextExtensionRC * ext = EXT(ctx); const char * name = ctx->name; @@ -2425,6 +2411,7 @@ static void mark_cannot_stop(Context * ctx, const char * err_msg) { static void run_safe_events(void * arg) { LINK * l; + SafeEvent * i; run_safe_events_posted--; if (run_safe_events_posted > 0) return; @@ -2437,18 +2424,31 @@ static void run_safe_events(void * arg) { if (safe_event_list == NULL) return; - mark_stop_groups(); safe_event_pid_count = 0; - + l = context_root.next; + while (l != &context_root) { + Context * ctx = ctxl2ctxp(l); + ContextExtensionRC * ext = EXT(ctx); + ext->stop_group_ctx = context_get_group(ctx, CONTEXT_GROUP_STOP); + ext->stop_group_mark = 0; + l = l->next; + } + i = safe_event_list; + while (i != NULL) { + Context * grp = EXT(i->ctx)->stop_group_ctx; + EXT(grp)->stop_group_mark = 1; + i = i->next; + } l = context_root.next; while (l != &context_root) { Context * ctx = ctxl2ctxp(l); ContextExtensionRC * ext = EXT(ctx); l = l->next; ext->pending_safe_event = 0; + ext->stop_group_mark = EXT(ext->stop_group_ctx)->stop_group_mark; if (ctx->exited || ctx->exiting || ext->cannot_stop) continue; + if (!ext->safe_single_step && !ext->stop_group_mark) continue; if (ctx->stopped || !context_has_state(ctx)) continue; - if (!ext->safe_single_step && !EXT(context_get_group(ctx, CONTEXT_GROUP_STOP))->stop_group_mark) continue; if (stop_all_timer_cnt >= STOP_ALL_MAX_CNT) { mark_cannot_stop(ctx, "timeout"); continue; @@ -2484,8 +2484,8 @@ static void run_safe_events(void * arg) { while (safe_event_list) { Trap trap; - SafeEvent * i = safe_event_list; - if (!EXT(context_get_group(i->ctx, CONTEXT_GROUP_STOP))->stop_group_mark) { + i = safe_event_list; + if (!EXT(i->ctx)->stop_group_mark) { assert(run_ctrl_lock_cnt > 0); if (run_safe_events_posted == 0) { run_safe_events_posted++; @@ -2698,8 +2698,9 @@ void rem_run_control_event_listener(RunControlEventListener * listener) { static void stop_if_safe_events(Context * ctx) { ContextExtensionRC * ext = EXT(ctx); - assert(run_ctrl_lock_cnt == 0 || !ext->safe_single_step || safe_event_list != NULL); - if (run_ctrl_lock_cnt && !ctx->exiting && !ctx->stopped && context_has_state(ctx)) { + if (safe_event_active && EXT(ctx)->stop_group_mark && + !ctx->exiting && !ctx->stopped && context_has_state(ctx)) { + assert(run_ctrl_lock_cnt > 0); if (!ext->safe_single_step) { context_stop(ctx); } |