summaryrefslogtreecommitdiff
path: root/indra/llcommon/llmemory.cpp
diff options
context:
space:
mode:
authorSteven Bennetts <steve@lindenlab.com>2008-06-06 22:43:38 +0000
committerSteven Bennetts <steve@lindenlab.com>2008-06-06 22:43:38 +0000
commitad332810078a0bbb8fa08fcbfdf3d756de6914f6 (patch)
tree1608b2db5d620d323673607ea7ddadfba9d58bda /indra/llcommon/llmemory.cpp
parenta7d9a543e587ffe84b355db7a2e8193bfe6c68b6 (diff)
QAR-650 - Viewer RC 9 merge -> release (post cmake)
merge release@88802 Branch_1-20-Viewer-2-merge-1@89178 -> release
Diffstat (limited to 'indra/llcommon/llmemory.cpp')
-rw-r--r--indra/llcommon/llmemory.cpp115
1 files changed, 60 insertions, 55 deletions
diff --git a/indra/llcommon/llmemory.cpp b/indra/llcommon/llmemory.cpp
index 079f2b3258..4ca6a12435 100644
--- a/indra/llcommon/llmemory.cpp
+++ b/indra/llcommon/llmemory.cpp
@@ -314,72 +314,77 @@ U64 getCurrentRSS()
#elif defined(LL_DARWIN)
-static U32 getPageSize()
-{
- int ctl[2] = { CTL_HW, HW_PAGESIZE };
- int page_size;
- size_t size = sizeof(page_size);
-
- if (sysctl(ctl, 2, &page_size, &size, NULL, 0) == -1)
- {
- llwarns << "Couldn't get page size" << llendl;
- return 0;
- } else {
- return page_size;
- }
-}
+// This can cause bad stalls! Replace with fast version
+
+// static U32 getPageSize()
+// {
+// int ctl[2] = { CTL_HW, HW_PAGESIZE };
+// int page_size;
+// size_t size = sizeof(page_size);
+
+// if (sysctl(ctl, 2, &page_size, &size, NULL, 0) == -1)
+// {
+// llwarns << "Couldn't get page size" << llendl;
+// return 0;
+// } else {
+// return page_size;
+// }
+// }
U64 getCurrentRSS()
{
- task_t task = mach_task_self();
- vm_address_t addr = VM_MIN_ADDRESS;
- vm_size_t size = 0;
- U64 residentPages = 0;
-
- while (true)
- {
- mach_msg_type_number_t bcount = VM_REGION_BASIC_INFO_COUNT;
- vm_region_basic_info binfo;
- mach_port_t bobj;
- kern_return_t ret;
+ // Stalls!!!
+
+// task_t task = mach_task_self();
+// vm_address_t addr = VM_MIN_ADDRESS;
+// vm_size_t size = 0;
+// U64 residentPages = 0;
+
+// while (true)
+// {
+// mach_msg_type_number_t bcount = VM_REGION_BASIC_INFO_COUNT;
+// vm_region_basic_info binfo;
+// mach_port_t bobj;
+// kern_return_t ret;
- addr += size;
+// addr += size;
- ret = vm_region(task, &addr, &size, VM_REGION_BASIC_INFO,
- (vm_region_info_t) &binfo, &bcount, &bobj);
+// ret = vm_region(task, &addr, &size, VM_REGION_BASIC_INFO,
+// (vm_region_info_t) &binfo, &bcount, &bobj);
- if (ret != KERN_SUCCESS)
- {
- break;
- }
+// if (ret != KERN_SUCCESS)
+// {
+// break;
+// }
- if (bobj != MACH_PORT_NULL)
- {
- mach_port_deallocate(task, bobj);
- }
+// if (bobj != MACH_PORT_NULL)
+// {
+// mach_port_deallocate(task, bobj);
+// }
- mach_msg_type_number_t ecount = VM_REGION_EXTENDED_INFO_COUNT;
- vm_region_extended_info einfo;
- mach_port_t eobj;
-
- ret = vm_region(task, &addr, &size, VM_REGION_EXTENDED_INFO,
- (vm_region_info_t) &einfo, &ecount, &eobj);
-
- if (ret != KERN_SUCCESS)
- {
- llwarns << "vm_region failed" << llendl;
- return 0;
- }
+// mach_msg_type_number_t ecount = VM_REGION_EXTENDED_INFO_COUNT;
+// vm_region_extended_info einfo;
+// mach_port_t eobj;
+
+// ret = vm_region(task, &addr, &size, VM_REGION_EXTENDED_INFO,
+// (vm_region_info_t) &einfo, &ecount, &eobj);
+
+// if (ret != KERN_SUCCESS)
+// {
+// llwarns << "vm_region failed" << llendl;
+// return 0;
+// }
- if (eobj != MACH_PORT_NULL)
- {
- mach_port_deallocate(task, eobj);
- }
+// if (eobj != MACH_PORT_NULL)
+// {
+// mach_port_deallocate(task, eobj);
+// }
- residentPages += einfo.pages_resident;
- }
+// residentPages += einfo.pages_resident;
+// }
- return residentPages * getPageSize();
+// return residentPages * getPageSize();
+ return 0;
}
#elif defined(LL_LINUX)