Index: embios/trunk/tools/embios.py |
— | — | @@ -504,9 +504,8 @@ |
505 | 505 | coreload = 1 - (threadload + idleload)
|
506 | 506 | cpuload = threadload + coreload
|
507 | 507 | self.logger.info("The device has " + str(len(threads)) + " running threads.\n" + \
|
508 | | - "It is running at " + str(cpuload * 100) + "% cpu load with a core load of " + \
|
509 | | - str(coreload * 100) + "%, a thread load of " + str(threadload * 100) + "% " + \
|
510 | | - "and an idle load of " + str(idleload * 100) + "%\n\n")
|
| 508 | + "It is running at " + str(cpuload * 100) + "% cpu load with a kernel load of " + \
|
| 509 | + str(coreload * 100) + "% and a user load of " + str(threadload * 100) + "%\n\n")
|
511 | 510 | self.logger.info("Thread dump:\n")
|
512 | 511 | for thread in threads:
|
513 | 512 | self.logger.info(" "+thread.name+":\n")
|
Index: embios/trunk/arm/contextswitch.S |
— | — | @@ -78,6 +78,7 @@ |
79 | 79 | mov r1, lr
|
80 | 80 | msr cpsr_c, #0xd2
|
81 | 81 | stmia r5, {r0-r4}
|
| 82 | + bl scheduler_pause_accounting
|
82 | 83 | adr lr, resume_thread
|
83 | 84 | mov r0, #-1
|
84 | 85 | b scheduler_switch
|
— | — | @@ -110,6 +111,7 @@ |
111 | 112 | sub r3, lr, #4
|
112 | 113 | enter_irqhandler:
|
113 | 114 | stmia r12, {r0-r4}
|
| 115 | + bl scheduler_pause_accounting
|
114 | 116 | bl irqhandler
|
115 | 117 | @ fallthrough
|
116 | 118 |
|
— | — | @@ -116,6 +118,7 @@ |
117 | 119 | .global resume_thread
|
118 | 120 | .type resume_thread, %function
|
119 | 121 | resume_thread:
|
| 122 | + bl scheduler_resume_accounting
|
120 | 123 | ldr lr, =current_thread
|
121 | 124 | ldr lr, [lr]
|
122 | 125 | mov r0, lr
|
Index: embios/trunk/thread.c |
— | — | @@ -242,6 +242,18 @@ |
243 | 243 | return old;
|
244 | 244 | }
|
245 | 245 |
|
| 246 | +void scheduler_pause_accounting()
|
| 247 | +{
|
| 248 | + uint32_t usec = USEC_TIMER;
|
| 249 | + current_thread->cputime_total += usec - current_thread->startusec;
|
| 250 | + current_thread->cputime_current += usec - current_thread->startusec;
|
| 251 | +}
|
| 252 | +
|
| 253 | +void scheduler_resume_accounting()
|
| 254 | +{
|
| 255 | + current_thread->startusec = USEC_TIMER;
|
| 256 | +}
|
| 257 | +
|
246 | 258 | void scheduler_switch(int thread)
|
247 | 259 | {
|
248 | 260 | int i;
|
— | — | @@ -248,8 +260,6 @@ |
249 | 261 | uint32_t score, best;
|
250 | 262 | uint32_t usec = USEC_TIMER;
|
251 | 263 | if (current_thread->state == THREAD_RUNNING) current_thread->state = THREAD_READY;
|
252 | | - current_thread->cputime_total += usec - current_thread->startusec;
|
253 | | - current_thread->cputime_current += usec - current_thread->startusec;
|
254 | 264 | if ((int)current_thread->stack != -1 && *current_thread->stack != 0xaffebeaf)
|
255 | 265 | {
|
256 | 266 | for (i = 0; i < MAX_THREADS; i++)
|
— | — | @@ -310,7 +320,6 @@ |
311 | 321 |
|
312 | 322 | current_thread = &scheduler_threads[thread];
|
313 | 323 | current_thread->state = THREAD_RUNNING;
|
314 | | - current_thread->startusec = USEC_TIMER;
|
315 | 324 | }
|
316 | 325 |
|
317 | 326 | int thread_create(const char* name, const void* code, void* stack,
|
Index: embios/trunk/thread.h |
— | — | @@ -108,6 +108,8 @@ |
109 | 109 |
|
110 | 110 |
|
111 | 111 | void scheduler_init() INITCODE_ATTR;
|
| 112 | +void scheduler_pause_accounting() ICODE_ATTR;
|
| 113 | +void scheduler_resume_accounting() ICODE_ATTR;
|
112 | 114 | void scheduler_switch(int thread) ICODE_ATTR;
|
113 | 115 | bool scheduler_freeze(bool value);
|
114 | 116 | int thread_create(const char* name, const void* code, void* stack,
|