예제 #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
    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