* Also compute the threads' total waits/wait time.
* Added wait times to threads table and general thread page. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30408 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -129,6 +129,8 @@ Model::Thread::Thread(Team* team, const system_profiler_thread_added* event,
|
||||
fTotalRerunTime(0),
|
||||
fMinRerunTime(-1),
|
||||
fMaxRerunTime(-1),
|
||||
fWaits(0),
|
||||
fTotalWaitTime(0),
|
||||
fUnspecifiedWaitTime(0),
|
||||
fPreemptions(0),
|
||||
fWaitObjectGroups(20, true)
|
||||
@@ -199,6 +201,14 @@ Model::Thread::AddPreemption(bigtime_t runTime)
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
Model::Thread::AddWait(bigtime_t waitTime)
|
||||
{
|
||||
fWaits++;
|
||||
fTotalWaitTime += waitTime;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
Model::Thread::AddUnspecifiedWait(bigtime_t waitTime)
|
||||
{
|
||||
|
||||
@@ -230,6 +230,9 @@ public:
|
||||
inline int64 Latencies() const;
|
||||
inline bigtime_t TotalLatency() const;
|
||||
inline int64 Preemptions() const;
|
||||
inline int64 Waits() const;
|
||||
inline bigtime_t TotalWaitTime() const;
|
||||
inline bigtime_t UnspecifiedWaitTime() const;
|
||||
|
||||
ThreadWaitObjectGroup* ThreadWaitObjectGroupFor(uint32 type,
|
||||
addr_t object) const;
|
||||
@@ -240,6 +243,7 @@ public:
|
||||
void AddRerun(bigtime_t runTime);
|
||||
void AddLatency(bigtime_t latency);
|
||||
void AddPreemption(bigtime_t runTime);
|
||||
void AddWait(bigtime_t waitTime);
|
||||
void AddUnspecifiedWait(bigtime_t waitTime);
|
||||
|
||||
ThreadWaitObject* AddThreadWaitObject(WaitObject* waitObject,
|
||||
@@ -281,6 +285,8 @@ private:
|
||||
bigtime_t fMinRerunTime;
|
||||
bigtime_t fMaxRerunTime;
|
||||
|
||||
int64 fWaits;
|
||||
bigtime_t fTotalWaitTime;
|
||||
bigtime_t fUnspecifiedWaitTime;
|
||||
|
||||
int64 fPreemptions;
|
||||
@@ -593,6 +599,27 @@ Model::Thread::Preemptions() const
|
||||
}
|
||||
|
||||
|
||||
int64
|
||||
Model::Thread::Waits() const
|
||||
{
|
||||
return fWaits;
|
||||
}
|
||||
|
||||
|
||||
bigtime_t
|
||||
Model::Thread::TotalWaitTime() const
|
||||
{
|
||||
return fTotalWaitTime;
|
||||
}
|
||||
|
||||
|
||||
bigtime_t
|
||||
Model::Thread::UnspecifiedWaitTime() const
|
||||
{
|
||||
return fUnspecifiedWaitTime;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
Model::Thread::SetDeletionTime(bigtime_t time)
|
||||
{
|
||||
|
||||
@@ -552,6 +552,7 @@ ModelLoader::_HandleThreadEnqueuedInRunQueue(
|
||||
if (thread->waitObject != NULL) {
|
||||
thread->waitObject->AddWait(diffTime);
|
||||
thread->waitObject = NULL;
|
||||
thread->thread->AddWait(diffTime);
|
||||
} else if (thread->state != UNKNOWN)
|
||||
thread->thread->AddUnspecifiedWait(diffTime);
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ public:
|
||||
|
||||
virtual int32 CountColumns() const
|
||||
{
|
||||
return 11;
|
||||
return 14;
|
||||
}
|
||||
|
||||
virtual int32 CountRows() const
|
||||
@@ -79,6 +79,15 @@ public:
|
||||
case 10:
|
||||
value.SetTo(thread->TotalRerunTime());
|
||||
return true;
|
||||
case 11:
|
||||
value.SetTo(thread->Waits());
|
||||
return true;
|
||||
case 12:
|
||||
value.SetTo(thread->TotalWaitTime());
|
||||
return true;
|
||||
case 13:
|
||||
value.SetTo(thread->UnspecifiedWaitTime());
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
@@ -128,6 +137,12 @@ MainWindow::ThreadsPage::ThreadsPage(MainWindow* parent)
|
||||
1000, B_TRUNCATE_END, B_ALIGN_RIGHT));
|
||||
fThreadsTable->AddColumn(new BigtimeTableColumn(10, "Preemption Time", 80,
|
||||
20, 1000, false, B_TRUNCATE_END, B_ALIGN_RIGHT));
|
||||
fThreadsTable->AddColumn(new Int64TableColumn(11, "Waits", 80, 20,
|
||||
1000, B_TRUNCATE_END, B_ALIGN_RIGHT));
|
||||
fThreadsTable->AddColumn(new BigtimeTableColumn(12, "Wait Time", 80,
|
||||
20, 1000, false, B_TRUNCATE_END, B_ALIGN_RIGHT));
|
||||
fThreadsTable->AddColumn(new BigtimeTableColumn(13, "Unspecified Time", 80,
|
||||
20, 1000, false, B_TRUNCATE_END, B_ALIGN_RIGHT));
|
||||
|
||||
fThreadsTable->AddTableListener(this);
|
||||
}
|
||||
|
||||
@@ -19,7 +19,8 @@ ThreadWindow::GeneralPage::GeneralPage()
|
||||
fRunTimeView(NULL),
|
||||
fWaitTimeView(NULL),
|
||||
fLatencyView(NULL),
|
||||
fPreemptionView(NULL)
|
||||
fPreemptionView(NULL),
|
||||
fUnspecifiedTimeView(NULL)
|
||||
{
|
||||
fThreadNameView = AddDataView("Name:");
|
||||
fThreadIDView = AddDataView("ID:");
|
||||
@@ -28,6 +29,7 @@ ThreadWindow::GeneralPage::GeneralPage()
|
||||
fWaitTimeView = AddDataView("Wait Time:");
|
||||
fLatencyView = AddDataView("Latencies:");
|
||||
fPreemptionView = AddDataView("Preemptions:");
|
||||
fUnspecifiedTimeView = AddDataView("Unspecified Time:");
|
||||
}
|
||||
|
||||
|
||||
@@ -63,11 +65,9 @@ ThreadWindow::GeneralPage::SetModel(Model* model, Model::Thread* thread)
|
||||
fRunTimeView->SetText(buffer);
|
||||
|
||||
// wait time
|
||||
fWaitTimeView->SetText("");
|
||||
// TODO:...
|
||||
// snprintf(buffer, sizeof(buffer), "%lld μs (%lld)",
|
||||
// fThread->TotalRunTime(), fThread->Runs());
|
||||
// fWaitTimeView->SetText(buffer);
|
||||
snprintf(buffer, sizeof(buffer), "%lld μs (%lld)",
|
||||
fThread->TotalWaitTime(), fThread->Waits());
|
||||
fWaitTimeView->SetText(buffer);
|
||||
|
||||
// latencies
|
||||
snprintf(buffer, sizeof(buffer), "%lld μs (%lld)",
|
||||
@@ -78,6 +78,11 @@ ThreadWindow::GeneralPage::SetModel(Model* model, Model::Thread* thread)
|
||||
snprintf(buffer, sizeof(buffer), "%lld μs (%lld)",
|
||||
fThread->TotalRerunTime(), fThread->Preemptions());
|
||||
fPreemptionView->SetText(buffer);
|
||||
|
||||
// unspecified time
|
||||
snprintf(buffer, sizeof(buffer), "%lld μs",
|
||||
fThread->UnspecifiedWaitTime());
|
||||
fUnspecifiedTimeView->SetText(buffer);
|
||||
} else {
|
||||
fThreadNameView->SetText("");
|
||||
fThreadIDView->SetText("");
|
||||
@@ -86,5 +91,6 @@ ThreadWindow::GeneralPage::SetModel(Model* model, Model::Thread* thread)
|
||||
fWaitTimeView->SetText("");
|
||||
fLatencyView->SetText("");
|
||||
fPreemptionView->SetText("");
|
||||
fUnspecifiedTimeView->SetText("");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,6 +29,7 @@ private:
|
||||
TextDataView* fWaitTimeView;
|
||||
TextDataView* fLatencyView;
|
||||
TextDataView* fPreemptionView;
|
||||
TextDataView* fUnspecifiedTimeView;
|
||||
};
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user