Author: Tobias Weber <tobias_webe...@gmx.de> Branch: c8-overheads-instrumentation Changeset: r2111:364f9fb71d3e Date: 2017-07-14 17:43 +0200 http://bitbucket.org/pypy/stmgc/changeset/364f9fb71d3e/
Log: Fix some timings that could be lost when aborting by publishing and resetting timer eagerly diff --git a/c8/stm/core.c b/c8/stm/core.c --- a/c8/stm/core.c +++ b/c8/stm/core.c @@ -468,8 +468,8 @@ #endif if (STM_PSEGMENT->last_commit_log_entry->next == INEV_RUNNING) { - pause_timer(); - wait_for_inevitable(); // TODO may abort!! timing event lost + stop_timer_and_publish(STM_DURATION_VALIDATION); + wait_for_inevitable(); continue_timer(); goto retry_from_start; /* redo _stm_validate() now */ } @@ -559,14 +559,13 @@ OPT_ASSERT(yes); release_modification_lock_wr(STM_SEGMENT->segment_num); + + stop_timer_and_publish(STM_DURATION_VALIDATION); } else { - pause_timer(); + stop_timer_and_publish(STM_DURATION_VALIDATION); _validate_and_attach(new); - continue_timer(); } - - stop_timer_and_publish(STM_DURATION_VALIDATION); } /* ############# STM ############# */ @@ -1330,7 +1329,9 @@ if there is an inevitable tx running) */ bool was_inev = STM_PSEGMENT->transaction_state == TS_INEVITABLE; - pause_timer(); + // publish here because the validation may abort + stop_timer_and_publish_for_thread( + thread_local_for_logging, STM_DURATION_COMMIT_EXCEPT_GC); _validate_and_add_to_commit_log(); continue_timer(); @@ -1671,9 +1672,9 @@ signal_commit_to_inevitable_transaction(); s_mutex_lock(); - if (any_soon_finished_or_inevitable_thread_segment() && - !safe_point_requested() && - num_waits <= NB_SEGMENTS) { + if (any_soon_finished_or_inevitable_thread_segment() + && !safe_point_requested() + && num_waits <= NB_SEGMENTS) { /* wait until C_SEGMENT_FREE_OR_SAFE_POINT_REQ is signalled */ EMIT_WAIT(STM_WAIT_OTHER_INEVITABLE); diff --git a/c8/stm/timing.h b/c8/stm/timing.h --- a/c8/stm/timing.h +++ b/c8/stm/timing.h @@ -27,6 +27,8 @@ #define pause_timer() clock_gettime(CLOCK_MONOTONIC_RAW, &stop); \ get_duration() +#define reset_timer() duration.tv_sec = 0; duration.tv_nsec = 0; + #define stm_duration_payload(duration_data) \ stm_timing_event_payload_data_t stm_duration_data = \ { .duration = &(duration_data) }; \ @@ -42,7 +44,8 @@ pause_timer() \ stm_duration_payload(duration) \ assert((thread_local) != NULL); \ - publish_event((thread_local), (event)) + publish_event((thread_local), (event)) \ + reset_timer() #define stop_timer_and_publish(event) \ stop_timer_and_publish_for_thread(STM_SEGMENT->running_thread, (event)) _______________________________________________ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit