* 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),
|
fTotalRerunTime(0),
|
||||||
fMinRerunTime(-1),
|
fMinRerunTime(-1),
|
||||||
fMaxRerunTime(-1),
|
fMaxRerunTime(-1),
|
||||||
|
fWaits(0),
|
||||||
|
fTotalWaitTime(0),
|
||||||
fUnspecifiedWaitTime(0),
|
fUnspecifiedWaitTime(0),
|
||||||
fPreemptions(0),
|
fPreemptions(0),
|
||||||
fWaitObjectGroups(20, true)
|
fWaitObjectGroups(20, true)
|
||||||
@@ -199,6 +201,14 @@ Model::Thread::AddPreemption(bigtime_t runTime)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
Model::Thread::AddWait(bigtime_t waitTime)
|
||||||
|
{
|
||||||
|
fWaits++;
|
||||||
|
fTotalWaitTime += waitTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
Model::Thread::AddUnspecifiedWait(bigtime_t waitTime)
|
Model::Thread::AddUnspecifiedWait(bigtime_t waitTime)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -230,6 +230,9 @@ public:
|
|||||||
inline int64 Latencies() const;
|
inline int64 Latencies() const;
|
||||||
inline bigtime_t TotalLatency() const;
|
inline bigtime_t TotalLatency() const;
|
||||||
inline int64 Preemptions() const;
|
inline int64 Preemptions() const;
|
||||||
|
inline int64 Waits() const;
|
||||||
|
inline bigtime_t TotalWaitTime() const;
|
||||||
|
inline bigtime_t UnspecifiedWaitTime() const;
|
||||||
|
|
||||||
ThreadWaitObjectGroup* ThreadWaitObjectGroupFor(uint32 type,
|
ThreadWaitObjectGroup* ThreadWaitObjectGroupFor(uint32 type,
|
||||||
addr_t object) const;
|
addr_t object) const;
|
||||||
@@ -240,6 +243,7 @@ public:
|
|||||||
void AddRerun(bigtime_t runTime);
|
void AddRerun(bigtime_t runTime);
|
||||||
void AddLatency(bigtime_t latency);
|
void AddLatency(bigtime_t latency);
|
||||||
void AddPreemption(bigtime_t runTime);
|
void AddPreemption(bigtime_t runTime);
|
||||||
|
void AddWait(bigtime_t waitTime);
|
||||||
void AddUnspecifiedWait(bigtime_t waitTime);
|
void AddUnspecifiedWait(bigtime_t waitTime);
|
||||||
|
|
||||||
ThreadWaitObject* AddThreadWaitObject(WaitObject* waitObject,
|
ThreadWaitObject* AddThreadWaitObject(WaitObject* waitObject,
|
||||||
@@ -281,6 +285,8 @@ private:
|
|||||||
bigtime_t fMinRerunTime;
|
bigtime_t fMinRerunTime;
|
||||||
bigtime_t fMaxRerunTime;
|
bigtime_t fMaxRerunTime;
|
||||||
|
|
||||||
|
int64 fWaits;
|
||||||
|
bigtime_t fTotalWaitTime;
|
||||||
bigtime_t fUnspecifiedWaitTime;
|
bigtime_t fUnspecifiedWaitTime;
|
||||||
|
|
||||||
int64 fPreemptions;
|
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
|
void
|
||||||
Model::Thread::SetDeletionTime(bigtime_t time)
|
Model::Thread::SetDeletionTime(bigtime_t time)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -552,6 +552,7 @@ ModelLoader::_HandleThreadEnqueuedInRunQueue(
|
|||||||
if (thread->waitObject != NULL) {
|
if (thread->waitObject != NULL) {
|
||||||
thread->waitObject->AddWait(diffTime);
|
thread->waitObject->AddWait(diffTime);
|
||||||
thread->waitObject = NULL;
|
thread->waitObject = NULL;
|
||||||
|
thread->thread->AddWait(diffTime);
|
||||||
} else if (thread->state != UNKNOWN)
|
} else if (thread->state != UNKNOWN)
|
||||||
thread->thread->AddUnspecifiedWait(diffTime);
|
thread->thread->AddUnspecifiedWait(diffTime);
|
||||||
|
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ public:
|
|||||||
|
|
||||||
virtual int32 CountColumns() const
|
virtual int32 CountColumns() const
|
||||||
{
|
{
|
||||||
return 11;
|
return 14;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual int32 CountRows() const
|
virtual int32 CountRows() const
|
||||||
@@ -79,6 +79,15 @@ public:
|
|||||||
case 10:
|
case 10:
|
||||||
value.SetTo(thread->TotalRerunTime());
|
value.SetTo(thread->TotalRerunTime());
|
||||||
return true;
|
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:
|
default:
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -128,6 +137,12 @@ MainWindow::ThreadsPage::ThreadsPage(MainWindow* parent)
|
|||||||
1000, B_TRUNCATE_END, B_ALIGN_RIGHT));
|
1000, B_TRUNCATE_END, B_ALIGN_RIGHT));
|
||||||
fThreadsTable->AddColumn(new BigtimeTableColumn(10, "Preemption Time", 80,
|
fThreadsTable->AddColumn(new BigtimeTableColumn(10, "Preemption Time", 80,
|
||||||
20, 1000, false, B_TRUNCATE_END, B_ALIGN_RIGHT));
|
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);
|
fThreadsTable->AddTableListener(this);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,7 +19,8 @@ ThreadWindow::GeneralPage::GeneralPage()
|
|||||||
fRunTimeView(NULL),
|
fRunTimeView(NULL),
|
||||||
fWaitTimeView(NULL),
|
fWaitTimeView(NULL),
|
||||||
fLatencyView(NULL),
|
fLatencyView(NULL),
|
||||||
fPreemptionView(NULL)
|
fPreemptionView(NULL),
|
||||||
|
fUnspecifiedTimeView(NULL)
|
||||||
{
|
{
|
||||||
fThreadNameView = AddDataView("Name:");
|
fThreadNameView = AddDataView("Name:");
|
||||||
fThreadIDView = AddDataView("ID:");
|
fThreadIDView = AddDataView("ID:");
|
||||||
@@ -28,6 +29,7 @@ ThreadWindow::GeneralPage::GeneralPage()
|
|||||||
fWaitTimeView = AddDataView("Wait Time:");
|
fWaitTimeView = AddDataView("Wait Time:");
|
||||||
fLatencyView = AddDataView("Latencies:");
|
fLatencyView = AddDataView("Latencies:");
|
||||||
fPreemptionView = AddDataView("Preemptions:");
|
fPreemptionView = AddDataView("Preemptions:");
|
||||||
|
fUnspecifiedTimeView = AddDataView("Unspecified Time:");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -63,11 +65,9 @@ ThreadWindow::GeneralPage::SetModel(Model* model, Model::Thread* thread)
|
|||||||
fRunTimeView->SetText(buffer);
|
fRunTimeView->SetText(buffer);
|
||||||
|
|
||||||
// wait time
|
// wait time
|
||||||
fWaitTimeView->SetText("");
|
snprintf(buffer, sizeof(buffer), "%lld μs (%lld)",
|
||||||
// TODO:...
|
fThread->TotalWaitTime(), fThread->Waits());
|
||||||
// snprintf(buffer, sizeof(buffer), "%lld μs (%lld)",
|
fWaitTimeView->SetText(buffer);
|
||||||
// fThread->TotalRunTime(), fThread->Runs());
|
|
||||||
// fWaitTimeView->SetText(buffer);
|
|
||||||
|
|
||||||
// latencies
|
// latencies
|
||||||
snprintf(buffer, sizeof(buffer), "%lld μs (%lld)",
|
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)",
|
snprintf(buffer, sizeof(buffer), "%lld μs (%lld)",
|
||||||
fThread->TotalRerunTime(), fThread->Preemptions());
|
fThread->TotalRerunTime(), fThread->Preemptions());
|
||||||
fPreemptionView->SetText(buffer);
|
fPreemptionView->SetText(buffer);
|
||||||
|
|
||||||
|
// unspecified time
|
||||||
|
snprintf(buffer, sizeof(buffer), "%lld μs",
|
||||||
|
fThread->UnspecifiedWaitTime());
|
||||||
|
fUnspecifiedTimeView->SetText(buffer);
|
||||||
} else {
|
} else {
|
||||||
fThreadNameView->SetText("");
|
fThreadNameView->SetText("");
|
||||||
fThreadIDView->SetText("");
|
fThreadIDView->SetText("");
|
||||||
@@ -86,5 +91,6 @@ ThreadWindow::GeneralPage::SetModel(Model* model, Model::Thread* thread)
|
|||||||
fWaitTimeView->SetText("");
|
fWaitTimeView->SetText("");
|
||||||
fLatencyView->SetText("");
|
fLatencyView->SetText("");
|
||||||
fPreemptionView->SetText("");
|
fPreemptionView->SetText("");
|
||||||
|
fUnspecifiedTimeView->SetText("");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ private:
|
|||||||
TextDataView* fWaitTimeView;
|
TextDataView* fWaitTimeView;
|
||||||
TextDataView* fLatencyView;
|
TextDataView* fLatencyView;
|
||||||
TextDataView* fPreemptionView;
|
TextDataView* fPreemptionView;
|
||||||
|
TextDataView* fUnspecifiedTimeView;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user