blob: 897c8e2b3c1cadf5adcd707f7871c8aecad7d2b5 (
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
|
#
# Copyright (c) 2014 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.com/license/LICENSE.
#
import libxml2
from libxml2 import xmlNode
import matplotlib.pyplot as plt
doc = libxml2.parseFile("tmcontext01.scn")
ctx = doc.xpathNewContext()
def plot(y):
n=len(y)
x=range(0, n)
plt.plot(x, y)
plt.title("context switch timing test")
plt.xlabel('function nest level')
plt.ylabel('context switch time [ns]')
for e in ["normal", "dirty"]:
for i in ["Min", "Q1", "Q2", "Q3", "Max"]:
y=map(xmlNode.getContent, ctx.xpathEval("/Test/ContextSwitchTest[@environment='" + e + "' and not(@load)]/Sample/" + i))
plot(y)
load=1
while load > 0:
for i in ["Min", "Q1", "Q2", "Q3", "Max"]:
y=map(xmlNode.getContent, ctx.xpathEval("/Test/ContextSwitchTest[@environment='dirty' and @load='" + str(load) + "']/Sample/" + i))
if len(y) > 0:
plot(y)
load = load + 1
else:
load = 0
plt.show()
|