Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
SWIFT
SWIFTsim
Commits
a3866435
Commit
a3866435
authored
Mar 03, 2018
by
Peter W. Draper
Browse files
Add function to return the memory use of process tree
parent
f9d79855
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/tools.c
View file @
a3866435
...
...
@@ -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
;
}
src/tools.h
View file @
a3866435
...
...
@@ -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 */
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment