Lines Matching defs:thread

162 	thread_id				thread;
166 ThreadWaitObjectKey(thread_id thread, uint32 type, void* object)
168 thread(thread),
176 return thread ^ type ^ (uint32)(addr_t)object;
182 ThreadWaitObject(thread_id thread, WaitObject* waitObject)
184 this->thread = thread;
193 return thread ^ wait_object->type ^ (uint32)(addr_t)wait_object->object;
202 return key->thread == thread && key->type == wait_object->type
294 ThreadWaitObject* ThreadWaitObjectFor(thread_id thread, uint32 type,
298 Lookup(ThreadWaitObjectKey(thread, type, object)));
303 Thread* thread = ThreadFor(id);
304 if (thread == NULL) {
309 thread = new(memory) Thread(id);
310 Insert(thread);
314 if (name != NULL && thread->name[0] == '\0')
315 strlcpy(thread->name, name, sizeof(thread->name));
387 status_t AddThreadWaitObject(Thread* thread, uint32 type, void* object)
395 ThreadWaitObject* threadWaitObject = ThreadWaitObjectFor(thread->id,
406 threadWaitObject = new(memory) ThreadWaitObject(thread->id,
411 threadWaitObject->next_in_list = thread->wait_objects;
412 thread->wait_objects = threadWaitObject;
415 thread->waitObject = threadWaitObject;
441 // allocate the thread array
454 Thread* thread = dynamic_cast<Thread*>(object);
455 if (thread != NULL) {
456 threads[index++] = thread;
643 // scheduled thread
644 Thread* thread = manager.ThreadFor(entry->ThreadID());
646 bigtime_t diffTime = entry->Time() - thread->lastTime;
648 if (thread->state == READY) {
649 // thread scheduled after having been woken up
650 thread->latencies++;
651 thread->total_latency += diffTime;
652 if (thread->min_latency < 0 || diffTime < thread->min_latency)
653 thread->min_latency = diffTime;
654 if (diffTime > thread->max_latency)
655 thread->max_latency = diffTime;
656 } else if (thread->state == PREEMPTED) {
657 // thread scheduled after having been preempted before
658 thread->reruns++;
659 thread->total_rerun_time += diffTime;
660 if (thread->min_rerun_time < 0
661 || diffTime < thread->min_rerun_time) {
662 thread->min_rerun_time = diffTime;
664 if (diffTime > thread->max_rerun_time)
665 thread->max_rerun_time = diffTime;
668 if (thread->state == STILL_RUNNING) {
670 thread->state = RUNNING;
673 if (thread->state != RUNNING) {
674 thread->lastTime = entry->Time();
675 thread->state = RUNNING;
678 // unscheduled thread
683 thread = manager.ThreadFor(entry->PreviousThreadID());
685 diffTime = entry->Time() - thread->lastTime;
687 if (thread->state == STILL_RUNNING) {
688 // thread preempted
689 thread->runs++;
690 thread->preemptions++;
691 thread->total_run_time += diffTime;
692 if (thread->min_run_time < 0 || diffTime < thread->min_run_time)
693 thread->min_run_time = diffTime;
694 if (diffTime > thread->max_run_time)
695 thread->max_run_time = diffTime;
697 thread->lastTime = entry->Time();
698 thread->state = PREEMPTED;
699 } else if (thread->state == RUNNING) {
700 // thread starts waiting (it hadn't been added to the run
702 thread->runs++;
703 thread->total_run_time += diffTime;
704 if (thread->min_run_time < 0 || diffTime < thread->min_run_time)
705 thread->min_run_time = diffTime;
706 if (diffTime > thread->max_run_time)
707 thread->max_run_time = diffTime;
725 status_t error = manager.AddThreadWaitObject(thread,
731 thread->lastTime = entry->Time();
732 thread->state = WAITING;
733 } else if (thread->state == UNKNOWN) {
737 thread->lastTime = entry->Time();
738 thread->state = WAITING;
740 thread->lastTime = entry->Time();
741 thread->state = PREEMPTED;
746 // thread enqueued in run queue
748 Thread* thread = manager.ThreadFor(entry->ThreadID());
750 if (thread->state == RUNNING || thread->state == STILL_RUNNING) {
752 // is done by the scheduler, if the thread remains ready.
753 thread->state = STILL_RUNNING;
756 bigtime_t diffTime = entry->Time() - thread->lastTime;
757 if (thread->waitObject != NULL) {
758 thread->waitObject->wait_time += diffTime;
759 thread->waitObject->waits++;
760 thread->waitObject = NULL;
761 } else if (thread->state != UNKNOWN)
762 thread->unspecified_wait_time += diffTime;
764 thread->lastTime = entry->Time();
765 thread->state = READY;
768 // thread removed from run queue
770 Thread* thread = manager.ThreadFor(entry->ThreadID());
772 // This really only happens when the thread priority is changed
773 // while the thread is ready.
775 bigtime_t diffTime = entry->Time() - thread->lastTime;
776 if (thread->state == RUNNING) {
778 thread->runs++;
779 thread->total_run_time += diffTime;
780 if (thread->min_run_time < 0 || diffTime < thread->min_run_time)
781 thread->min_run_time = diffTime;
782 if (diffTime > thread->max_run_time)
783 thread->max_run_time = diffTime;
784 } else if (thread->state == READY || thread->state == PREEMPTED) {
787 thread->unspecified_wait_time += diffTime;
790 thread->lastTime = entry->Time();
791 thread->state = WAITING;