Author: Tobias Weber <tobias_webe...@gmx.de> Branch: c8-adaptive-trx-length-per-thread Changeset: r2066:e425b6d2a050 Date: 2017-06-09 18:09 +0200 http://bitbucket.org/pypy/stmgc/changeset/e425b6d2a050/
Log: Fix nested measurements of wait time during transaction start diff --git a/c8/stm/core.c b/c8/stm/core.c --- a/c8/stm/core.c +++ b/c8/stm/core.c @@ -1073,14 +1073,15 @@ static void _do_start_transaction(stm_thread_local_t *tl) { - start_timer(); - assert(!_stm_in_transaction(tl)); tl->wait_event_emitted = 0; acquire_thread_segment(tl); /* GS invalid before this point! */ + // acquiring segment is measured as wait time + start_timer(); + assert(STM_PSEGMENT->safe_point == SP_NO_TRANSACTION); assert(STM_PSEGMENT->transaction_state == TS_NONE); timing_event(tl, STM_TRANSACTION_START); @@ -1127,10 +1128,12 @@ rv++; /* incr it but enter_safe_point_if_requested() aborted */ STM_SEGMENT->transaction_read_version = rv; + pause_timer(); /* Warning: this safe-point may run light finalizers and register commit/abort callbacks if a major GC is triggered here */ enter_safe_point_if_requested(); dprintf(("> start_transaction\n")); + continue_timer(); s_mutex_unlock(); // XXX it's probably possible to not acquire this here @@ -1149,6 +1152,8 @@ long _stm_start_transaction(stm_thread_local_t *tl) { + start_timer(); + s_mutex_lock(); #ifdef STM_NO_AUTOMATIC_SETJMP long repeat_count = did_abort; /* test/support.py */ @@ -1162,10 +1167,17 @@ memcpy(tl->mem_reset_on_abort, tl->mem_stored_for_reset_on_abort, tl->mem_bytes_to_reset_on_abort); } + + // _do_start_transaction is instrumented as well and pauses for waits + pause_timer(); _do_start_transaction(tl); + continue_timer(); STM_SEGMENT->nursery_mark = ((stm_char *)_stm_nursery_start + stm_get_transaction_length(tl)); + + stop_timer_and_publish(STM_DURATION_START_TRX); + return repeat_count; } _______________________________________________ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit