Rev 1760 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 1760 | Rev 1780 | ||
|---|---|---|---|
| Line 55... | Line 55... | ||
| 55 | #include <sysinfo/sysinfo.h> |
55 | #include <sysinfo/sysinfo.h> |
| 56 | #include <arch/barrier.h> |
56 | #include <arch/barrier.h> |
| 57 | 57 | ||
| 58 | /* Pointers to public variables with time */ |
58 | /* Pointers to public variables with time */ |
| 59 | struct ptime { |
59 | struct ptime { |
| 60 | __native seconds1; |
60 | unative_t seconds1; |
| 61 | __native useconds; |
61 | unative_t useconds; |
| 62 | __native seconds2; |
62 | unative_t seconds2; |
| 63 | }; |
63 | }; |
| 64 | struct ptime *public_time; |
64 | struct ptime *public_time; |
| 65 | /* Variable holding fragment of second, so that we would update |
65 | /* Variable holding fragment of second, so that we would update |
| 66 | * seconds correctly |
66 | * seconds correctly |
| 67 | */ |
67 | */ |
| 68 | static __native secfrag = 0; |
68 | static unative_t secfrag = 0; |
| 69 | 69 | ||
| 70 | /** Initialize realtime clock counter |
70 | /** Initialize realtime clock counter |
| 71 | * |
71 | * |
| 72 | * The applications (and sometimes kernel) need to access accurate |
72 | * The applications (and sometimes kernel) need to access accurate |
| 73 | * information about realtime data. We allocate 1 page with these |
73 | * information about realtime data. We allocate 1 page with these |
| Line 88... | Line 88... | ||
| 88 | /* TODO: We would need some arch dependent settings here */ |
88 | /* TODO: We would need some arch dependent settings here */ |
| 89 | public_time->seconds1 = 0; |
89 | public_time->seconds1 = 0; |
| 90 | public_time->seconds2 = 0; |
90 | public_time->seconds2 = 0; |
| 91 | public_time->useconds = 0; |
91 | public_time->useconds = 0; |
| 92 | 92 | ||
| 93 | sysinfo_set_item_val("clock.faddr", NULL, (__native)faddr); |
93 | sysinfo_set_item_val("clock.faddr", NULL, (unative_t)faddr); |
| 94 | } |
94 | } |
| 95 | 95 | ||
| 96 | 96 | ||
| 97 | /** Update public counters |
97 | /** Update public counters |
| 98 | * |
98 | * |
| Line 163... | Line 163... | ||
| 163 | /* |
163 | /* |
| 164 | * Do CPU usage accounting and find out whether to preempt THREAD. |
164 | * Do CPU usage accounting and find out whether to preempt THREAD. |
| 165 | */ |
165 | */ |
| 166 | 166 | ||
| 167 | if (THREAD) { |
167 | if (THREAD) { |
| 168 | __u64 ticks; |
168 | uint64_t ticks; |
| 169 | 169 | ||
| 170 | spinlock_lock(&CPU->lock); |
170 | spinlock_lock(&CPU->lock); |
| 171 | CPU->needs_relink += 1 + missed_clock_ticks; |
171 | CPU->needs_relink += 1 + missed_clock_ticks; |
| 172 | spinlock_unlock(&CPU->lock); |
172 | spinlock_unlock(&CPU->lock); |
| 173 | 173 | ||