aboutsummaryrefslogtreecommitdiffstats
path: root/vespalib/src/apps
diff options
context:
space:
mode:
authorTor Egge <Tor.Egge@online.no>2022-05-12 11:40:36 +0200
committerTor Egge <Tor.Egge@online.no>2022-05-12 11:40:36 +0200
commit4bb82cc75fe70611b2a8c7c3d16165e1d85355e4 (patch)
treeac042aa3672fbb302121af3a511789487bdb8dbc /vespalib/src/apps
parent32e26201ca86681150eb47661ae551a1c188c594 (diff)
Add CGroupResourceLimits class.
Diffstat (limited to 'vespalib/src/apps')
-rw-r--r--vespalib/src/apps/vespa-resource-limits/.gitignore1
-rw-r--r--vespalib/src/apps/vespa-resource-limits/CMakeLists.txt9
-rw-r--r--vespalib/src/apps/vespa-resource-limits/resource_limits.cpp13
3 files changed, 23 insertions, 0 deletions
diff --git a/vespalib/src/apps/vespa-resource-limits/.gitignore b/vespalib/src/apps/vespa-resource-limits/.gitignore
new file mode 100644
index 00000000000..58a2938f452
--- /dev/null
+++ b/vespalib/src/apps/vespa-resource-limits/.gitignore
@@ -0,0 +1 @@
+/vespa-resource-limits
diff --git a/vespalib/src/apps/vespa-resource-limits/CMakeLists.txt b/vespalib/src/apps/vespa-resource-limits/CMakeLists.txt
new file mode 100644
index 00000000000..566b23058cf
--- /dev/null
+++ b/vespalib/src/apps/vespa-resource-limits/CMakeLists.txt
@@ -0,0 +1,9 @@
+# Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+vespa_add_executable(vespalib_vespa-resource-limits_app
+ SOURCES
+ resource_limits.cpp
+ OUTPUT_NAME vespa-resource-limits
+ INSTALL bin
+ DEPENDS
+ vespalib
+)
diff --git a/vespalib/src/apps/vespa-resource-limits/resource_limits.cpp b/vespalib/src/apps/vespa-resource-limits/resource_limits.cpp
new file mode 100644
index 00000000000..59bea7d0fd8
--- /dev/null
+++ b/vespalib/src/apps/vespa-resource-limits/resource_limits.cpp
@@ -0,0 +1,13 @@
+// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+
+#include <vespa/vespalib/util/resource_limits.h>
+#include <iostream>
+
+int
+main(int, char**)
+{
+ auto limits = vespalib::ResourceLimits::create();
+ std::cout << "Memory limit: " << limits.memory() << '\n' <<
+ "Cpu limit: " << limits.cpu() << std::endl;
+ return 0;
+}