bmahler commented on code in PR #553:
URL: https://github.com/apache/mesos/pull/553#discussion_r1561754342
##########
src/linux/cgroups2.cpp:
##########
@@ -767,6 +767,27 @@ Try<cpu::BandwidthLimit> max(const string& cgroup)
} // namespace cpu {
+namespace memory {
+
+namespace control {
+
+const string CURRENT = "memory.current";
+
+} // namespace control {
+
+Try<Bytes> usage(const string& cgroup)
+{
+ Try<string> contents = cgroups2::read<string>(
+ cgroup, memory::control::CURRENT);
+ if (contents.isError()) {
+ return Error("Failed to read 'memory.current': " + contents.error());
+ }
+
+ return Bytes::parse(strings::trim(*contents) + "B");
Review Comment:
we can just read<uint64_t> here and avoid the need for trimming / parsing
below, by directly constructing Bytes(uint64_t)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]