Author: Armin Rigo <[email protected]>
Branch: c7-full-profiling
Changeset: r1449:e51fea16a737
Date: 2014-10-04 15:46 +0200
http://bitbucket.org/pypy/stmgc/changeset/e51fea16a737/
Log: Kill test_timing now
diff --git a/c7/test/test_marker.py b/c7/test/test_marker.py
--- a/c7/test/test_marker.py
+++ b/c7/test/test_marker.py
@@ -8,8 +8,12 @@
seen = []
@ffi.callback("stmcb_timing_event_fn")
def timing_event(tl, event, markers):
- if event == kind:
- seen.append(tl)
+ if kind == "ALL":
+ seen.append(event)
+ elif event != kind:
+ return
+ seen.append(tl)
+ if markers:
seen.append(markers[0].tl)
seen.append(markers[0].segment_base)
seen.append(markers[0].odd_number)
@@ -18,6 +22,8 @@
seen.append(markers[1].segment_base)
seen.append(markers[1].odd_number)
seen.append(markers[1].object)
+ else:
+ seen.append(None)
lib.stmcb_timing_event = timing_event
self.timing_event_keepalive = timing_event
self.seen = seen
@@ -205,3 +211,23 @@
py.test.raises(Conflict, self.switch, 0)
#
self.check_recording(21, ffi.NULL, 0, ffi.NULL)
+
+ def test_all(self):
+ self.recording("ALL")
+ self.start_transaction()
+ self.commit_transaction()
+ self.start_transaction()
+ stm_major_collect()
+ self.abort_transaction()
+ assert self.seen == [
+ lib.STM_TRANSACTION_START, self.tls[0], None,
+ lib.STM_GC_MINOR_START, self.tls[0], None,
+ lib.STM_GC_MINOR_DONE, self.tls[0], None,
+ lib.STM_TRANSACTION_COMMIT, self.tls[0], None,
+ lib.STM_TRANSACTION_START, self.tls[0], None,
+ lib.STM_GC_MINOR_START, self.tls[0], None,
+ lib.STM_GC_MINOR_DONE, self.tls[0], None,
+ lib.STM_GC_MAJOR_START, self.tls[0], None,
+ lib.STM_GC_MAJOR_DONE, self.tls[0], None,
+ lib.STM_TRANSACTION_ABORT, self.tls[0], None,
+ ]
diff --git a/c7/test/test_timing.py b/c7/test/test_timing.py
deleted file mode 100644
--- a/c7/test/test_timing.py
+++ /dev/null
@@ -1,97 +0,0 @@
-from support import *
-import py, time
-
-
-class TestTiming(BaseTest):
-
- def gettimer(self, n):
- tl = self.tls[self.current_thread]
- lib.stm_flush_timing(tl, 1)
- return tl.events[n], tl.timing[n]
-
- def expect_timer(self, n, expected_time, expected_count='?'):
- count, real = self.gettimer(n)
- print 'timer %d is %d;%s, expecting %s;%s' % (n, count, real,
- expected_count, expected_time)
- if expected_time == 0.0:
- assert real == 0.0
- elif expected_time == "nonzero":
- assert real > 0.0
- else:
- assert abs(real - expected_time) < 0.09
- if expected_count != '?':
- assert count == expected_count
-
- def test_time_outside_transaction(self):
- time.sleep(0.2)
- self.start_transaction()
- self.commit_transaction()
- self.expect_timer(lib.STM_TIME_OUTSIDE_TRANSACTION, 0.2)
-
- def test_time_run_current(self):
- self.start_transaction()
- time.sleep(0.1)
- self.expect_timer(lib.STM_TIME_RUN_CURRENT, 0.1, 0)
- time.sleep(0.1)
- self.expect_timer(lib.STM_TIME_RUN_CURRENT, 0.2, 0)
- self.commit_transaction()
- self.expect_timer(lib.STM_TIME_RUN_CURRENT, 0.0, 1)
-
- def test_time_run_committed(self):
- self.start_transaction()
- time.sleep(0.2)
- self.expect_timer(lib.STM_TIME_RUN_COMMITTED, 0.0, 0)
- self.commit_transaction()
- self.expect_timer(lib.STM_TIME_RUN_COMMITTED, 0.2, 1)
-
- def test_time_run_aborted_write_write(self):
- o = stm_allocate_old(16)
- self.start_transaction()
- stm_write(o)
- #
- self.switch(1)
- self.start_transaction()
- time.sleep(0.2)
- py.test.raises(Conflict, stm_write, o)
- self.expect_timer(lib.STM_TIME_RUN_ABORTED_WRITE_WRITE, 0.2, 1)
-
- def test_time_run_aborted_write_read(self):
- o = stm_allocate_old(16)
- self.start_transaction()
- stm_read(o)
- #
- self.switch(1)
- self.start_transaction()
- time.sleep(0.2)
- stm_write(o)
- py.test.raises(Conflict, self.commit_transaction)
- self.expect_timer(lib.STM_TIME_RUN_ABORTED_WRITE_READ, 0.2, 1)
-
- def test_time_run_aborted_inevitable(self):
- self.start_transaction()
- self.become_inevitable()
- #
- self.switch(1)
- self.start_transaction()
- time.sleep(0.2)
- py.test.raises(Conflict, self.become_inevitable)
- self.expect_timer(lib.STM_TIME_RUN_ABORTED_INEVITABLE, 0.2, 1)
-
- def test_time_run_aborted_other(self):
- self.start_transaction()
- time.sleep(0.2)
- self.abort_transaction()
- self.expect_timer(lib.STM_TIME_RUN_ABORTED_OTHER, 0.2, 1)
-
- def test_time_minor_gc(self):
- self.start_transaction()
- self.expect_timer(lib.STM_TIME_MINOR_GC, 0.0, 0)
- stm_minor_collect()
- self.expect_timer(lib.STM_TIME_MINOR_GC, "nonzero", 1)
- self.expect_timer(lib.STM_TIME_MAJOR_GC, 0.0, 0)
-
- def test_time_major_gc(self):
- self.start_transaction()
- self.expect_timer(lib.STM_TIME_MAJOR_GC, 0.0, 0)
- stm_major_collect()
- self.expect_timer(lib.STM_TIME_MAJOR_GC, "nonzero", 1)
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit