Author: Tobias Weber <tobias_webe...@gmx.de> Branch: c8-binary-trx-length-per-thread Changeset: r2146:bcf327fad4ce Date: 2017-08-04 11:42 +0200 http://bitbucket.org/pypy/stmgc/changeset/bcf327fad4ce/
Log: Merge instrumentation updates diff --git a/c8/stm/core.c b/c8/stm/core.c --- a/c8/stm/core.c +++ b/c8/stm/core.c @@ -469,8 +469,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 */ } @@ -560,14 +560,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 ############# */ @@ -1328,7 +1327,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(); @@ -1653,9 +1654,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 @@ -759,16 +759,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) { @@ -803,7 +808,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 { @@ -813,6 +820,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 @@ -8,6 +8,8 @@ #define start_timer() struct timespec start, stop; \ struct timespec duration = { .tv_sec = 0, .tv_nsec = 0 };\ uint32_t nanosec_diff, sec_diff; \ + stm_timing_event_payload_data_t stm_duration_data; \ + stm_timing_event_payload_t stm_duration_payload; \ continue_timer() /* Must use start_timer before using this macro. */ @@ -27,11 +29,12 @@ #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) }; \ - stm_timing_event_payload_t stm_duration_payload = \ - { STM_EVENT_PAYLOAD_DURATION, stm_duration_data }; + stm_duration_data.duration = &(duration_data); \ + stm_duration_payload.type = STM_EVENT_PAYLOAD_DURATION; \ + stm_duration_payload.data = stm_duration_data; #define publish_event(thread_local, event) \ (timing_enabled() ? \ @@ -42,7 +45,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)) diff --git a/c8/stmgc.h b/c8/stmgc.h --- a/c8/stmgc.h +++ b/c8/stmgc.h @@ -9,7 +9,6 @@ #include <stddef.h> #include <stdint.h> -#include <stdbool.h> #include <assert.h> #include <limits.h> #include <unistd.h> @@ -581,6 +580,8 @@ STM_GC_MAJOR_DONE, /* execution duration profiling events */ + STM_WARMUP_COMPLETE, + STM_DURATION_START_TRX, STM_DURATION_WRITE_GC_ONLY, STM_DURATION_WRITE_SLOWPATH, @@ -611,6 +612,7 @@ "gc major start", \ "gc major done", \ /* names of duration events */ \ + "marks completion of benchmark warm up phase" \ "duration of transaction start", \ "duration of gc due to write", \ "duration of write slowpath", \ _______________________________________________ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit