Lines Matching refs:thread

146 	void AddState(Model::Thread* thread, nanotime_t time, ThreadState state,
149 DataArray& array = fDataArrays[thread->Index()];
168 void AddIOState(Model::Thread* thread, nanotime_t time, uint32 state)
170 IODataArray& array = fIODataArrays[thread->Index()];
174 void AddRun(Model::Thread* thread, nanotime_t time)
176 AddState(thread, time, RUNNING, NULL);
179 void AddLatency(Model::Thread* thread, nanotime_t time)
181 AddState(thread, time, READY, NULL);
184 void AddPreemption(Model::Thread* thread, nanotime_t time)
186 AddState(thread, time, PREEMPTED, NULL);
189 void AddWait(Model::Thread* thread, nanotime_t time,
192 AddState(thread, time, WAITING, waitObject);
195 void AddUnspecifiedWait(Model::Thread* thread, nanotime_t time)
197 AddState(thread, time, WAITING, NULL);
579 Model::Thread* thread = fModel->ThreadAt(
581 if (thread == NULL)
585 BString name = thread->Name();
586 name << " (" << thread->ID() << ")";
773 Model::Thread* thread;
775 _GetThreadAndTimeAt(point, thread, time);
776 if (thread == NULL)
779 // get the thread's state
786 = fSchedulingData.EventsForThread(thread->Index());
811 // get the thread's I/O state
813 _GetIORequests(thread, time, ioRequests);
836 if (Model::Thread* thread = fModel->ThreadByID(event->thread)) {
837 runningThreads[header->cpu] = thread;
845 text << "Thread: " << thread->Name() << " (" << thread->ID() << ")\n";
905 if (Model::Thread* thread = runningThreads[i])
906 text << thread->Name() << " (" << thread->ID() << ")";
941 Model::Thread* thread = fModel->ThreadAt(
943 if (thread == NULL)
952 = fSchedulingData.EventsForThread(thread->Index());
955 //printf("drawing events for thread %ld: %ld events\n", thread->Index(), eventCount);
986 = fSchedulingData.IOEventsForThread(thread->Index());
1062 // add the initial thread states to the scheduling data
1071 fSchedulingData.AddRun(threadState->thread,
1075 fSchedulingData.AddPreemption(threadState->thread,
1079 fSchedulingData.AddLatency(threadState->thread,
1091 fSchedulingData.AddWait(threadState->thread,
1130 // process each thread's I/O events
1134 Model::Thread* thread = fModel->ThreadAt(i);
1135 Model::IORequest** requests = thread->IORequests();
1136 size_t requestCount = thread->CountIORequests();
1160 _AddThreadIOData(thread, clusterStart, clusterEnd,
1175 _AddThreadIOData(thread, clusterStart, clusterEnd, operations);
1179 void _AddThreadIOData(Model::Thread* thread, nanotime_t startTime,
1184 fSchedulingData.AddIOState(thread, startTime - fModel->BaseTime(),
1210 fSchedulingData.AddIOState(thread,
1213 fSchedulingData.AddIOState(thread,
1224 fSchedulingData.AddIOState(thread, clusterStart - fModel->BaseTime(),
1226 fSchedulingData.AddIOState(thread, clusterEnd - fModel->BaseTime(),
1230 fSchedulingData.AddIOState(thread, endTime - fModel->BaseTime(),
1255 void _GetIORequests(Model::Thread* thread, nanotime_t time,
1260 = fSchedulingData.IOEventsForThread(thread->Index());
1303 Model::IORequest** requests = thread->IORequests();
1304 size_t requestCount = thread->CountIORequests();
1305 size_t index = thread->ClosestRequestStartIndex(startTime);
1412 //printf(" thread added: %ld\n", event->thread);
1413 // do we know the thread already?
1414 Model::ThreadSchedulingState* info = fState.LookupThread(event->thread);
1420 Model::Thread* thread = fModel->ThreadByID(event->thread);
1421 if (thread == NULL)
1425 info = new(std::nothrow) Model::ThreadSchedulingState(thread);
1434 //printf(" thread removed: %ld\n", event->thread);
1435 // Model::ThreadSchedulingState* thread = fState.LookupThread(
1436 // event->thread);
1437 // if (thread != NULL) {
1438 // fState.RemoveThread(thread);
1439 // delete thread;
1440 //// TODO: The thread will be unscheduled in a moment and cause a warning! So
1449 Model::ThreadSchedulingState* thread = fState.LookupThread(
1450 event->thread);
1451 if (thread == NULL) {
1452 printf("Schedule event for unknown thread: %" B_PRId32 "\n",
1453 event->thread);
1457 thread->lastTime = fState.LastEventTime();
1458 thread->state = RUNNING;
1459 fSchedulingData.AddRun(thread->thread, fState.LastEventTime());
1461 // unscheduled thread
1463 if (event->thread == event->previous_thread)
1466 thread = fState.LookupThread(event->previous_thread);
1467 if (thread == NULL) {
1468 printf("Schedule event for unknown previous thread: %" B_PRId32
1473 if (thread->state == STILL_RUNNING) {
1474 // thread preempted
1475 fSchedulingData.AddPreemption(thread->thread,
1478 thread->lastTime = fState.LastEventTime();
1479 thread->state = PREEMPTED;
1480 } else if (thread->state == RUNNING) {
1481 // thread starts waiting (it hadn't been added to the run
1500 fSchedulingData.AddWait(thread->thread, fState.LastEventTime(),
1501 fModel->ThreadWaitObjectGroupFor(thread->ID(),
1504 fSchedulingData.AddUnspecifiedWait(thread->thread,
1508 thread->lastTime = fState.LastEventTime();
1509 thread->state = WAITING;
1510 } else if (thread->state == UNKNOWN) {
1514 fSchedulingData.AddWait(thread->thread, fState.LastEventTime(),
1516 thread->lastTime = fState.LastEventTime();
1517 thread->state = WAITING;
1519 thread->lastTime = fState.LastEventTime();
1520 thread->state = PREEMPTED;
1521 fSchedulingData.AddPreemption(thread->thread,
1531 Model::ThreadSchedulingState* thread = fState.LookupThread(
1532 event->thread);
1533 if (thread == NULL) {
1534 printf("Enqueued in run queue event for unknown thread: %" B_PRId32
1535 "\n", event->thread);
1539 if (thread->state == RUNNING || thread->state == STILL_RUNNING) {
1541 // is done by the scheduler, if the thread remains ready.
1542 thread->state = STILL_RUNNING;
1545 nanotime_t diffTime = fState.LastEventTime() - thread->lastTime;
1546 if (thread->waitObject != NULL) {
1547 thread->waitObject->AddWait(diffTime);
1548 thread->waitObject = NULL;
1551 fSchedulingData.AddLatency(thread->thread, fState.LastEventTime());
1552 thread->lastTime = fState.LastEventTime();
1553 thread->state = READY;
1561 Model::ThreadSchedulingState* thread = fState.LookupThread(
1562 event->thread);
1563 if (thread == NULL) {
1564 printf("Removed from run queue event for unknown thread: %" B_PRId32
1565 "\n", event->thread);
1569 // This really only happens when the thread priority is changed
1570 // while the thread is ready.
1571 fSchedulingData.AddUnspecifiedWait(thread->thread,
1574 thread->lastTime = fState.LastEventTime();
1575 thread->state = WAITING;