changeset 38286:99188a7c8717

statprof: fix save and load Fix these functions even if they don't are used at the moment. Thanks to Yuya Nishihara for spotting that.
author Boris Feld <boris.feld@octobus.net>
date Mon, 11 Jun 2018 19:24:01 +0200
parents 9df777d7f061
children f1d55ae2c5c8
files mercurial/statprof.py
diffstat 1 files changed, 2 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/statprof.py	Mon Jun 11 19:05:41 2018 +0200
+++ b/mercurial/statprof.py	Mon Jun 11 19:24:01 2018 +0200
@@ -350,7 +350,7 @@
 
 def save_data(path):
     with open(path, 'w+') as file:
-        file.write(str(state.accumulated_time) + '\n')
+        file.write("%f %f\n" % state.accumulated_time)
         for sample in state.samples:
             time = str(sample.time)
             stack = sample.stack
@@ -361,7 +361,7 @@
 def load_data(path):
     lines = open(path, 'r').read().splitlines()
 
-    state.accumulated_time = float(lines[0])
+    state.accumulated_time = [float(value) for value in lines[0].split()]
     state.samples = []
     for line in lines[1:]:
         parts = line.split('\0')