Tassilo Horn wrote: > >> How can I get correct memory resource usage informations of a (child) > >> process (without changing the code of the process' applications)? > > > > Parse /proc/<pid>/maps. Any entries with an inode of zero (other than > > the heap and stack regions) correspond to mmap(MAP_ANONYMOUS). > > The problem with that approach is, that I want some statistics over the > complete runtime of the process. So I would have to parse > /proc/<pid>/maps every few tenth of a second, sorting out what's seen > before, etc. which would produce a great overhead and could have effects > on the processes I want to inspect. Or do I get you wrong, here? If you want to continuously monitor resource usage, efficiency could be an issue. But I don't think that there's any other way to obtain that information. > BTW: The infos of /proc/<pid>/status are looking interesting, too > (VmPeak, VmSize, VmData, ...). But then another question is, how do I > know when a process finishes? Is there some sort of signalling: "Hey, > Process XY's going to die now!"? The parent receives SIGCHLD when a child terminates. However, at that point, /proc/<pid>/maps will be empty, as the process will have released all of its resources. The only information which you can obtain once the process has terminated is that returned by wait4() etc. -- Glynn Clements <glynn@xxxxxxxxxxxxxxxxxx> - : send the line "unsubscribe linux-c-programming" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html