3.1-rc3 (revision d9ca08bb)
otf2_high_level_reader_example.py

Python high-level reading example

1 #!/usr/bin/env python
2 #
3 # This file is part of the Score-P software (http://www.score-p.org)
4 #
5 # Copyright (c) 2015-2017,
6 # Technische Universitaet Dresden, Germany
7 #
8 # This software may be modified and distributed under the terms of
9 # a BSD-style license. See the COPYING file in the package base
10 # directory for details.
11 #
12 
13 import otf2
14 
15 
16 with otf2.reader.open('TestArchive/traces.otf2') as trace:
17  print("Read {} string definitions".format(len(trace.definitions.strings)))
18 
19  for location, event in trace.events:
20  print("Encountered {} event {} on {}".format(type(event).__name__,
21  event, location))