1
1

Handle the case where memory stats are in different order, or don't exist on that platform

This commit was SVN r24700.
Этот коммит содержится в:
Ralph Castain 2011-05-16 13:32:42 +00:00
родитель d8b7ea315e
Коммит 08c3ecd608

Просмотреть файл

@ -299,7 +299,6 @@ static int query(pid_t pid,
data[len] = '\0'; data[len] = '\0';
/* parse it according to proc(3) */ /* parse it according to proc(3) */
eptr = data;
/* look for VmPeak */ /* look for VmPeak */
if (NULL != (ptr = strstr(data, "VmPeak:"))) { if (NULL != (ptr = strstr(data, "VmPeak:"))) {
/* found it - step past colon */ /* found it - step past colon */
@ -307,14 +306,14 @@ static int query(pid_t pid,
stats->peak_vsize = convert_value(ptr); stats->peak_vsize = convert_value(ptr);
} }
/* look for VmSize */ /* look for VmSize */
if (NULL != (ptr = strstr(ptr, "VmSize:"))) { if (NULL != (ptr = strstr(data, "VmSize:"))) {
/* found it - step past colon */ /* found it - step past colon */
ptr += 8; ptr += 8;
stats->vsize = convert_value(ptr); /* convert to MBytes*/ stats->vsize = convert_value(ptr); /* convert to MBytes*/
} }
/* look for RSS */ /* look for RSS */
if (NULL != (ptr = strstr(ptr, "VmRSS:"))) { if (NULL != (ptr = strstr(data, "VmRSS:"))) {
/* found it - step past colon */ /* found it - step past colon */
ptr += 8; ptr += 8;
stats->rss = convert_value(ptr); /* convert to MBytes */ stats->rss = convert_value(ptr); /* convert to MBytes */