INNER CODE UNIT · Python

parse_message

etchdroid/etchdroid · misc/istream-trace-log-analyzer.py:5

def parse_message(msg):
    data = {}
    if 'time ' not in msg:
        return None  # Cannot parse
    thread_split = msg.split(' time ', 1)
    thread_name = thread_split[0].strip()
    rest = 'time ' + thread_split[1]  # Add back 'time ' to rest
    data['thread_name'] = thread_name
    tokens = rest.split()
    i = 0
    while i < len(tokens):
        token = tokens[i]
        if token == 'time':
            data['time'] = int(tokens[i + 1])
            i += 2
        elif token == 'pos':
            data['pos'] = int(tokens[i + 1])
            i += 2

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…