Messages in this thread | | | Date | Sat, 15 Nov 2003 00:36:04 -0200 (BRST) | Subject | Getting the size of heap, stack code and data in physical memory | From | edjard@ufam ... |
| |
Hello All,
We have tried to find out answer to our questions at the kernelnewbies list, but after many mails we had no conclusive opinion. Does any one here have n idea on how to solve it?
The hacking challenge is: We are looking for a structure or variables that represent the size of heap, stack, code and data in physical memory. We found some structures on kernel source 2.6 like mm_struct and vm_area_struct, but these structures give the size of process (stack,code, data, heap separately) allocated in virtual memory. The only information we found about physical memory is rss, but this variable does not provide the size of stack, code, data, heap separately.
The pmap of Linux doesn't provide these data also since it is actually inside /proc.
We think the only way to get this information is through the way the page table sets the page resident flag and use some variables to calculate the size of such elements (stack, code, data, heap) allocated in physical memory. But the implementation of page table is not trivial, the same for pgd, pmd and pte.
We'd like to know if it is possible to calculate the size of these elements without losing the OS performance?
Is there any better solution to do that?
Edjard
- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
| |