Esempio n. 1
0
    def pop_second(self):
        parsed_sec = AbstractReader.pop_second(self)
        if parsed_sec:
            self.pending_second_data_queue.append(parsed_sec)
        else:
            self.log.debug("No new seconds present")   
            
        if not self.pending_second_data_queue:
            self.log.debug("pending_second_data_queue empty")
            return None
        else:
            self.log.debug("pending_second_data_queue: %s", self.pending_second_data_queue)


        next_time = int(time.mktime(self.pending_second_data_queue[0].time.timetuple()))
            
        if self.last_sample_time and (next_time - self.last_sample_time) > 1:
            self.last_sample_time += 1
            self.log.debug("Adding phantom zero sample: %s", self.last_sample_time)
            res = self.get_zero_sample(datetime.datetime.fromtimestamp(self.last_sample_time))
        else:
            res = self.pending_second_data_queue.pop(0)
        
        self.last_sample_time = int(time.mktime(res.time.timetuple()))
        res.overall.planned_requests = self.__get_expected_rps()
        self.log.debug("Pop result: %s", res)
        return res
Esempio n. 2
0
    def pop_second(self):
        parsed_sec = AbstractReader.pop_second(self)
        if parsed_sec:
            self.pending_second_data_queue.append(parsed_sec)
        else:
            self.log.debug("No new seconds present")

        if not self.pending_second_data_queue:
            self.log.debug("pending_second_data_queue empty")
            return None
        else:
            self.log.debug("pending_second_data_queue: %s",
                           self.pending_second_data_queue)

        next_time = int(
            time.mktime(self.pending_second_data_queue[0].time.timetuple()))

        if self.last_sample_time and (next_time - self.last_sample_time) > 1:
            self.last_sample_time += 1
            self.log.debug("Adding phantom zero sample: %s",
                           self.last_sample_time)
            res = self.get_zero_sample(
                datetime.datetime.fromtimestamp(self.last_sample_time))
        else:
            res = self.pending_second_data_queue.pop(0)

        self.last_sample_time = int(time.mktime(res.time.timetuple()))
        res.overall.planned_requests = self.__get_expected_rps()
        self.log.debug("Pop result: %s", res)
        return res
Esempio n. 3
0
 def __aggregate_next_second(self):
     ''' calls aggregator if there is data '''
     parsed_sec = AbstractReader.pop_second(self)
     if parsed_sec:
         self.pending_second_data_queue.append(parsed_sec)
         timestamp = int(time.mktime(parsed_sec.time.timetuple()))
         if timestamp in self.stat_data.keys():
             del self.stat_data[timestamp]
     else:
         self.log.debug("No new seconds present")
Esempio n. 4
0
 def __aggregate_next_second(self):
     """ calls aggregator if there is data """
     parsed_sec = AbstractReader.pop_second(self)
     if parsed_sec:
         self.pending_second_data_queue.append(parsed_sec)
         timestamp = int(time.mktime(parsed_sec.time.timetuple()))
         if timestamp in self.stat_data.keys():
             del self.stat_data[timestamp]
     else:
         self.log.debug("No new seconds present")
Esempio n. 5
0
 def __aggregate_next_second(self):
     """ calls aggregator if there is data """
     parsed_sec = AbstractReader.pop_second(self)
     if parsed_sec:
         timestamp = int(time.mktime(parsed_sec.time.timetuple()))
         if timestamp in self.stat_data.keys():
             parsed_sec.overall.active_threads=self.stat_data[timestamp]
             for marker in parsed_sec.cases:
                 parsed_sec.cases[marker].active_threads=self.stat_data[timestamp]
             del self.stat_data[timestamp]
         self.pending_second_data_queue.append(parsed_sec)
     else:
         self.log.debug("No new seconds present")
Esempio n. 6
0
 def __aggregate_next_second(self):
     """ calls aggregator if there is data """
     parsed_sec = AbstractReader.pop_second(self)
     if parsed_sec:
         timestamp = int(time.mktime(parsed_sec.time.timetuple()))
         if timestamp in self.stat_data.keys():
             parsed_sec.overall.active_threads = self.stat_data[timestamp]
             for marker in parsed_sec.cases:
                 parsed_sec.cases[marker].active_threads = self.stat_data[
                     timestamp]
             del self.stat_data[timestamp]
         self.pending_second_data_queue.append(parsed_sec)
     else:
         self.log.debug("No new seconds present")