source: rtems/testsuites/tmtests/tmfine01/tmfine01.py @ 0154dea3

Last change on this file since 0154dea3 was 0154dea3, checked in by Sebastian Huber <sebastian.huber@…>, on Nov 3, 2016 at 7:55:24 AM

tmtests/tmfine01: Update screen file

Add plot script.

  • Property mode set to 100644
File size: 1.1 KB
Line 
1#!/usr/bin/env python
2
3#
4# Copyright (c) 2016 embedded brains GmbH.  All rights reserved.
5#
6# The license and distribution terms for this file may be
7# found in the file LICENSE in this distribution or at
8# http://www.rtems.org/license/LICENSE.
9#
10
11import re
12import libxml2
13from libxml2 import xmlNode
14import matplotlib.pyplot as plt
15data = open('tmfine01.scn').read()
16data = re.sub(r'\*\*\*.*\*\*\*', '', data)
17doc = libxml2.parseDoc(data)
18ctx = doc.xpathNewContext()
19
20plt.title('Uncontested Mutex Performance')
21plt.xlabel('Active Workers')
22plt.ylabel('Operation Count')
23
24def m(n):
25        return int(n.getContent())
26
27def getCounterSums(variant):
28        w = 1
29        y = []
30        while True:
31                c = map(m, ctx.xpathEval('/TestTimeFine01/' + variant + '[@activeWorker="' + str(w) + '"]/Counter'))
32                if not c:
33                        break
34                y.append(sum(c))
35                w = w + 1
36        return y
37
38y = getCounterSums('ManySysLockMutex')
39x = range(1, len(y) + 1)
40plt.plot(x, y, label = 'Self-Contained Mutex', marker = 'o')
41
42y = getCounterSums('ManyMutex')
43plt.plot(x, y, label = 'Classic Mutex', marker = 'o')
44
45plt.legend(loc = 'best')
46plt.show()
Note: See TracBrowser for help on using the repository browser.