|
@@ -118,7 +118,7 @@ class DataCenter(object):
|
|
result.append(sub.name)
|
|
result.append(sub.name)
|
|
return result
|
|
return result
|
|
|
|
|
|
- def draw_plot(self, start_time, **kwargs):
|
|
|
|
|
|
+ def draw_plot(self, start_time, interval=None, **kwargs):
|
|
hfive = h5py.File(self._file_name, 'r')
|
|
hfive = h5py.File(self._file_name, 'r')
|
|
try:
|
|
try:
|
|
paths = self.datasets(hfive, start_time, **kwargs)
|
|
paths = self.datasets(hfive, start_time, **kwargs)
|
|
@@ -127,6 +127,10 @@ class DataCenter(object):
|
|
for data in self.read_data(hfive, paths):
|
|
for data in self.read_data(hfive, paths):
|
|
predata = predata + data
|
|
predata = predata + data
|
|
print(type(data))
|
|
print(type(data))
|
|
|
|
+
|
|
|
|
+ internal = 3600
|
|
|
|
+ x = np.arange(0, 86400, internal)
|
|
|
|
+ return self._draw_plot(x, predata, internal)
|
|
except Exception as ex:
|
|
except Exception as ex:
|
|
print(ex)
|
|
print(ex)
|
|
finally:
|
|
finally:
|
|
@@ -180,10 +184,22 @@ class DataCenter(object):
|
|
|
|
|
|
return result
|
|
return result
|
|
|
|
|
|
- def _draw_plot(self, **args):
|
|
|
|
|
|
+ def _draw_plot(self, x, data, internal=300):
|
|
fig = Figure()
|
|
fig = Figure()
|
|
ax = fig.subplots()
|
|
ax = fig.subplots()
|
|
- ax.plot([1, 2])
|
|
|
|
|
|
+
|
|
|
|
+ # 'commit-succ': 0, 'commit-fail': 1, 'notify-succ': 2, 'notify-fail': 3, 'user_succ': 4
|
|
|
|
+ all = data[2] + data[3]
|
|
|
|
+ all = all.reshape((internal, -1))
|
|
|
|
+ all = np.sum(all, axis=0)
|
|
|
|
+
|
|
|
|
+ ySucc = data[2]
|
|
|
|
+ ySucc = ySucc.reshape((internal, -1))
|
|
|
|
+ ySucc = np.sum(ySucc, axis=0)
|
|
|
|
+
|
|
|
|
+ ySucc = ySucc / (all + 0.00001)
|
|
|
|
+
|
|
|
|
+ ax.plot(x, ySucc)
|
|
|
|
|
|
buf = BytesIO()
|
|
buf = BytesIO()
|
|
fig.savefig(buf, format="png")
|
|
fig.savefig(buf, format="png")
|