summaryrefslogtreecommitdiffstats
path: root/testsuites/sptests/sptimecounter02/sptimecounter02.py
blob: 925b3f1d6c00bbad9d024e5864f438658e2e0cad (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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#!/usr/bin/env python

#
# 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 re
import libxml2
from libxml2 import xmlNode
import matplotlib.pyplot as plt
data = open('sptimecounter02.scn').read()
data = re.sub(r'\*\*\*.*\*\*\*', '', data)
doc = libxml2.parseDoc(data)
ctx = doc.xpathNewContext()

plt.title('Timestamp Performance')
plt.xlabel('Active Workers')
plt.ylabel('Operation Count')

def m(n):
	return int(n.getContent())

def getCounterSums(variant):
	w = 1
	y = []
	while True:
		c = map(m, ctx.xpathEval('/SPTimecounter01/' + variant + '[@activeWorker="' + str(w) + '"]/Counter'))
		if not c:
			break
		y.append(sum(c))
		w = w + 1
	return y

y = getCounterSums('BinuptimeTest')
x = range(1, len(y) + 1)
plt.xticks(x)
plt.plot(x, y, marker = 'o')
plt.show()