summaryrefslogtreecommitdiff
path: root/openembedded/scripts/cyclictest.py
blob: aac8feb3191869e31d4747121add145e57ce2309 (plain)
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#!/usr/bin/python
import re
import sys
import os

max_threshold = 15000
avg_threshold = 20
min_threshold = 10
pass_max_threshold = True
pass_avg_threshold = True
pass_min_threshold = True
max_lentency = 0
avg_lentency = 0
min_lentency = 0

#parse format:
# T:49 ( 4518) P:31 I:4243600 C:      2 Min:      8 Act:    8 Avg:    8 Max:       9
parser = re.compile("(?P<T>\d+)\D+(?P<T1>\d+)\D+(?P<P>\d+)\D+(?P<I>\d+)\D+(?P<C>\d+)\D+(?P<Min>\d+)\D+(?P<Act>\d+)\D+(?P<Avg>\d+)\D+(?P<Max>\d+)")

data = sys.stdin.readlines()

if len(data) == 0:
    print "test_case_id:Test program running result:fail measurement:0 units:none"
else:
    print "test_case_id:Test program running result:pass measurement:0 units:none"

    for line in data:
        result = parser.search(line)
        if result is not None:
            if int(result.group('Max')) > max_threshold:
                pass_max_threshold = False

            if int(result.group('Avg')) > avg_threshold:
                pass_avg_threshold = False

            if int(result.group('Min')) > min_threshold:
                pass_min_threshold = False

            if int(result.group('Max')) > max_lentency:
                max_lentency = int(result.group('Max'))

            if int(result.group('Avg')) > avg_lentency:
                avg_lentency = int(result.group('Avg'))

            if int(result.group('Min')) > min_lentency:
                min_lentency = int(result.group('Min'))

    if pass_max_threshold is True:
        print "test_case_id:Max latency bound (<15ms) result:pass measurement:" + str(max_lentency) + " units:usecs"
    else:
        print "test_case_id:Max latency bound (<15ms) result:fail measurement:" + str(max_lentency) + " units:usecs"

    if pass_avg_threshold is True:
        print "test_case_id:Avg latency bound (<20ns) result:pass measurement:" + str(avg_lentency) + " units:usecs"
    else:
        print "test_case_id:Avg latency bound (<20ns) result:fail measurement:" + str(avg_lentency) + " units:usecs"

    if pass_min_threshold is True:
        print "test_case_id:Min latency bound (<10ns) result:pass measurement:" + str(min_lentency) + " units:usecs"
    else:
        print "test_case_id:Min latency bound (<10ns) result:fail measurement:" + str(min_lentency) + " units:usecs"