Lines Matching defs:thread

172 	ExtendedThreadSchedulingState(Model::Thread* thread)
174 Model::ThreadSchedulingState(thread),
293 Model::ThreadSchedulingState* thread
295 return thread != NULL
296 ? static_cast<ExtendedThreadSchedulingState*>(thread) : NULL;
301 virtual void DeleteThread(Model::ThreadSchedulingState* thread)
303 delete static_cast<ExtendedThreadSchedulingState*>(thread);
738 for (int32 i = 0; Model::Thread* thread = fModel->ThreadAt(i); i++) {
740 = fState->LookupThread(thread->ID());
757 fState->LookupThread(event->thread)->AddEvent(header);
765 fState->LookupThread(event->thread)->AddEvent(header);
773 fState->LookupThread(event->thread)->AddEvent(header);
775 if (event->thread != event->previous_thread) {
786 fState->LookupThread(event->thread)->AddEvent(header);
794 fState->LookupThread(event->thread)->AddEvent(header);
803 // transfer the events arrays from the scheduling states to the thread
805 for (int32 i = 0; Model::Thread* thread = fModel->ThreadAt(i); i++) {
807 = fState->LookupThread(thread->ID());
808 thread->SetEvents(state->Events(), state->CountEvents());
819 for (int32 i = 0; Model::Thread* thread = fModel->ThreadAt(i); i++) {
821 = fState->LookupThread(thread->ID());
827 _SetThreadIORequests(thread, requests, requestCount);
835 ModelLoader::_SetThreadIORequests(Model::Thread* thread,
875 thread->SetIORequests(requests, requestCount);
876 thread->SetIOs(ioCount, ioTime);
917 ExtendedThreadSchedulingState* thread = fState->LookupThread(event->thread);
918 if (thread == NULL) {
919 printf("Warning: Removed event for unknown thread: %" B_PRId32 "\n",
920 event->thread);
921 thread = _AddUnknownThread(event->thread);
924 thread->thread->SetDeletionTime(fState->LastEventTime());
925 thread->IncrementEventCount();
935 ExtendedThreadSchedulingState* thread = fState->LookupThread(event->thread);
936 if (thread == NULL) {
937 printf("Warning: Schedule event for unknown thread: %" B_PRId32 "\n",
938 event->thread);
939 thread = _AddUnknownThread(event->thread);
943 nanotime_t diffTime = fState->LastEventTime() - thread->lastTime;
945 if (thread->state == READY) {
946 // thread scheduled after having been woken up
947 thread->thread->AddLatency(diffTime);
948 } else if (thread->state == PREEMPTED) {
949 // thread scheduled after having been preempted before
950 thread->thread->AddRerun(diffTime);
953 if (thread->state == STILL_RUNNING) {
955 thread->state = RUNNING;
958 if (thread->state != RUNNING) {
959 thread->lastTime = fState->LastEventTime();
960 thread->state = RUNNING;
963 thread->IncrementEventCount();
965 // unscheduled thread
967 if (event->thread == event->previous_thread)
970 thread = fState->LookupThread(event->previous_thread);
971 if (thread == NULL) {
972 printf("Warning: Schedule event for unknown previous thread: %" B_PRId32
974 thread = _AddUnknownThread(event->previous_thread);
977 diffTime = fState->LastEventTime() - thread->lastTime;
979 if (thread->state == STILL_RUNNING) {
980 // thread preempted
981 thread->thread->AddPreemption(diffTime);
982 thread->thread->AddRun(diffTime);
983 if (thread->priority == 0)
986 thread->lastTime = fState->LastEventTime();
987 thread->state = PREEMPTED;
988 } else if (thread->state == RUNNING) {
989 // thread starts waiting (it hadn't been added to the run
991 thread->thread->AddRun(diffTime);
992 if (thread->priority == 0)
1012 _AddThreadWaitObject(thread,
1016 thread->lastTime = fState->LastEventTime();
1017 thread->state = WAITING;
1018 } else if (thread->state == UNKNOWN) {
1022 thread->lastTime = fState->LastEventTime();
1023 thread->state = WAITING;
1025 thread->lastTime = fState->LastEventTime();
1026 thread->state = PREEMPTED;
1030 thread->IncrementEventCount();
1040 ExtendedThreadSchedulingState* thread = fState->LookupThread(event->thread);
1041 if (thread == NULL) {
1042 printf("Warning: Enqueued in run queue event for unknown thread: %"
1043 B_PRId32 "\n", event->thread);
1044 thread = _AddUnknownThread(event->thread);
1047 if (thread->state == RUNNING || thread->state == STILL_RUNNING) {
1049 // is done by the scheduler, if the thread remains ready.
1050 thread->state = STILL_RUNNING;
1053 nanotime_t diffTime = fState->LastEventTime() - thread->lastTime;
1054 if (thread->waitObject != NULL) {
1055 thread->waitObject->AddWait(diffTime);
1056 thread->waitObject = NULL;
1057 thread->thread->AddWait(diffTime);
1058 } else if (thread->state != UNKNOWN)
1059 thread->thread->AddUnspecifiedWait(diffTime);
1061 thread->lastTime = fState->LastEventTime();
1062 thread->state = READY;
1065 thread->priority = event->priority;
1067 thread->IncrementEventCount();
1077 ExtendedThreadSchedulingState* thread = fState->LookupThread(event->thread);
1078 if (thread == NULL) {
1079 printf("Warning: Removed from run queue event for unknown thread: "
1080 "%" B_PRId32 "\n", event->thread);
1081 thread = _AddUnknownThread(event->thread);
1084 // This really only happens when the thread priority is changed
1085 // while the thread is ready.
1087 nanotime_t diffTime = fState->LastEventTime() - thread->lastTime;
1088 if (thread->state == RUNNING) {
1090 thread->thread->AddRun(diffTime);
1091 if (thread->priority == 0)
1093 } else if (thread->state == READY || thread->state == PREEMPTED) {
1096 thread->thread->AddUnspecifiedWait(diffTime);
1099 thread->lastTime = fState->LastEventTime();
1100 thread->state = WAITING;
1102 thread->IncrementEventCount();
1139 ExtendedThreadSchedulingState* thread = fState->LookupThread(event->thread);
1140 if (thread == NULL) {
1141 printf("Warning: I/O request for unknown thread %" B_PRId32 "\n",
1142 event->thread);
1143 thread = _AddUnknownThread(event->thread);
1158 thread->AddIORequest(request);
1172 fState->LookupThread(request->scheduledEvent->thread)
1218 // do we know the thread already?
1219 ExtendedThreadSchedulingState* info = fState->LookupThread(event->thread);
1221 printf("Warning: Duplicate thread added event for thread %" B_PRId32
1222 "\n", event->thread);
1226 // add the thread to the model
1227 Model::Thread* thread = fModel->AddThread(event, fState->LastEventTime());
1228 if (thread == NULL)
1232 info = new(std::nothrow) ExtendedThreadSchedulingState(thread);
1237 // struct. For now guess at least whether this is an idle thread.
1238 if (strncmp(event->name, "idle thread", strlen("idle thread")) == 0)
1252 // create a dummy "add thread" event
1265 event->thread = threadID;
1266 snprintf(event->name, sizeof(event->name), "unknown thread %" B_PRId32,
1269 // add the thread to the model
1308 ModelLoader::_AddThreadWaitObject(ExtendedThreadSchedulingState* thread,
1323 = fModel->ThreadWaitObjectGroupFor(thread->ID(), type, object);
1328 = fModel->AddThreadWaitObject(thread->ID(), waitObject,
1334 thread->waitObject = threadWaitObjectGroup->MostRecentThreadWaitObject();