Commit a3866435 authored by Peter W. Draper's avatar Peter W. Draper
Browse files

Add function to return the memory use of process tree

parent f9d79855
......@@ -27,6 +27,8 @@
#include <stddef.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/resource.h>
#include <sys/time.h>
/* This object's header. */
#include "tools.h"
......@@ -701,3 +703,14 @@ int compare_particles(struct part a, struct part b, double threshold) {
#endif
}
/**
* @brief return the resident memory use of the process and its children.
*
* @result memory use in Kb.
*/
long get_maxrss() {
struct rusage usage;
getrusage(RUSAGE_SELF, &usage);
return usage.ru_maxrss;
}
......@@ -52,4 +52,6 @@ int compare_values(double a, double b, double threshold, double *absDiff,
double *absSum, double *relDiff);
int compare_particles(struct part a, struct part b, double threshold);
long get_maxrss();
#endif /* SWIFT_TOOL_H */
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment