summaryrefslogtreecommitdiffstats
path: root/testsuites/tmtests/tmtimer01/plot.py
blob: 136d470293ccd5e5c3db534be1d7b68db56da3a6 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# SPDX-License-Identifier: BSD-2-Clause

#
# Copyright (c) 2016 embedded brains GmbH.  All rights reserved.
#
# The license and distribution terms for this file may be
# found in the file LICENSE in this distribution or at
# http://www.rtems.org/license/LICENSE.
#

import libxml2
from libxml2 import xmlNode
import matplotlib.pyplot as plt
doc = libxml2.parseFile('tmtimer01.scn')
ctx = doc.xpathNewContext()

plt.title('timer test')
plt.xscale('log')
plt.xlabel('active timers')
plt.ylabel('timer fire and cancel [ns]')

x = map(xmlNode.getContent, ctx.xpathEval('/TMTimer01/Sample/ActiveTimers'))
for i in ['First', 'Middle', 'Last']:
	y = map(xmlNode.getContent, ctx.xpathEval('/TMTimer01/Sample/' + i))
	plt.plot(x, y, label = i)
plt.legend(loc = 'best')
plt.show()