Author: Remi Meier <remi.me...@gmail.com> Branch: stmgc-c8 Changeset: r76320:c8ea66315864 Date: 2015-03-11 10:23 +0100 http://bitbucket.org/pypy/pypy/changeset/c8ea66315864/
Log: Merge diff --git a/pypy/stm/print_stm_log.py b/pypy/stm/print_stm_log.py --- a/pypy/stm/print_stm_log.py +++ b/pypy/stm/print_stm_log.py @@ -91,7 +91,10 @@ self.cpu_time_committed = 0.0 self.cpu_time_aborted = 0.0 self.cpu_time_paused = 0.0 + self.cpu_time_gc_minor = 0.0 + self.cpu_time_gc_major = 0.0 self._prev = (0.0, "stop") + self._in_major_coll = None self.reset_counters() def reset_counters(self): @@ -99,6 +102,7 @@ self._transaction_pause_time = 0.0 self._transaction_aborting = False self._transaction_inev = None + self._in_minor_coll = None def transaction_start(self, entry): self.reset_counters() @@ -167,9 +171,29 @@ def wait_for_other_inev(self, wait_time, out_conflicts): c = self.get_conflict(self._transaction_inev[0], out_conflicts) - assert wait_time >= 0 + assert wait_time >= 0.0 c.paused_time += wait_time + def gc_minor_start(self, event): + self._in_minor_coll = event.timestamp + + def gc_minor_done(self, event): + if self._in_minor_coll is not None: + gc_time = event.timestamp - self._in_minor_coll + assert gc_time >= 0.0 + self.cpu_time_gc_minor += gc_time + self._in_minor_coll = None + + def gc_major_start(self, event): + self._in_major_coll = event.timestamp + + def gc_major_done(self, event): + if self._in_major_coll is not None: + gc_time = event.timestamp - self._in_major_coll + assert gc_time >= 0.0 + self.cpu_time_gc_major += gc_time + self._in_major_coll = None + class ConflictSummary(object): def __init__(self, event, marker): @@ -250,6 +274,14 @@ t.transaction_pause(entry) elif entry.event == STM_WAIT_DONE: t.transaction_unpause(entry, conflicts) + elif entry.event == STM_GC_MINOR_START: + t.gc_minor_start(entry) + elif entry.event == STM_GC_MINOR_DONE: + t.gc_minor_done(entry) + elif entry.event == STM_GC_MAJOR_START: + t.gc_major_start(entry) + elif entry.event == STM_GC_MAJOR_DONE: + t.gc_major_done(entry) # if cnt == 0: raise Exception("empty file") @@ -264,7 +296,7 @@ start_time = stmlog.start_time total_time = stmlog.total_time print - print 'Total real time: %.3fs' % (total_time,) + print 'Total real time: %9.3fs' % (total_time,) # total_cpu_time_committed = stmlog.get_total_cpu_time_committed() total_cpu_time_aborted = stmlog.get_total_cpu_time_aborted() @@ -272,14 +304,20 @@ total_cpu_time_total = (total_cpu_time_committed + total_cpu_time_aborted + total_cpu_time_paused) - print 'CPU time in STM mode: %.3fs (%s) committed' % ( + total_cpu_time_gc_minor = stmlog.get_total_cpu_time_gc_minor() + total_cpu_time_gc_major = stmlog.get_total_cpu_time_gc_major() + print 'CPU time in STM mode:%9.3fs (%4s) committed' % ( total_cpu_time_committed, percent(total_cpu_time_committed, total_time)) - print ' %.3fs (%s) aborted' % ( + print ' %9.3fs (%4s) aborted' % ( total_cpu_time_aborted, percent(total_cpu_time_aborted, total_time)) - print ' %.3fs (%s) paused' % ( + print ' %9.3fs (%4s) paused' % ( total_cpu_time_paused, percent(total_cpu_time_paused, total_time)) - print ' %.3fs (%s) total' % ( + print ' %9.3fs (%4s) TOTAL' % ( total_cpu_time_total, percent(total_cpu_time_total, total_time)) + print ' including %9.3fs (%4s) minor GC collections' % ( + total_cpu_time_gc_minor, percent(total_cpu_time_gc_minor, total_time)) + print ' and %9.3fs (%4s) major GC collections' % ( + total_cpu_time_gc_major, percent(total_cpu_time_gc_major, total_time)) print # values = stmlog.get_conflicts() @@ -308,6 +346,12 @@ def get_total_cpu_time_paused(self): return sum([v.cpu_time_paused for v in self.threads.values()]) + def get_total_cpu_time_gc_minor(self): + return sum([v.cpu_time_gc_minor for v in self.threads.values()]) + + def get_total_cpu_time_gc_major(self): + return sum([v.cpu_time_gc_major for v in self.threads.values()]) + def get_conflicts(self): values = self.conflicts.values() values.sort(key=ConflictSummary.sortkey) _______________________________________________ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit