hunyadi-dev commented on a change in pull request #845:
URL: https://github.com/apache/nifi-minifi-cpp/pull/845#discussion_r460764666



##########
File path: libminifi/src/utils/OsUtils.cpp
##########
@@ -154,6 +160,80 @@ std::string OsUtils::userIdToUsername(const std::string 
&uid) {
   return name;
 }
 
+unsigned long long OsUtils::getMemoryUsage() {
+#ifdef __linux__
+  long resPages;
+  long sharedPages;
+  {
+    std::string ignore;
+    std::ifstream ifs("/proc/self/statm");
+    ifs >> ignore >> resPages >> sharedPages;
+  }
+
+  if (sharedPages > resPages) {
+    throw std::range_error("Shared memory page count ("
+      + std::to_string(sharedPages)
+      + ") should not be larger than resident set size ("
+      + std::to_string(resPages)
+      + "), that includes it"
+    );
+  }
+
+  const long ownPages = resPages - sharedPages;

Review comment:
       The linter will also report for `long` usage.




----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to