fixes bug 328068 "[osx] gather memory usage data for load events" r=bryner

This commit is contained in:
darin%meer.net 2006-03-15 00:25:05 +00:00
Родитель 9035e10276
Коммит f814fd1ca7
1 изменённых файлов: 17 добавлений и 0 удалений

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

@ -79,6 +79,11 @@ static void GetMemUsage_Shutdown() {
}
sGetMemInfo = NULL;
}
#elif defined(XP_MACOSX)
#include <mach/mach.h>
#include <mach/task.h>
static void GetMemUsage_Shutdown() {
}
#endif
struct MemUsage {
@ -138,6 +143,18 @@ static PRBool GetMemUsage(MemUsage *result)
setResult = PR_TRUE;
}
}
#elif defined(XP_MACOSX)
// Use task_info
task_basic_info_data_t ti;
mach_msg_type_number_t count = TASK_BASIC_INFO_COUNT;
kern_return_t error = task_info(mach_task_self(), TASK_BASIC_INFO,
(task_info_t) &ti, &count);
if (error == KERN_SUCCESS) {
result->total = PRInt64(ti.virtual_size);
result->resident = PRInt64(ti.resident_size);
setResult = PR_TRUE;
}
#endif
return setResult;
}