summaryrefslogtreecommitdiff
path: root/libs/ui/SharedBufferStack.cpp
diff options
context:
space:
mode:
author Mathias Agopian <mathias@google.com> 2009-09-17 01:35:28 -0700
committer Mathias Agopian <mathias@google.com> 2009-09-17 01:35:28 -0700
commitbcef9ac35da08b9f7f8a4728af94c23a7a010669 (patch)
treec13c342c0265bc0b94608695d90e3edb6f54a918 /libs/ui/SharedBufferStack.cpp
parent76f0111845f0886f522cfe1eb5ec1dee34181f7c (diff)
add basic time stats for surfaces lock time
Diffstat (limited to 'libs/ui/SharedBufferStack.cpp')
-rw-r--r--libs/ui/SharedBufferStack.cpp16
1 files changed, 15 insertions, 1 deletions
diff --git a/libs/ui/SharedBufferStack.cpp b/libs/ui/SharedBufferStack.cpp
index 7789a3f8646f..9ad4349da299 100644
--- a/libs/ui/SharedBufferStack.cpp
+++ b/libs/ui/SharedBufferStack.cpp
@@ -276,6 +276,8 @@ ssize_t SharedBufferClient::dequeue()
LOGW("dequeue: tail=%d, head=%d, avail=%d, queued=%d",
tail, stack.head, stack.available, stack.queued);
}
+
+ const nsecs_t dequeueTime = systemTime(SYSTEM_TIME_THREAD);
//LOGD("[%d] about to dequeue a buffer",
// mSharedStack->identity);
@@ -296,6 +298,8 @@ ssize_t SharedBufferClient::dequeue()
LOGD_IF(DEBUG_ATOMICS, "dequeued=%d, tail=%d, %s",
dequeued, tail, dump("").string());
+ mDequeueTime[dequeued] = dequeueTime;
+
return dequeued;
}
@@ -312,7 +316,7 @@ status_t SharedBufferClient::undoDequeue(int buf)
status_t SharedBufferClient::lock(int buf)
{
LockCondition condition(this, buf);
- status_t err = waitForCondition(condition);
+ status_t err = waitForCondition(condition);
return err;
}
@@ -321,6 +325,9 @@ status_t SharedBufferClient::queue(int buf)
QueueUpdate update(this);
status_t err = updateCondition( update );
LOGD_IF(DEBUG_ATOMICS, "queued=%d, %s", buf, dump("").string());
+ SharedBufferStack& stack( *mSharedStack );
+ const nsecs_t now = systemTime(SYSTEM_TIME_THREAD);
+ stack.stats.totalTime = ns2us(now - mDequeueTime[buf]);
return err;
}
@@ -393,5 +400,12 @@ Region SharedBufferServer::getDirtyRegion(int buffer) const
return stack.getDirtyRegion(buffer);
}
+SharedBufferStack::Statistics SharedBufferServer::getStats() const
+{
+ SharedBufferStack& stack( *mSharedStack );
+ return stack.stats;
+}
+
+
// ---------------------------------------------------------------------------
}; // namespace android