ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/OpenMD/branches/development/src/utils/residentMem.c
(Generate patch)

Comparing trunk/src/utils/residentMem.c (file contents):
Revision 342 by gezelter, Tue Feb 15 05:59:14 2005 UTC vs.
Revision 344 by gezelter, Tue Feb 15 06:17:03 2005 UTC

# Line 2 | Line 2
2   #include <string.h>
3   #include <stdio.h>
4  
5 + #define to_string( s ) # s
6 + #define STR_DEFINE(t, s) t = to_string(s)
7 +
8   double residentMem () {
9  
10    FILE* procresults;
# Line 9 | Line 12 | double residentMem () {
12    char* foo;
13    long int myRSS, totRSS;
14    char pscommand[150];
15 +  char* psPath;
16  
17 <  strncpy(pscommand, PSCOMMAND, strlen(PSCOMMAND));
17 >  STR_DEFINE(psPath, PSCOMMAND );
18 >
19 >  // null terminated string is one longer....
20 >  strncpy(pscommand, psPath, strlen(psPath)+1);
21  
22   #if PSTYPE == BSD
23    strcat(pscommand, " ax -o rss");
# Line 18 | Line 25 | double residentMem () {
25    strcat(pscommand, " -ef -o rss");
26   #endif
27  
28 +  printf("doing %s\n", pscommand);
29 +
30    procresults = popen(pscommand, "r");
31  
32    totRSS = 0;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines