|
@@ -164,6 +164,12 @@ class DataCenter(object):
|
|
|
day_stamp = self.day_stamp(start_time)
|
|
|
start_pos = start_time - day_stamp
|
|
|
|
|
|
+ cur_day = self.day_stamp(stime.time())
|
|
|
+ if day_stamp == cur_day:
|
|
|
+ end_pos = int(stime.time()) - day_stamp
|
|
|
+ else:
|
|
|
+ end_pos = -1
|
|
|
+
|
|
|
fig = Figure(figsize=(16, 9))
|
|
|
ax = fig.subplots()
|
|
|
|
|
@@ -172,10 +178,10 @@ class DataCenter(object):
|
|
|
for path, data in self.read_data(hfive, paths):
|
|
|
data = np.array(data)
|
|
|
predata = predata + data
|
|
|
- self._draw_plot(ax, x, day_stamp, start_pos, data, interval, path)
|
|
|
+ self._draw_plot(ax, x, day_stamp, start_pos,end_pos, data, interval, path)
|
|
|
logger.info("path=%s", path)
|
|
|
|
|
|
- self._draw_plot(ax, x, day_stamp, start_pos, predata, interval, filer_text)
|
|
|
+ self._draw_plot(ax, x, day_stamp, start_pos,end_pos, predata, interval, filer_text)
|
|
|
|
|
|
ax.legend()
|
|
|
ax.grid()
|
|
@@ -256,7 +262,7 @@ class DataCenter(object):
|
|
|
|
|
|
return filer_text, paths
|
|
|
|
|
|
- def _draw_plot(self, ax, x, day_stamp, start_pos, data, interval=300, path=''):
|
|
|
+ def _draw_plot(self, ax, x, day_stamp, start_pos,end_pos, data, interval=300, path=''):
|
|
|
import matplotlib.dates as mdate
|
|
|
# 'commit-succ': 0, 'commit-fail': 1, 'notify-succ': 2, 'notify-fail': 3, 'user_succ': 4
|
|
|
|
|
@@ -275,7 +281,10 @@ class DataCenter(object):
|
|
|
ySucc = ySucc / (all + 0.00000001)
|
|
|
# x = x[pos]
|
|
|
|
|
|
- pos = np.where(x >= start_pos)
|
|
|
+ if end_pos == -1:
|
|
|
+ pos = np.where(x >= start_pos)
|
|
|
+ else:
|
|
|
+ pos = np.where(start_pos <= x < end_pos)
|
|
|
ySucc = ySucc[pos]
|
|
|
x = x[pos]
|
|
|
|