Author: Armin Rigo <[email protected]>
Branch: marker
Changeset: r1191:4bde66e3b621
Date: 2014-04-28 18:36 +0200
http://bitbucket.org/pypy/stmgc/changeset/4bde66e3b621/
Log: Report markers for forced pauses. Seems to work but hard to test
for now...
diff --git a/c7/demo/demo2.c b/c7/demo/demo2.c
--- a/c7/demo/demo2.c
+++ b/c7/demo/demo2.c
@@ -51,7 +51,7 @@
char *outputbuf, size_t outputbufsize)
{
assert(following_object == NULL);
- snprintf(outputbuf, outputbufsize, "<%lu>", odd_number);
+ snprintf(outputbuf, outputbufsize, "<%p %lu>", base, odd_number);
}
@@ -98,6 +98,18 @@
STM_START_TRANSACTION(&stm_thread_local, here);
+ if (stm_thread_local.longest_marker_state != 0) {
+ fprintf(stderr, "[%p] marker %d for %.6f seconds:\n",
+ &stm_thread_local,
+ stm_thread_local.longest_marker_state,
+ stm_thread_local.longest_marker_time);
+ fprintf(stderr, "\tself:\t\"%s\"\n\tother:\t\"%s\"\n",
+ stm_thread_local.longest_marker_self,
+ stm_thread_local.longest_marker_other);
+ stm_thread_local.longest_marker_state = 0;
+ stm_thread_local.longest_marker_time = 0.0;
+ }
+
nodeptr_t prev = initial;
stm_read((objptr_t)prev);
diff --git a/c7/stm/contention.c b/c7/stm/contention.c
--- a/c7/stm/contention.c
+++ b/c7/stm/contention.c
@@ -162,6 +162,7 @@
itself already paused here.
*/
contmgr.other_pseg->signal_when_done = true;
+ marker_contention(kind, false, other_segment_num, obj);
change_timing_state(wait_category);
@@ -178,7 +179,13 @@
if (must_abort())
abort_with_mutex();
- change_timing_state(STM_TIME_RUN_CURRENT);
+ struct stm_priv_segment_info_s *pseg =
+ get_priv_segment(STM_SEGMENT->segment_num);
+ double elapsed =
+ change_timing_state_tl(pseg->pub.running_thread,
+ STM_TIME_RUN_CURRENT);
+ marker_copy(pseg->pub.running_thread, pseg,
+ wait_category, elapsed);
}
else if (!contmgr.abort_other) {
@@ -187,7 +194,7 @@
dprintf(("abort in contention\n"));
STM_SEGMENT->nursery_end = abort_category;
- marker_contention(abort_category, false, other_segment_num, obj);
+ marker_contention(kind, false, other_segment_num, obj);
abort_with_mutex();
}
@@ -195,7 +202,7 @@
/* We have to signal the other thread to abort, and wait until
it does. */
contmgr.other_pseg->pub.nursery_end = abort_category;
- marker_contention(abort_category, true, other_segment_num, obj);
+ marker_contention(kind, true, other_segment_num, obj);
int sp = contmgr.other_pseg->safe_point;
switch (sp) {
diff --git a/c7/stm/marker.c b/c7/stm/marker.c
--- a/c7/stm/marker.c
+++ b/c7/stm/marker.c
@@ -134,7 +134,7 @@
marker[1] = 0;
}
-static void marker_contention(int category, bool abort_other,
+static void marker_contention(int kind, bool abort_other,
uint8_t other_segment_num, object_t *obj)
{
uintptr_t self_marker[2];
@@ -152,7 +152,7 @@
/* Collect the location for myself. It's usually the current
location, except in a write-read abort, in which case it's the
older location of the write. */
- if (category == STM_TIME_RUN_ABORTED_WRITE_READ)
+ if (kind == WRITE_READ_CONTENTION)
marker_fetch_obj_write(my_pseg->pub.segment_num, obj, self_marker);
else
marker_fetch(my_pseg->pub.running_thread, self_marker);
@@ -165,11 +165,11 @@
/* For some categories, we can also collect the relevant information
for the other segment. */
- switch (category) {
- case STM_TIME_RUN_ABORTED_WRITE_WRITE:
+ switch (kind) {
+ case WRITE_WRITE_CONTENTION:
marker_fetch_obj_write(other_segment_num, obj, other_marker);
break;
- case STM_TIME_RUN_ABORTED_INEVITABLE:
+ case INEVITABLE_CONTENTION:
assert(abort_other == false);
other_marker[0] = other_pseg->marker_inev[0];
other_marker[1] = other_pseg->marker_inev[1];
@@ -185,7 +185,7 @@
: my_pseg->marker_other);
if (abort_other && other_pseg->marker_self[0] == 0) {
- if (category == STM_TIME_RUN_ABORTED_WRITE_READ)
+ if (kind == WRITE_READ_CONTENTION)
strcpy(other_pseg->marker_self, "<read at unknown location>");
else
strcpy(other_pseg->marker_self, "<no location information>");
diff --git a/c7/stm/marker.h b/c7/stm/marker.h
--- a/c7/stm/marker.h
+++ b/c7/stm/marker.h
@@ -8,5 +8,5 @@
struct stm_priv_segment_info_s *pseg,
enum stm_time_e attribute_to, double time);
-static void marker_contention(int category, bool abort_other,
+static void marker_contention(int kind, bool abort_other,
uint8_t other_segment_num, object_t *obj);
diff --git a/c7/stm/timing.c b/c7/stm/timing.c
--- a/c7/stm/timing.c
+++ b/c7/stm/timing.c
@@ -25,10 +25,11 @@
return oldstate;
}
-static void change_timing_state_tl(stm_thread_local_t *tl,
- enum stm_time_e newstate)
+static double change_timing_state_tl(stm_thread_local_t *tl,
+ enum stm_time_e newstate)
{
TIMING_CHANGE(tl, newstate);
+ return elasped;
}
static void timing_end_transaction(enum stm_time_e attribute_to)
diff --git a/c7/stm/timing.h b/c7/stm/timing.h
--- a/c7/stm/timing.h
+++ b/c7/stm/timing.h
@@ -8,7 +8,7 @@
}
static enum stm_time_e change_timing_state(enum stm_time_e newstate);
-static void change_timing_state_tl(stm_thread_local_t *tl,
- enum stm_time_e newstate);
+static double change_timing_state_tl(stm_thread_local_t *tl,
+ enum stm_time_e newstate);
static void timing_end_transaction(enum stm_time_e attribute_to);
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit