Author: Armin Rigo <[email protected]>
Branch:
Changeset: r1122:976a1d42a508
Date: 2014-03-30 21:13 +0200
http://bitbucket.org/pypy/stmgc/changeset/976a1d42a508/
Log: Add a 'verbose' argument to stm_flush_timing()
diff --git a/c7/demo/demo2.c b/c7/demo/demo2.c
--- a/c7/demo/demo2.c
+++ b/c7/demo/demo2.c
@@ -186,13 +186,7 @@
void unregister_thread_local(void)
{
- int i;
- stm_flush_timing(&stm_thread_local);
- for (i = 0; i < _STM_TIME_N; i++) {
- fprintf(stderr, "timer %2d: %.6f\n", i,
- (double)stm_thread_local.timing[i]);
- }
-
+ stm_flush_timing(&stm_thread_local, 1);
stm_unregister_thread_local(&stm_thread_local);
}
diff --git a/c7/stm/timing.c b/c7/stm/timing.c
--- a/c7/stm/timing.c
+++ b/c7/stm/timing.c
@@ -38,7 +38,37 @@
tl->timing[STM_TIME_RUN_CURRENT] = 0.0f;
}
-void stm_flush_timing(stm_thread_local_t *tl)
+static const char *timer_names[] = {
+ "outside transaction",
+ "run current",
+ "run committed",
+ "run aborted write write",
+ "run aborted write read",
+ "run aborted inevitable",
+ "run aborted other",
+ "wait free segment",
+ "wait write read",
+ "wait inevitable",
+ "wait other",
+ "bookkeeping",
+ "minor gc",
+ "major gc",
+ "sync pause",
+};
+
+void stm_flush_timing(stm_thread_local_t *tl, int verbose)
{
TIMING_CHANGE(tl, tl->_timing_cur_state);
+
+ assert((sizeof(timer_names) / sizeof(timer_names[0])) == _STM_TIME_N);
+ if (verbose > 0) {
+ int i;
+ s_mutex_lock();
+ fprintf(stderr, "thread %p:\n", tl);
+ for (i = 0; i < _STM_TIME_N; i++) {
+ fprintf(stderr, " %-24s %.3f s\n",
+ timer_names[i], (double)tl->timing[i]);
+ }
+ s_mutex_unlock();
+ }
}
diff --git a/c7/stmgc.h b/c7/stmgc.h
--- a/c7/stmgc.h
+++ b/c7/stmgc.h
@@ -360,7 +360,7 @@
/* Temporary? */
-void stm_flush_timing(stm_thread_local_t *);
+void stm_flush_timing(stm_thread_local_t *tl, int verbose);
/* ==================== END ==================== */
diff --git a/c7/test/support.py b/c7/test/support.py
--- a/c7/test/support.py
+++ b/c7/test/support.py
@@ -116,7 +116,7 @@
#define STM_TIME_MAJOR_GC ...
#define STM_TIME_SYNC_PAUSE ...
-void stm_flush_timing(stm_thread_local_t *);
+void stm_flush_timing(stm_thread_local_t *, int);
""")
diff --git a/c7/test/test_timing.py b/c7/test/test_timing.py
--- a/c7/test/test_timing.py
+++ b/c7/test/test_timing.py
@@ -6,7 +6,7 @@
def gettimer(self, n):
tl = self.tls[self.current_thread]
- lib.stm_flush_timing(tl)
+ lib.stm_flush_timing(tl, 1)
return tl.timing[n]
def expect_timer(self, n, expected_value):
diff --git a/duhton/transaction.c b/duhton/transaction.c
--- a/duhton/transaction.c
+++ b/duhton/transaction.c
@@ -186,6 +186,7 @@
}
+ stm_flush_timing(&stm_thread_local, 1);
stm_unregister_thread_local(&stm_thread_local);
return NULL;
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit