summaryrefslogtreecommitdiffstats
path: root/testsuites/smptests/smplock01/smplock01perf.py
blob: 52db4d3cc1c4b8e148201d8b0b13e582fa1a1ff2 (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
#!/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('smplock01.scn').read()
data = re.sub(r'\*\*\*.*\*\*\*', '', data)
doc = libxml2.parseDoc(data)
ctx = doc.xpathNewContext()

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

y = map(xmlNode.getContent, ctx.xpathEval('/SMPLock01/GlobalTicketLockWithLocalCounter/SumOfLocalCounter'))
x = range(1, len(y) + 1)
plt.plot(x, y, label = 'Ticket Lock', marker = 'o')

y = map(xmlNode.getContent, ctx.xpathEval('/SMPLock01/GlobalMCSLockWithLocalCounter/SumOfLocalCounter'))
plt.plot(x, y, label = 'MCS Lock', marker = 'o')

y = map(xmlNode.getContent, ctx.xpathEval('/SMPLock01/GlobalTASLockWithLocalCounter/SumOfLocalCounter'))
plt.plot(x, y, label = 'TAS Lock', marker = 'o')

y = map(xmlNode.getContent, ctx.xpathEval('/SMPLock01/GlobalTTASLockWithLocalCounter/SumOfLocalCounter'))
plt.plot(x, y, label = 'TTAS Lock', marker = 'o')

plt.legend(loc = 'best')
plt.show()