コード例 #1
0
    def end_event(self, event, context):
        now = time.time()
        name = uniform_description(context)
        duration = now - self.event_start
        if self.threshold and duration < self.threshold:
            self.event_start = now
            return

        if self.pretty_output:
            self.output.write("{time:>-6,.2f}  {event} {name}\n".format(
                event=event,
                name=name,
                time=duration,
            ))
        else:
            self.csv.writerow([
                event,
                name,
                duration,
                self.event_start,
            ])
        self.event_start = now

        if self.max_test_time is not None:
            limit = max(self.__dict__.pop("time_limit", 0), self.max_test_time)
            if duration > limit:
                raise AssertionError(
                    f"{event} time limit ({limit}) exceeded: {duration}")
コード例 #2
0
 def end_event(self, event, context):
     now = time.time()
     name = uniform_description(context)
     if self.pretty_output:
         self.output.write("{time:>-6,.2f}  {event} {name}\n".format(
             event=event,
             name=name,
             time=now - self.event_start,
         ))
     else:
         self.csv.writerow([
             event,
             name,
             now - self.event_start,
             self.event_start,
         ])
     self.event_start = now
コード例 #3
0
ファイル: timing.py プロジェクト: zbidi/commcare-hq
 def end_event(self, event, context):
     now = time.time()
     name = uniform_description(context)
     if self.pretty_output:
         self.output.write("{time:>-6,.2f}  {event} {name}\n".format(
             event=event,
             name=name,
             time=now - self.event_start,
         ))
     else:
         self.csv.writerow([
             event,
             name,
             now - self.event_start,
             self.event_start,
         ])
     self.event_start = now
コード例 #4
0
ファイル: timing.py プロジェクト: ye-man/commcare-hq
    def end_event(self, event, context):
        now = time.time()
        name = uniform_description(context)
        duration = now - self.event_start
        if self.threshold and duration < self.threshold:
            self.event_start = now
            return

        if self.pretty_output:
            self.output.write("{time:>-6,.2f}  {event} {name}\n".format(
                event=event,
                name=name,
                time=duration,
            ))
        else:
            self.csv.writerow([
                event,
                name,
                duration,
                self.event_start,
            ])
        self.event_start = now