<commit_before>"""
Elapsed time measurement utilities.
"""
import time

from sfepy.base.base import Struct

class Timer(Struct):

    def __init__(self, name):
        Struct.__init__(self, name=name)

        self.reset()

    def reset(self):
        self.t0 = self.t1 = None
        self.total = 0.0

    def start(self, reset=False):
        if reset: self.reset()

        self.t0 = time.clock()
        self.t1 = None

    def stop(self):
        if self.t0 is None:
            raise ValueError('timer %s was not started!' % self.name)
        self.t1 = time.clock()

        dt = self.t1 - self.t0
        self.total += dt
        return dt<commit_msg>store current dt in Timer<commit_after>"""
Elapsed time measurement utilities.
"""
import time

from sfepy.base.base import Struct

class Timer(Struct):

    def __init__(self, name):
        Struct.__init__(self, name=name)

        self.reset()

    def reset(self):
        self.t0 = self.t1 = None
        self.total = self.dt = 0.0

    def start(self, reset=False):
        if reset: self.reset()

        self.t0 = time.clock()
        self.t1 = None

    def stop(self):
        if self.t0 is None:
            raise ValueError('timer %s was not started!' % self.name)
        self.t1 = time.clock()

        self.dt = self.t1 - self.t0
        self.total += self.dt
        return self.dt
{'fraction_non_alphanumeric': 0.11864406779661017, 'fraction_numerical': 0.014738393515106854, 'mean_word_length': 1.9846153846153847, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4970667', 'n_tokens_mistral': 446, 'n_tokens_neox': 426, 'n_words': 120}