This notebook demonstrates how to read the newer proto-based logs.
In [2]:
# Point to where you have logs stored.
logfile = '../python/listops_rlspinn_test_run.log'
In [3]:
import sys
sys.path.append('../python')
In [4]:
import spinn.util.logging_pb2 as pb
from google.protobuf import text_format
Parsing the logs is pretty simple. Just read the raw text, and use the text_format module.
To load the logs, use the Merge()
function.
In [5]:
text = open(logfile, 'r').read()
len(text)
Out[5]:
In [7]:
logs = pb.SpinnLog()
parsed = text_format.Merge(text, logs)
In [10]:
# When was the first run in this log executed?
# This is the output of time.time() before running the first step.
parsed.header[0].start_time
Out[10]:
In [12]:
print(len(parsed.entries))
parsed.entries[33]
Out[12]: