From 4ab2927d4250f3e4f0f98307169880ed55f56eda Mon Sep 17 00:00:00 2001 From: Ingo Weinhold Date: Sun, 26 Apr 2009 22:38:54 +0000 Subject: [PATCH] * Compute the summed up wait counts and times for WaitObjectGroups. * Delete the wait object array in the WaitObjectGroup destructor. It was leaked before. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30449 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/apps/debuganalyzer/model/ThreadModel.cpp | 9 ++++++++- src/apps/debuganalyzer/model/ThreadModel.h | 19 +++++++++++++++++++ 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/src/apps/debuganalyzer/model/ThreadModel.cpp b/src/apps/debuganalyzer/model/ThreadModel.cpp index 423cab200c..00772b112e 100644 --- a/src/apps/debuganalyzer/model/ThreadModel.cpp +++ b/src/apps/debuganalyzer/model/ThreadModel.cpp @@ -15,13 +15,20 @@ ThreadModel::WaitObjectGroup::WaitObjectGroup( Model::ThreadWaitObject** waitObjects, int32 count) : fWaitObjects(waitObjects), - fCount(count) + fCount(count), + fWaits(0), + fTotalWaitTime(0) { + for (int32 i = 0; i < fCount; i++) { + fWaits += fWaitObjects[i]->Waits(); + fTotalWaitTime += fWaitObjects[i]->TotalWaitTime(); + } } ThreadModel::WaitObjectGroup::~WaitObjectGroup() { + delete[] fWaitObjects; } diff --git a/src/apps/debuganalyzer/model/ThreadModel.h b/src/apps/debuganalyzer/model/ThreadModel.h index b0fb306cb9..6d63e76d76 100644 --- a/src/apps/debuganalyzer/model/ThreadModel.h +++ b/src/apps/debuganalyzer/model/ThreadModel.h @@ -56,6 +56,9 @@ public: inline uint32 Type() const; inline const char* Name() const; + inline int64 Waits() const; + inline bigtime_t TotalWaitTime() const; + inline int32 CountWaitObjects() const; inline Model::ThreadWaitObject* WaitObjectAt(int32 index) const; @@ -68,6 +71,8 @@ public: private: Model::ThreadWaitObject** fWaitObjects; int32 fCount; + int64 fWaits; + bigtime_t fTotalWaitTime; }; @@ -105,6 +110,20 @@ ThreadModel::WaitObjectGroup::Name() const } +int64 +ThreadModel::WaitObjectGroup::Waits() const +{ + return fWaits; +} + + +bigtime_t +ThreadModel::WaitObjectGroup::TotalWaitTime() const +{ + return fTotalWaitTime; +} + + int32 ThreadModel::WaitObjectGroup::CountWaitObjects() const {