blob: c68af8d42165b48ea56daca1674ab8f174f226a4 [file] [log] [blame]
Kapileshwar Singh77d16772015-01-21 18:07:15 +00001#!/usr/bin/env python
Javi Merino034e7cc2015-04-22 18:39:21 +01002# $Copyright:
3# ----------------------------------------------------------------
4# This confidential and proprietary software may be used only as
5# authorised by a licensing agreement from ARM Limited
6# (C) COPYRIGHT 2015 ARM Limited
7# ALL RIGHTS RESERVED
8# The entire notice above must be reproduced on all authorised
9# copies and copies may only be made to the extent permitted
10# by a licensing agreement from ARM Limited.
11# ----------------------------------------------------------------
12# File: test_duplicates.py
13# ----------------------------------------------------------------
14# $
15#
Kapileshwar Singh77d16772015-01-21 18:07:15 +000016
17import unittest
18import matplotlib
19import pandas as pd
20import utils_tests
21import cr2
22import shutil
23
24from test_thermal import BaseTestThermal
25
26
27class TestPlotterDupVals(BaseTestThermal):
28
29 """Test Duplicate Entries in plotter"""
30
31 def __init__(self, *args, **kwargs):
32 super(TestPlotterDupVals, self).__init__(*args, **kwargs)
33
34 def test_plotter_duplicates(self):
35 """Test that plotter handles duplicates fine"""
36 with open("trace.txt", "w") as fout:
37 fout.write("""version = 6
38cpus=6
Javi Merino0302ef72015-03-27 19:27:11 +000039 rcuos/2-22 [001] 0000.018510: sched_load_avg_sg: cpus=00000001 load=0 utilization=0
40 rcuos/2-22 [001] 6550.018611: sched_load_avg_sg: cpus=00000002 load=1 utilization=1
41 rcuos/2-22 [001] 6550.018611: sched_load_avg_sg: cpus=00000004 load=2 utilization=2
42 rcuos/2-22 [001] 6550.018612: sched_load_avg_sg: cpus=00000001 load=2 utilization=3
43 rcuos/2-22 [001] 6550.018624: sched_load_avg_sg: cpus=00000002 load=1 utilization=4
44 rcuos/2-22 [001] 6550.018625: sched_load_avg_sg: cpus=00000002 load=2 utilization=5
45 rcuos/2-22 [001] 6550.018626: sched_load_avg_sg: cpus=00000002 load=3 utilization=6
46 rcuos/2-22 [001] 6550.018627: sched_load_avg_sg: cpus=00000002 load=1 utilization=7
47 rcuos/2-22 [001] 6550.018628: sched_load_avg_sg: cpus=00000004 load=2 utilization=8\n""")
Kapileshwar Singh77d16772015-01-21 18:07:15 +000048 fout.close()
49 run1 = cr2.Run(name="first")
50 l = cr2.LinePlot(
51 run1,
52 cr2.sched.SchedLoadAvgSchedGroup,
53 column=['utilization'],
54 filters={
55 "load": [
56 1,
57 2]},
58 pivot="cpus",
59 marker='o',
60 linestyle='none',
61 per_line=3)
Kapileshwar Singha2040442015-02-23 12:19:18 +000062 l.view(test=True)
Kapileshwar Singh77d16772015-01-21 18:07:15 +000063
64 def test_plotter_triplicates(self):
65
66 """Test that plotter handles triplicates fine"""
67
68 with open("trace.txt", "w") as fout:
69 fout.write("""version = 6
70cpus=6
Javi Merino0302ef72015-03-27 19:27:11 +000071 rcuos/2-22 [001] 0000.018510: sched_load_avg_sg: cpus=00000001 load=0 utilization=0
72 rcuos/2-22 [001] 6550.018611: sched_load_avg_sg: cpus=00000002 load=1 utilization=1
73 rcuos/2-22 [001] 6550.018611: sched_load_avg_sg: cpus=00000004 load=2 utilization=2
74 rcuos/2-22 [001] 6550.018611: sched_load_avg_sg: cpus=00000004 load=2 utilization=2
75 rcuos/2-22 [001] 6550.018612: sched_load_avg_sg: cpus=00000001 load=2 utilization=3
76 rcuos/2-22 [001] 6550.018624: sched_load_avg_sg: cpus=00000002 load=1 utilization=4
77 rcuos/2-22 [001] 6550.018625: sched_load_avg_sg: cpus=00000002 load=2 utilization=5
78 rcuos/2-22 [001] 6550.018626: sched_load_avg_sg: cpus=00000002 load=3 utilization=6
79 rcuos/2-22 [001] 6550.018627: sched_load_avg_sg: cpus=00000002 load=1 utilization=7
80 rcuos/2-22 [001] 6550.018628: sched_load_avg_sg: cpus=00000004 load=2 utilization=8\n""")
Kapileshwar Singh77d16772015-01-21 18:07:15 +000081 fout.close()
82
83 run1 = cr2.Run(name="first")
84 l = cr2.LinePlot(
85 run1,
86 cr2.sched.SchedLoadAvgSchedGroup,
87 column=['utilization'],
88 filters={
89 "load": [
90 1,
91 2]},
92 pivot="cpus",
93 marker='o',
94 linestyle='none',
95 per_line=3)
Kapileshwar Singha2040442015-02-23 12:19:18 +000096 l.view(test=True)