5 |
|
#define to_string( s ) # s |
6 |
|
#define STR_DEFINE(t, s) t = to_string(s) |
7 |
|
|
8 |
– |
|
8 |
|
double residentMem () { |
9 |
|
|
10 |
|
FILE* procresults; |
15 |
|
char* psPath; |
16 |
|
|
17 |
|
STR_DEFINE(psPath, PSCOMMAND ); |
18 |
+ |
|
19 |
+ |
// null terminated string is one longer.... |
20 |
+ |
strncpy(pscommand, psPath, strlen(psPath)+1); |
21 |
|
|
20 |
– |
strncpy(pscommand, psPath, strlen(psPath)); |
21 |
– |
|
22 |
|
#if PSTYPE == BSD |
23 |
|
strcat(pscommand, " ax -o rss"); |
24 |
|
#else |
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; |