2016-02-28 22:59:10 +08:00
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
|
|
|
|
|
|
|
|
class SimulationIterationResult(object):
|
|
|
|
'''
|
2016-02-29 02:59:07 +08:00
|
|
|
Encapsulates single worker result.
|
2016-02-28 22:59:10 +08:00
|
|
|
'''
|
|
|
|
|
2016-03-07 06:03:12 +08:00
|
|
|
def __init__(self, id, count, start_time, end_time):
|
2016-02-28 22:59:10 +08:00
|
|
|
'''
|
2016-02-29 02:59:07 +08:00
|
|
|
:param id: str, query id
|
|
|
|
:param count: int, number of the query exection
|
|
|
|
:param delta_t: time of execution
|
2016-02-28 22:59:10 +08:00
|
|
|
'''
|
|
|
|
self.id = id
|
|
|
|
self.count = count
|
2016-03-07 06:03:12 +08:00
|
|
|
self.start_time = start_time
|
|
|
|
self.end_time = end_time
|
|
|
|
self.delta_t = end_time - start_time
|
2016-02-28 22:59:10 +08:00
|
|
|
self.queries_per_second = self.count / self.delta_t
|
|
|
|
|
|
|
|
def json_data(self):
|
|
|
|
'''
|
2016-02-29 02:59:07 +08:00
|
|
|
:returns: dict {query_id(str):queries_per_second(float)}
|
2016-02-28 22:59:10 +08:00
|
|
|
'''
|
|
|
|
return {
|
|
|
|
"id": self.id,
|
|
|
|
"queries_per_second": self.queries_per_second
|
|
|
|
}
|