You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by bm...@apache.org on 2013/07/19 21:18:05 UTC

git commit: Added a LIBPROCESS_STATISTICS_WINDOW environment variable.

Updated Branches:
  refs/heads/master 680772c1a -> ade2708f9


Added a LIBPROCESS_STATISTICS_WINDOW environment variable.

Review: https://reviews.apache.org/r/12753


Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/ade2708f
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/ade2708f
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/ade2708f

Branch: refs/heads/master
Commit: ade2708f9ea3507d51ce611cabe3848dc65e51b5
Parents: 680772c
Author: Benjamin Mahler <bm...@twitter.com>
Authored: Tue Jul 16 13:58:36 2013 -0700
Committer: Benjamin Mahler <bm...@twitter.com>
Committed: Fri Jul 19 12:18:00 2013 -0700

----------------------------------------------------------------------
 3rdparty/libprocess/src/process.cpp | 19 +++++++++++++++----
 1 file changed, 15 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/ade2708f/3rdparty/libprocess/src/process.cpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/src/process.cpp b/3rdparty/libprocess/src/process.cpp
index 08242ce..a5e7031 100644
--- a/3rdparty/libprocess/src/process.cpp
+++ b/3rdparty/libprocess/src/process.cpp
@@ -585,6 +585,7 @@ ThreadLocal<ProcessBase>* _process_ = new ThreadLocal<ProcessBase>();
 // Per thread executor pointer.
 ThreadLocal<Executor>* _executor_ = new ThreadLocal<Executor>();
 
+const Duration LIBPROCESS_STATISTICS_WINDOW = Days(1);
 
 // We namespace the clock related variables to keep them well
 // named. In the future we'll probably want to associate a clock with
@@ -1517,10 +1518,20 @@ void initialize(const string& delegate)
   spawn(new Profiler(), true);
 
   // Create the global statistics.
-  // TODO(bmahler): Investigate memory implications of this window
-  // size. We may also want to provide a maximum memory size rather than
-  // time window. Or, offload older data to disk, etc.
-  statistics = new Statistics(Weeks(2));
+  value = getenv("LIBPROCESS_STATISTICS_WINDOW");
+  if (value != NULL) {
+    Try<Duration> window = Duration::parse(string(value));
+    if (window.isError()) {
+      LOG(FATAL) << "LIBPROCESS_STATISTICS_WINDOW=" << value
+                 << " is not a valid duration: " << window.error();
+    }
+    statistics = new Statistics(window.get());
+  } else {
+    // TODO(bmahler): Investigate memory implications of this window
+    // size. We may also want to provide a maximum memory size rather than
+    // time window. Or, offload older data to disk, etc.
+    statistics = new Statistics(LIBPROCESS_STATISTICS_WINDOW);
+  }
 
   // Initialize the mime types.
   mime::initialize();