##// END OF EJS Templates
ui: wrap whole _write() block with timeblockedsection...
Yuya Nishihara -
r40559:25732c56 default
parent child Browse files
Show More
@@ -952,6 +952,9 class ui(object):
952 def _writenobuf(self, write, *args, **opts):
952 def _writenobuf(self, write, *args, **opts):
953 self._progclear()
953 self._progclear()
954 msg = b''.join(args)
954 msg = b''.join(args)
955
956 # opencode timeblockedsection because this is a critical path
957 starttime = util.timer()
955 try:
958 try:
956 if self._colormode == 'win32':
959 if self._colormode == 'win32':
957 # windows color printing is its own can of crab, defer to
960 # windows color printing is its own can of crab, defer to
@@ -963,18 +966,14 class ui(object):
963 msg = self.label(msg, label)
966 msg = self.label(msg, label)
964 write(msg)
967 write(msg)
965 finally:
968 finally:
966 pass
969 self._blockedtimes['stdio_blocked'] += \
970 (util.timer() - starttime) * 1000
967
971
968 def _write(self, data):
972 def _write(self, data):
969 # opencode timeblockedsection because this is a critical path
970 starttime = util.timer()
971 try:
973 try:
972 self.fout.write(data)
974 self.fout.write(data)
973 except IOError as err:
975 except IOError as err:
974 raise error.StdioError(err)
976 raise error.StdioError(err)
975 finally:
976 self._blockedtimes['stdio_blocked'] += \
977 (util.timer() - starttime) * 1000
978
977
979 def write_err(self, *args, **opts):
978 def write_err(self, *args, **opts):
980 if self._bufferstates and self._bufferstates[-1][0]:
979 if self._bufferstates and self._bufferstates[-1][0]:
@@ -984,7 +983,7 class ui(object):
984
983
985 def _write_err(self, data):
984 def _write_err(self, data):
986 try:
985 try:
987 with self.timeblockedsection('stdio'):
986 if True:
988 if not getattr(self.fout, 'closed', False):
987 if not getattr(self.fout, 'closed', False):
989 self.fout.flush()
988 self.fout.flush()
990 self.ferr.write(data)
989 self.ferr.write(data)
General Comments 0
You need to be logged in to leave comments. Login now