'Run any necessary calculations on the data collected from the logs
and return a list of metric objects.'

def get_state(self, duration):

    self.duration = float(duration)
    totalTxns = ((self.numSent + self.numBounced) + self.numDeferred)
    pctDeferred = 0.0
    pctSent = 0.0
    pctBounced = 0.0
    avgDelay = 0
    mailTxnsSec = 0
    mailSentSec = 0
    if (totalTxns > 0):
        pctDeferred = ((float(self.numDeferred) / totalTxns) * 100)
        pctSent = ((float(self.numSent) / totalTxns) * 100)
        pctBounced = ((float(self.numBounced) / totalTxns) * 100)
    if (self.numSent > 0):
        avgDelay = (self.totalDelay / self.numSent)
    if (self.duration > 0):
        mailTxnsSec = (totalTxns / self.duration)
        mailSentSec = (self.numSent / self.duration)
    return [MetricObject('numSent', self.numSent, 'Total    Sent'), MetricObject('pctSent', pctSent, 'Percentage    Sent'), MetricObject('numDeferred', self.numDeferred, 'Total    Deferred'), MetricObject('pctDeferred', pctDeferred, 'Percentage    Deferred'), MetricObject('numBounced', self.numBounced, 'Total    Bounced'), MetricObject('pctBounced', pctBounced, 'Percentage    Bounced'), MetricObject('mailTxnsSec', mailTxnsSec, 'Transactions    per    sec'), MetricObject('mailSentSec', mailSentSec, 'Sends    per    sec'), MetricObject('avgDelay', avgDelay, 'Average    Sending    Delay')]
