Repository: mesos Updated Branches: refs/heads/master 700defe30 -> d0446b7ea
Update metrics::Timer::stop to return elapsed time. Review: https://reviews.apache.org/r/24537 Project: http://git-wip-us.apache.org/repos/asf/mesos/repo Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/d0446b7e Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/d0446b7e Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/d0446b7e Branch: refs/heads/master Commit: d0446b7ead415749b6483dd6aecb7f7fe27f4f57 Parents: 700defe Author: Benjamin Hindman <[email protected]> Authored: Fri Oct 10 11:00:19 2014 -0700 Committer: Benjamin Mahler <[email protected]> Committed: Fri Oct 10 11:00:19 2014 -0700 ---------------------------------------------------------------------- 3rdparty/libprocess/include/process/metrics/timer.hpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/mesos/blob/d0446b7e/3rdparty/libprocess/include/process/metrics/timer.hpp ---------------------------------------------------------------------- diff --git a/3rdparty/libprocess/include/process/metrics/timer.hpp b/3rdparty/libprocess/include/process/metrics/timer.hpp index dfd7dd9..b6b55b1 100644 --- a/3rdparty/libprocess/include/process/metrics/timer.hpp +++ b/3rdparty/libprocess/include/process/metrics/timer.hpp @@ -56,21 +56,27 @@ public: } // Stop the Timer. - void stop() + T stop() { const Time stop = Clock::now(); + T t(0); + double value; process::internal::acquire(&data->lock); { - data->lastValue = T(stop - data->start).value(); + t = T(stop - data->start); + + data->lastValue = t.value(); value = data->lastValue.get(); } process::internal::release(&data->lock); push(value); + + return t; } // Time an asynchronous event.
