Author: Tobias Weber <tobias_webe...@gmx.de> Branch: c8-tcp-style-trx-length Changeset: r2115:47ae8bbc2b7e Date: 2017-07-14 18:01 +0200 http://bitbucket.org/pypy/stmgc/changeset/47ae8bbc2b7e/
Log: Merge latest instrumentation fixes 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 ############# */ @@ -1327,7 +1326,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(); @@ -1656,9 +1657,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/nursery.c b/c8/stm/nursery.c --- a/c8/stm/nursery.c +++ b/c8/stm/nursery.c @@ -781,16 +781,21 @@ static void major_do_validation_and_minor_collections(void) { + start_timer(); + int original_num = STM_SEGMENT->segment_num; long i; assert(_has_mutex()); /* including the sharing seg0 */ - for (i = 0; i < NB_SEGMENTS; i++) { + for (i = 0; i < NB_SEGMENTS; i++) { // TODO why is this strictly smaller than? ensure_gs_register(i); + pause_timer(); bool ok = _stm_validate(); + continue_timer(); + assert(get_priv_segment(i)->last_commit_log_entry->next == NULL || get_priv_segment(i)->last_commit_log_entry->next == INEV_RUNNING); if (!ok) { @@ -825,7 +830,9 @@ Collecting might fail due to invalid state. */ if (!must_abort()) { + pause_timer(); _do_minor_collection(/*commit=*/ false); + continue_timer(); assert(MINOR_NOTHING_TO_DO(STM_PSEGMENT)); } else { @@ -835,6 +842,8 @@ } ensure_gs_register(original_num); + + stop_timer_and_publish(STM_DURATION_MAJOR_GC_FULL); } 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