[pypy-commit] stmgc default: - use CLOCK_MONOTONIC_RAW instead of CLOCK_MONOTONIC, because the latter is not

arigo noreply at buildbot.pypy.org
Wed Jun 24 18:46:09 CEST 2015


Author: Armin Rigo <arigo at tunes.org>
Branch: 
Changeset: r1884:9f966d34d3be
Date: 2015-06-24 18:45 +0200
http://bitbucket.org/pypy/stmgc/changeset/9f966d34d3be/

Log:	- use CLOCK_MONOTONIC_RAW instead of CLOCK_MONOTONIC, because the
	latter is not monotonic... (thanks cfbolz)

	- don't fclose the log file after a fork(): it still seems to create
	some corruption

diff --git a/c8/stm/prof.c b/c8/stm/prof.c
--- a/c8/stm/prof.c
+++ b/c8/stm/prof.c
@@ -42,10 +42,10 @@
         return;
     flockfile(f);
 
-    /* We expect the following CLOCK_MONOTONIC to be really monotonic:
+    /* We expect the following CLOCK_MONOTONIC_RAW to be really monotonic:
        it should guarantee that the file will be perfectly ordered by time.
        That's why we do it inside flockfile()/funlockfile(). */
-    clock_gettime(CLOCK_MONOTONIC, &t);
+    clock_gettime(CLOCK_MONOTONIC_RAW, &t);
     buf.tv_sec = t.tv_sec;
     buf.tv_nsec = t.tv_nsec;
 
@@ -102,7 +102,13 @@
 
 static void prof_forksupport_child(void)
 {
-    if (close_timing_log() && profiling_basefn != NULL) {
+    /* XXX leaks the file descriptor.  I'm getting problems of
+       corrupted files if I fclose() it in the child, even though
+       we're supposed to have fflush()ed the file before the fork.
+       Why??? */
+    profiling_file = NULL;
+    stmcb_timing_event = NULL;
+    if (profiling_basefn != NULL) {
         char filename[1024];
         snprintf(filename, sizeof(filename),
                  "%s.fork%ld", profiling_basefn, (long)getpid());


More information about the pypy-commit mailing list