source: rtems/testsuites/tmtests/tmfine01/tmfine01.py @ 6087f33e

Last change on this file since 6087f33e was 6087f33e, checked in by Sebastian Huber <sebastian.huber@…>, on Oct 18, 2017 at 6:50:17 AM

tmtests/tmfine01: Add test cases

Update #2674.
Update #3112.
Update #3113.
Update #3114.
Update #3115.

  • Property mode set to 100644
File size: 1.6 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.yscale('log')
21plt.title('Uncontested Mutex Performance')
22plt.xlabel('Active Workers')
23plt.ylabel('Operation Count')
24
25def m(n):
26        return int(n.getContent())
27
28def getCounterSums(variant):
29        w = 1
30        y = []
31        while True:
32                c = map(m, ctx.xpathEval('/TestTimeFine01/' + variant + '[@activeWorker="' + str(w) + '"]/Counter'))
33                if not c:
34                        break
35                y.append(sum(c))
36                w = w + 1
37        return y
38
39y = getCounterSums('ManySysLockMutex')
40x = range(1, len(y) + 1)
41plt.plot(x, y, label = 'Sys Lock Mutex', marker = 'o')
42
43y = getCounterSums('ManyMutex')
44plt.plot(x, y, label = 'Classic Inheritance Mutex', marker = 'o')
45
46y = getCounterSums('ManyClassicCeilingMutex')
47plt.plot(x, y, label = 'Classic Ceiling Mutex', marker = 'o')
48
49y = getCounterSums('ManyClassicMrsPMutex')
50plt.plot(x, y, label = 'Classic MrsP Mutex', marker = 'o')
51
52y = getCounterSums('ManyPthreadSpinlock')
53plt.plot(x, y, label = 'Pthread Spinlock', marker = 'o')
54
55y = getCounterSums('ManyPthreadMutexInherit')
56plt.plot(x, y, label = 'Pthread Mutex Inherit', marker = 'o')
57
58y = getCounterSums('ManyPthreadMutexProtect')
59plt.plot(x, y, label = 'Pthread Mutex Protect', marker = 'o')
60
61plt.legend(loc = 'best')
62plt.show()
Note: See TracBrowser for help on using the repository browser.