You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by be...@apache.org on 2012/09/10 00:03:28 UTC

svn commit: r1382594 - in /incubator/mesos/trunk: src/log/ src/master/ src/tests/ third_party/libprocess/ third_party/libprocess/include/stout/

Author: benh
Date: Sun Sep  9 22:03:27 2012
New Revision: 1382594

URL: http://svn.apache.org/viewvc?rev=1382594&view=rev
Log:
Renamed Stout Timer to Stopwatch (https://reviews.apache.org/r/6846).

Added:
    incubator/mesos/trunk/third_party/libprocess/include/stout/stopwatch.hpp
      - copied, changed from r1382593, incubator/mesos/trunk/third_party/libprocess/include/stout/timer.hpp
Removed:
    incubator/mesos/trunk/third_party/libprocess/include/stout/timer.hpp
Modified:
    incubator/mesos/trunk/src/log/replica.cpp
    incubator/mesos/trunk/src/master/hierarchical_allocator_process.hpp
    incubator/mesos/trunk/src/tests/stout_tests.cpp
    incubator/mesos/trunk/third_party/libprocess/Makefile.am

Modified: incubator/mesos/trunk/src/log/replica.cpp
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/src/log/replica.cpp?rev=1382594&r1=1382593&r2=1382594&view=diff
==============================================================================
--- incubator/mesos/trunk/src/log/replica.cpp (original)
+++ incubator/mesos/trunk/src/log/replica.cpp Sun Sep  9 22:03:27 2012
@@ -29,7 +29,7 @@
 
 #include <stout/foreach.hpp>
 #include <stout/numify.hpp>
-#include <stout/timer.hpp>
+#include <stout/stopwatch.hpp>
 #include <stout/utils.hpp>
 
 #include "log/replica.hpp"
@@ -211,8 +211,8 @@ Try<State> LevelDBStorage::recover(const
   CHECK(leveldb::BytewiseComparator()->Compare(ten, two) > 0);
   CHECK(leveldb::BytewiseComparator()->Compare(ten, ten) == 0);
 
-  Timer timer;
-  timer.start();
+  Stopwatch stopwatch;
+  stopwatch.start();
 
   leveldb::Status status = leveldb::DB::Open(options, path, &db);
 
@@ -221,14 +221,14 @@ Try<State> LevelDBStorage::recover(const
     return Try<State>::error(status.ToString());
   }
 
-  LOG(INFO) << "Opened db in " << timer.elapsed();
+  LOG(INFO) << "Opened db in " << stopwatch.elapsed();
 
-  timer.start(); // Restart the timer.
+  stopwatch.start(); // Restart the stopwatch.
 
   // TODO(benh): Conditionally compact to avoid long recovery times?
   db->CompactRange(NULL, NULL);
 
-  LOG(INFO) << "Compacted db in " << timer.elapsed();
+  LOG(INFO) << "Compacted db in " << stopwatch.elapsed();
 
   State state;
   state.coordinator = 0;
@@ -240,19 +240,19 @@ Try<State> LevelDBStorage::recover(const
   // records and confirming that they are all indeed of type
   // Record::Action.
 
-  timer.start(); // Restart the timer.
+  stopwatch.start(); // Restart the stopwatch.
 
   leveldb::Iterator* iterator = db->NewIterator(leveldb::ReadOptions());
 
-  LOG(INFO) << "Created db iterator in " << timer.elapsed();
+  LOG(INFO) << "Created db iterator in " << stopwatch.elapsed();
 
-  timer.start(); // Restart the timer.
+  stopwatch.start(); // Restart the stopwatch.
 
   iterator->SeekToFirst();
 
-  LOG(INFO) << "Seeked to beginning of db in " << timer.elapsed();
+  LOG(INFO) << "Seeked to beginning of db in " << stopwatch.elapsed();
 
-  timer.start(); // Restart the timer.
+  stopwatch.start(); // Restart the stopwatch.
 
   uint64_t keys = 0;
 
@@ -302,7 +302,7 @@ Try<State> LevelDBStorage::recover(const
   }
 
   LOG(INFO) << "Iterated through " << keys
-            << " keys in the db in " << timer.elapsed();
+            << " keys in the db in " << stopwatch.elapsed();
 
   // Determine the first position still in leveldb so during a
   // truncation we can attempt to delete all positions from the first
@@ -323,8 +323,8 @@ Try<State> LevelDBStorage::recover(const
 
 Try<void> LevelDBStorage::persist(const Promise& promise)
 {
-  Timer timer;
-  timer.start();
+  Stopwatch stopwatch;
+  stopwatch.start();
 
   leveldb::WriteOptions options;
   options.sync = true;
@@ -346,7 +346,7 @@ Try<void> LevelDBStorage::persist(const 
   }
 
   LOG(INFO) << "Persisting promise (" << value.size()
-            << " bytes) to leveldb took " << timer.elapsed();
+            << " bytes) to leveldb took " << stopwatch.elapsed();
 
   return Try<void>::some();
 }
@@ -354,8 +354,8 @@ Try<void> LevelDBStorage::persist(const 
 
 Try<void> LevelDBStorage::persist(const Action& action)
 {
-  Timer timer;
-  timer.start();
+  Stopwatch stopwatch;
+  stopwatch.start();
 
   Record record;
   record.set_type(Record::ACTION);
@@ -377,7 +377,7 @@ Try<void> LevelDBStorage::persist(const 
   }
 
   LOG(INFO) << "Persisting action (" << value.size()
-            << " bytes) to leveldb took " << timer.elapsed();
+            << " bytes) to leveldb took " << stopwatch.elapsed();
 
   // Delete positions if a truncate action has been *learned*. Note
   // that we do this in a best-effort fashion (i.e., we ignore any
@@ -386,7 +386,7 @@ Try<void> LevelDBStorage::persist(const 
       action.has_learned() && action.learned()) {
     CHECK(action.has_truncate());
 
-    timer.start(); // Restart the timer.
+    stopwatch.start(); // Restart the stopwatch.
 
     // To actually perform the truncation in leveldb we need to remove
     // all the keys that represent positions no longer in the log. We
@@ -425,7 +425,7 @@ Try<void> LevelDBStorage::persist(const 
         first = action.truncate().to(); // Save the new first position!
 
         LOG(INFO) << "Deleting ~" << index
-                  << " keys from leveldb took " << timer.elapsed();
+                  << " keys from leveldb took " << stopwatch.elapsed();
       }
     }
   }
@@ -436,8 +436,8 @@ Try<void> LevelDBStorage::persist(const 
 
 Try<Action> LevelDBStorage::read(uint64_t position)
 {
-  Timer timer;
-  timer.start();
+  Stopwatch stopwatch;
+  stopwatch.start();
 
   leveldb::ReadOptions options;
 
@@ -461,7 +461,7 @@ Try<Action> LevelDBStorage::read(uint64_
     return Try<Action>::error("Bad record");
   }
 
-  LOG(INFO) << "Reading position from leveldb took " << timer.elapsed();
+  LOG(INFO) << "Reading position from leveldb took " << stopwatch.elapsed();
 
   return record.action();
 }

Modified: incubator/mesos/trunk/src/master/hierarchical_allocator_process.hpp
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/src/master/hierarchical_allocator_process.hpp?rev=1382594&r1=1382593&r2=1382594&view=diff
==============================================================================
--- incubator/mesos/trunk/src/master/hierarchical_allocator_process.hpp (original)
+++ incubator/mesos/trunk/src/master/hierarchical_allocator_process.hpp Sun Sep  9 22:03:27 2012
@@ -23,7 +23,7 @@
 #include <process/timer.hpp>
 
 #include <stout/hashmap.hpp>
-#include <stout/timer.hpp>
+#include <stout/stopwatch.hpp>
 
 #include "common/resources.hpp"
 
@@ -529,14 +529,13 @@ void HierarchicalAllocatorProcess<UserSo
 {
   CHECK(initialized);
 
-  ::Timer timer;
-  timer.start();
+  Stopwatch stopwatch;
+  stopwatch.start();
 
   allocate(slaves.keys());
 
-  LOG(INFO) << "Performed allocation for "
-            << slaves.size() << " slaves in "
-            << timer.elapsed();
+  LOG(INFO) << "Performed allocation for " << slaves.size()
+            << " slaves in " << stopwatch.elapsed();
 }
 
 
@@ -548,14 +547,13 @@ void HierarchicalAllocatorProcess<UserSo
   hashset<SlaveID> slaveIds;
   slaveIds.insert(slaveId);
 
-  ::Timer timer;
-  timer.start();
+  Stopwatch stopwatch;
+  stopwatch.start();
 
   allocate(slaveIds);
 
-  LOG(INFO) << "Performed allocation for slave "
-            << slaveId << " in "
-            << timer.elapsed();
+  LOG(INFO) << "Performed allocation for slave " << slaveId
+            << " in " << stopwatch.elapsed();
 }
 
 

Modified: incubator/mesos/trunk/src/tests/stout_tests.cpp
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/src/tests/stout_tests.cpp?rev=1382594&r1=1382593&r2=1382594&view=diff
==============================================================================
--- incubator/mesos/trunk/src/tests/stout_tests.cpp (original)
+++ incubator/mesos/trunk/src/tests/stout_tests.cpp Sun Sep  9 22:03:27 2012
@@ -21,7 +21,6 @@
 #include <stout/result.hpp>
 #include <stout/stringify.hpp>
 #include <stout/strings.hpp>
-#include <stout/timer.hpp>
 #include <stout/try.hpp>
 #include <stout/uuid.hpp>
 

Modified: incubator/mesos/trunk/third_party/libprocess/Makefile.am
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/third_party/libprocess/Makefile.am?rev=1382594&r1=1382593&r2=1382594&view=diff
==============================================================================
--- incubator/mesos/trunk/third_party/libprocess/Makefile.am (original)
+++ incubator/mesos/trunk/third_party/libprocess/Makefile.am Sun Sep  9 22:03:27 2012
@@ -83,9 +83,9 @@ libprocess_la_SOURCES += $(top_srcdir)/i
 	$(top_srcdir)/include/stout/path.hpp				\
 	$(top_srcdir)/include/stout/protobuf.hpp			\
 	$(top_srcdir)/include/stout/result.hpp				\
+	$(top_srcdir)/include/stout/stopwatch.hpp			\
 	$(top_srcdir)/include/stout/stringify.hpp			\
 	$(top_srcdir)/include/stout/strings.hpp				\
-	$(top_srcdir)/include/stout/timer.hpp				\
 	$(top_srcdir)/include/stout/try.hpp				\
 	$(top_srcdir)/include/stout/utils.hpp				\
 	$(top_srcdir)/include/stout/uuid.hpp

Copied: incubator/mesos/trunk/third_party/libprocess/include/stout/stopwatch.hpp (from r1382593, incubator/mesos/trunk/third_party/libprocess/include/stout/timer.hpp)
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/third_party/libprocess/include/stout/stopwatch.hpp?p2=incubator/mesos/trunk/third_party/libprocess/include/stout/stopwatch.hpp&p1=incubator/mesos/trunk/third_party/libprocess/include/stout/timer.hpp&r1=1382593&r2=1382594&rev=1382594&view=diff
==============================================================================
--- incubator/mesos/trunk/third_party/libprocess/include/stout/timer.hpp (original)
+++ incubator/mesos/trunk/third_party/libprocess/include/stout/stopwatch.hpp Sun Sep  9 22:03:27 2012
@@ -1,5 +1,5 @@
-#ifndef __STOUT_TIMER_HPP__
-#define __STOUT_TIMER_HPP__
+#ifndef __STOUT_STOPWATCH_HPP__
+#define __STOUT_STOPWATCH_HPP__
 
 #include <time.h>
 
@@ -12,10 +12,10 @@
 
 #include "duration.hpp"
 
-class Timer
+class Stopwatch
 {
 public:
-  Timer() : running(false) { started.tv_sec = 0; started.tv_nsec = 0; }
+  Stopwatch() : running(false) { started.tv_sec = 0; started.tv_nsec = 0; }
 
   void start()
   {
@@ -67,4 +67,4 @@ private:
   timespec started, stopped;
 };
 
-#endif // __STOUT_TIMER_HPP__
+#endif // __STOUT_STOPWATCH_HPP__