Changeset b2356837 in rtems


Ignore:
Timestamp:
Sep 5, 2014, 6:24:52 AM (6 years ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
4.11, 5, master
Children:
133962b
Parents:
960c9f0
Message:

tmtests/tmcontext01: Plot a legend

File:
1 edited

Legend:

Unmodified
Added
Removed
  • testsuites/tmtests/tmcontext01/plot.py

    r960c9f0 rb2356837  
    1313ctx = doc.xpathNewContext()
    1414
    15 def plot(y):
     15colors = ['k', 'r', 'b', 'g', 'y', 'm']
     16
     17def plot(y, color, label, first):
    1618        n=len(y)
    1719        x=range(0, n)
    18         plt.plot(x, y)
     20        if first:
     21                plt.plot(x, y, color=color, label=label)
     22        else:
     23                plt.plot(x, y, color=color)
    1924
    2025plt.title("context switch timing test")
     
    2227plt.ylabel('context switch time [ns]')
    2328
     29c = 0
    2430for e in ["normal", "dirty"]:
     31        first = True
    2532        for i in ["Min", "Q1", "Q2", "Q3", "Max"]:
    2633                y=map(xmlNode.getContent, ctx.xpathEval("/Test/ContextSwitchTest[@environment='" + e + "' and not(@load)]/Sample/" + i))
    27                 plot(y)
    28 load=1
     34                plot(y, colors[c], e, first)
     35                first = False
     36        c = c + 1
     37load = 1
    2938while load > 0:
     39        first = True
    3040        for i in ["Min", "Q1", "Q2", "Q3", "Max"]:
    3141                y=map(xmlNode.getContent, ctx.xpathEval("/Test/ContextSwitchTest[@environment='dirty' and @load='" + str(load) + "']/Sample/" + i))
    3242                if len(y) > 0:
    33                         plot(y)
    34                         load = load + 1
     43                        plot(y, colors[c], "load " + str(load), first)
     44                        first = False
    3545                else:
    3646                        load = 0
     47        if load > 0:
     48                load = load + 1
     49        c = c + 1
     50plt.legend()
    3751plt.show()
Note: See TracChangeset for help on using the changeset viewer.