source: rtems-tools/tools/gdb/python/supercore.py @ 7a415d4

4.104.115
Last change on this file since 7a415d4 was a245635, checked in by Dhananjay Balan <mb.dhananjay@…>, on 08/24/13 at 09:38:16

Add subcommand

rtems tod - prints the time of day.

  • Property mode set to 100644
File size: 1.7 KB
Line 
1#
2# RTEMS Supercore Objects
3#
4
5import threads
6import helper
7
8class time_of_day:
9    '''Manage time of day object'''
10
11    def __init__(self, tod):
12        self.tod = tod
13
14    def now(self):
15        return self.tod['now']
16
17    def timer(self):
18        return self.tod['uptime']
19
20    def is_set(self):
21        return bool(self.tod['is_set'])
22
23    def show(self):
24        print ' Time Of Day'
25
26        if not self.is_set():
27            print ' Application has not set a TOD'
28
29        print '      Now:', self.now()
30        print '   Uptime:', self.timer()
31
32
33class message_queue:
34    '''Manage a Supercore message_queue'''
35
36    def __init__(self, message_queue):
37        self.queue = message_queue
38        self.wait_queue = threads.queue(self.queue['Wait_queue'])
39        # ToDo: self.attribute =''
40        # self.buffer
41
42    def show(self):
43        helper.tasks_printer_routine(self.wait_queue)
44
45class barrier_attributes:
46    '''supercore bbarrier attribute'''
47
48    def __init__(self,attr):
49        self.attr = attr
50
51    def max_count(self):
52        c = self.attr['maximum_count']
53        return c
54
55    def discipline(self):
56        d = self.attr['discipline']
57        return d
58
59class barrier_control:
60    '''Manage a Supercore barrier'''
61
62    def __init__(self, barrier):
63        self.barrier = barrier
64        self.wait_queue = threads.queue(self.barrier['Wait_queue'])
65        self.attr = barrier_attributes(self.barrier['Attributes'])
66
67    def waiting_threads(self):
68        wt = self.barrier['number_of_waiting_threads']
69        return wt
70
71    def max_count(self):
72        return self.attr.max_count()
73
74    def discipline(self):
75        return self.attr.discipline()
76
77    def tasks(self):
78        return self.wait_queue
Note: See TracBrowser for help on using the repository browser.