Kapileshwar Singh | 77d1677 | 2015-01-21 18:07:15 +0000 | [diff] [blame] | 1 | #!/usr/bin/env python |
Javi Merino | 034e7cc | 2015-04-22 18:39:21 +0100 | [diff] [blame^] | 2 | # $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 Singh | 77d1677 | 2015-01-21 18:07:15 +0000 | [diff] [blame] | 16 | |
| 17 | import unittest |
| 18 | import matplotlib |
| 19 | import pandas as pd |
| 20 | import utils_tests |
| 21 | import cr2 |
| 22 | import shutil |
| 23 | |
| 24 | from test_thermal import BaseTestThermal |
| 25 | |
| 26 | |
| 27 | class 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 |
| 38 | cpus=6 |
Javi Merino | 0302ef7 | 2015-03-27 19:27:11 +0000 | [diff] [blame] | 39 | 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 Singh | 77d1677 | 2015-01-21 18:07:15 +0000 | [diff] [blame] | 48 | 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 Singh | a204044 | 2015-02-23 12:19:18 +0000 | [diff] [blame] | 62 | l.view(test=True) |
Kapileshwar Singh | 77d1677 | 2015-01-21 18:07:15 +0000 | [diff] [blame] | 63 | |
| 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 |
| 70 | cpus=6 |
Javi Merino | 0302ef7 | 2015-03-27 19:27:11 +0000 | [diff] [blame] | 71 | 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 Singh | 77d1677 | 2015-01-21 18:07:15 +0000 | [diff] [blame] | 81 | 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 Singh | a204044 | 2015-02-23 12:19:18 +0000 | [diff] [blame] | 96 | l.view(test=True) |