Author: Tobias Weber <[email protected]>
Branch: c8-overheads-instrumentation
Changeset: r2031:a73dbda25da5
Date: 2017-03-14 21:25 +0100
http://bitbucket.org/pypy/stmgc/changeset/a73dbda25da5/
Log: Fix missing duration measurement of inevitable transactions'
validation and initialization of duration struct
diff --git a/c8/stm/core.c b/c8/stm/core.c
--- a/c8/stm/core.c
+++ b/c8/stm/core.c
@@ -156,10 +156,10 @@
static bool _stm_validate(void)
{
+ /* returns true if we reached a valid state, or false if
+ we need to abort now */
start_timer();
- /* returns true if we reached a valid state, or false if
- we need to abort now */
dprintf(("_stm_validate() at cl=%p, rev=%lu\n",
STM_PSEGMENT->last_commit_log_entry,
STM_PSEGMENT->last_commit_log_entry->rev_num));
/* go from last known entry in commit log to the
@@ -173,6 +173,8 @@
if (STM_PSEGMENT->transaction_state == TS_INEVITABLE) {
assert(first_cl->next == INEV_RUNNING);
+
+ stop_timer_and_publish(STM_DURATION_VALIDATION);
return true;
}
diff --git a/c8/stm/timing.h b/c8/stm/timing.h
--- a/c8/stm/timing.h
+++ b/c8/stm/timing.h
@@ -5,30 +5,31 @@
/* Use raw monotonic time, i.e., solely based on local hardware (no NTP
adjustments) as in prof.c to obtain values comparable with total program
runtime. */
-#define start_timer() struct timespec start, stop, duration = { 0, 0 }; \
+#define start_timer() struct timespec start, stop;
\
+ struct timespec duration = { .tv_sec = 0, .tv_nsec = 0
};\
continue_timer()
/* Must use start_timer before using this macro. */
-#define get_duration() duration.tv_sec = \
- stop.tv_sec - start.tv_sec + duration.tv_sec; \
- duration.tv_nsec = \
+#define get_duration() duration.tv_sec = \
+ stop.tv_sec - start.tv_sec + duration.tv_sec; \
+ duration.tv_nsec = \
stop.tv_nsec - start.tv_nsec + duration.tv_nsec;
-#define pause_timer() clock_gettime(CLOCK_MONOTONIC_RAW, &stop); \
+#define pause_timer() clock_gettime(CLOCK_MONOTONIC_RAW, &stop); \
get_duration()
-#define stm_duration_payload(duration) \
- stm_timing_event_payload_data_t stm_duration_data = \
- { .duration = &duration }; \
- stm_timing_event_payload_t stm_duration_payload = \
+#define stm_duration_payload(duration) \
+ stm_timing_event_payload_data_t stm_duration_data = \
+ { .duration = &duration }; \
+ stm_timing_event_payload_t stm_duration_payload = \
{ STM_EVENT_PAYLOAD_DURATION, stm_duration_data };
-#define publish_event(event) \
- (timing_enabled() ? \
- stmcb_timing_event( \
- STM_SEGMENT->running_thread, event, &stm_duration_payload) : \
+#define publish_event(event) \
+ (timing_enabled() ? \
+ stmcb_timing_event( \
+ STM_SEGMENT->running_thread, event, &stm_duration_payload) : \
(void)0);
-#define stop_timer_and_publish(event) pause_timer() \
- stm_duration_payload(duration) \
+#define stop_timer_and_publish(event) pause_timer() \
+ stm_duration_payload(duration) \
publish_event(event)
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit