Changeset 0313ff0 in mainline for kernel/generic/src/proc/task.c
- Timestamp:
- 2006-12-14T12:35:57Z (18 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- def5207
- Parents:
- cd896e2
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/generic/src/proc/task.c
rcd896e2 r0313ff0 120 120 ta->capabilities = 0; 121 121 ta->accept_new_threads = true; 122 ta->cycles = 0; 122 123 123 124 ipc_answerbox_init(&ta->answerbox); … … 267 268 } 268 269 270 /** Get accounting data of given task. 271 * 272 * Note that task_lock on @t must be already held and 273 * interrupts must be already disabled. 274 * 275 * @param t Pointer to thread. 276 * 277 */ 278 uint64_t task_get_accounting(task_t *t) 279 { 280 /* Accumulated value of task */ 281 uint64_t ret = t->cycles; 282 283 /* Current values of threads */ 284 link_t *cur; 285 for (cur = t->th_head.next; cur != &t->th_head; cur = cur->next) { 286 thread_t *thr = list_get_instance(cur, thread_t, th_link); 287 288 spinlock_lock(&thr->lock); 289 290 if (thr == THREAD) /* Update accounting of current thread */ 291 thread_update_accounting(); 292 ret += thr->cycles; 293 294 spinlock_unlock(&thr->lock); 295 } 296 297 return ret; 298 } 299 269 300 /** Kill task. 270 301 * … … 345 376 spinlock_lock(&tasks_lock); 346 377 347 printf("taskid name ctx address as active callscallee\n");348 printf("------ ---------- --- ---------- ---------- ---------- -- ------>\n");378 printf("taskid name ctx address as cycles threads calls callee\n"); 379 printf("------ ---------- --- ---------- ---------- ---------- ------- ------ ------>\n"); 349 380 350 381 for (cur = tasks_btree.leaf_head.next; cur != &tasks_btree.leaf_head; cur = cur->next) { … … 360 391 361 392 spinlock_lock(&t->lock); 362 printf("%-6lld %-10s %-3ld %#10zx %#10zx %12zd", t->taskid, t->name, t->context, t, t->as, atomic_get(&t->active_calls)); 393 394 uint64_t cycles = task_get_accounting(t); 395 char suffix; 396 397 if (cycles > 1000000000000000000LL) { 398 cycles = cycles / 1000000000000000000LL; 399 suffix = 'E'; 400 } else if (cycles > 1000000000000LL) { 401 cycles = cycles / 1000000000000LL; 402 suffix = 'T'; 403 } else if (cycles > 1000000LL) { 404 cycles = cycles / 1000000LL; 405 suffix = 'M'; 406 } else 407 suffix = ' '; 408 409 printf("%-6lld %-10s %-3ld %#10zx %#10zx %9llu%c %7zd %6zd", t->taskid, t->name, t->context, t, t->as, cycles, suffix, t->refcount, atomic_get(&t->active_calls)); 363 410 for (j = 0; j < IPC_MAX_PHONES; j++) { 364 411 if (t->phones[j].callee) … … 366 413 } 367 414 printf("\n"); 415 368 416 spinlock_unlock(&t->lock); 369 417 }
Note:
See TracChangeset
for help on using the changeset viewer.