<commit_before>import gdb
from ptable import ptable, as_hex
import utils


class TimeVal(object):
    __metaclass__ = utils.GdbStructMeta
    __ctype__ = 'struct timeval'
    __cast__ = {'tv_sec': int, 'tv_usec': int}

    def as_float(self):
        return float(self.tv_sec) + float(self.tv_usec) * 10e-6

    def __str__(self):
        return 'timeval{%.6f}' % self.as_float()


class LogEntry():
    def __init__(self, entry):
        self.msg = entry['kl_format'].string()
        # If there is % escaped it is not parameter.
        nparams = self.msg.count('%') - 2 * self.msg.count('%%')
        self.params = [entry['kl_params'][i] for i in range(nparams)]
        self.timestamp = TimeVal(entry['kl_timestamp'])
        self.source = entry['kl_file'].string()<commit_msg>Fix silly bug in timestamp gdb print routine.<commit_after>import gdb
from ptable import ptable, as_hex
import utils


class TimeVal(object):
    __metaclass__ = utils.GdbStructMeta
    __ctype__ = 'struct timeval'
    __cast__ = {'tv_sec': int, 'tv_usec': int}

    def as_float(self):
        return float(self.tv_sec) + float(self.tv_usec) * 1e-6

    def __str__(self):
        return 'timeval{%.6f}' % self.as_float()


class LogEntry():
    def __init__(self, entry):
        self.msg = entry['kl_format'].string()
        # If there is % escaped it is not parameter.
        nparams = self.msg.count('%') - 2 * self.msg.count('%%')
        self.params = [entry['kl_params'][i] for i in range(nparams)]
        self.timestamp = TimeVal(entry['kl_timestamp'])
        self.source = entry['kl_file'].string()
{'fraction_non_alphanumeric': 0.14249843063402384, 'fraction_numerical': 0.005649717514124294, 'mean_word_length': 3.161879895561358, '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': '709073', 'n_tokens_mistral': 542, 'n_tokens_neox': 532, 'n_words': 128}