[pypy-commit] stmgc instrumented: extra branch for some instrumented versions used for the paper

Raemi noreply at buildbot.pypy.org
Tue May 27 11:05:39 CEST 2014


Author: Remi Meier <remi.meier at inf.ethz.ch>
Branch: instrumented
Changeset: r1246:b6b8492892d5
Date: 2014-05-27 11:06 +0200
http://bitbucket.org/pypy/stmgc/changeset/b6b8492892d5/

Log:	extra branch for some instrumented versions used for the paper

diff --git a/c7/stm/setup.c b/c7/stm/setup.c
--- a/c7/stm/setup.c
+++ b/c7/stm/setup.c
@@ -79,8 +79,31 @@
     pages_setup_readmarkers_for_nursery();
 }
 
+#define MEASURE_MEM
+#include <unistd.h>
+#include <sys/time.h>
+#include <sys/resource.h>
+
+pthread_t m_thread;
+static volatile long kill_measurement = 0;
+void* measurement_thread(void *arg)
+{
+    while (!kill_measurement) {
+        usleep(100000);         /* 100ms */
+        double time = get_stm_time();
+#ifdef MEASURE_MEM
+        struct rusage usage;
+        getrusage(RUSAGE_SELF, &usage);
+        fprintf(stderr, "{%f:%ld/%ld}\n", time,
+                (long)pages_ctl.total_allocated, usage.ru_maxrss*1024);
+#endif
+    }
+    return NULL;
+}
+
 void stm_setup(void)
 {
+    pthread_create(&m_thread, NULL, measurement_thread, NULL);
     /* Check that some values are acceptable */
     assert(NB_SEGMENTS <= NB_SEGMENTS_MAX);
     assert(4096 <= ((uintptr_t)STM_SEGMENT));
@@ -152,6 +175,9 @@
        need to call it. */
     assert(!_has_mutex());
 
+    kill_measurement = 1;
+    pthread_join(m_thread, NULL);
+
     long i;
     for (i = 1; i <= NB_SEGMENTS; i++) {
         struct stm_priv_segment_info_s *pr = get_priv_segment(i);


More information about the pypy-commit mailing list