Re: Measuring memory footprint in C/C++ code on FreeBSD

2011-10-23 Thread Razmig K
Hello

Thanks to everyone for tips and insight you gave me on this discussion.

~Razmig

___
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "freebsd-hackers-unsubscr...@freebsd.org"


Re: Measuring memory footprint in C/C++ code on FreeBSD

2011-10-21 Thread Razmig K

Le 21.10.2011 12:26, Ivan Voras a écrit :

Well, do you know that SIZE in top is virtual memory size, not resident
size (which is the "RES" column)? You can allocate whatever you want
from virtual memory, it is not "used" until it's touched.


Yes, I do. So do you suggest using RES as a better indicator of memory 
footprint?
The program in question processes large 3D images via vtk, and I'd like 
to measure its memory usgae with different parameter configurations as 
the maximum amount of memory acquired during execution. Since SIZE often 
happens to be larger than RES, and increase more during execution, I 
thought of using it as an indicator of memory footprint.


~Razmig
___
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "freebsd-hackers-unsubscr...@freebsd.org"


Re: Measuring memory footprint in C/C++ code on FreeBSD

2011-10-21 Thread Razmig K

Le 21.10.2011 10:44, Peter Jeremy a écrit :

On 2011-Oct-20 19:57:31 +0200, Razmig K  wrote:
It's not clear whether the program is attempting to determine it's
own (or a child's) memory footprint, or that of an arbitrary process.
In the former case, getrusage() is the obvious choice.  This as a
portable interface.

The program has to determine its own memory footprint. It has no children.



If you want to examine arbitrary processes, the best interface on
FreeBSD would be kvm_getprocs(3).

BTW, since you mention heap objects, I presume you are aware that
malloc() uses mmap(), rather than sbrk() to obtain memory.

No I wasn't aware of that.

In few words, the program needs to obtain and report information 
reported by the SIZE column of top, since it is going to be run many 
times, and it is impractical to watch top for this purpose.


Thanks.

~Razmig





___
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "freebsd-hackers-unsubscr...@freebsd.org"


Re: Measuring memory footprint in C/C++ code on FreeBSD

2011-10-21 Thread Razmig K

Le 20.10.2011 19:57, Razmig K a écrit :

the memory footprint in C/C++ code for a program running under FreeBSD
and Linux in terms of total process size including heap objects


Well getrusage does actually exist in Linux, but its behaviour 
isn't the same as on FreeBSD; struct rusage memory usage information 
fields ru_ixrss (shared text), ru_idrss (unshared data) and ru_isrss 
(unshared stack) are always zero.
To test and understand the behaviour of getrusage on FreeBSD, I 
have written a small C++ program that allocates several large double 
arrays on the stack as well as on the heap with few loops to delay 
execution, and tried using the aforementioned fields, in addition to 
ru_maxrss (max resident size) to deduce memory usage information of the 
program as reported by top, namely fields RES and SIZE, but somehow I 
didn't manage to get a result matching that of the latter.
First of all, I'm not sure if I interpret man getrusage correctly. 
For ru_ixrss, it says that it is an "integral" value indicating the 
amount of memory used by the text segment that was also shared among 
other processes, and is expressed in units of kilobytes * 
ticks-of-execution, where ticks are statistics clock ticks, the 
statistics clock having a frequency of sysconf(_SC_CLK_TCK) ticks per 
second. Does this imply that I need to divide ru_ixrss by 
sysconf(_SC_CLK_TCK) * a certain number of seconds? In that case, what 
do I use for the latter? ru_stime or ru_utime?
I have observed that unlike ru_idrss, ru_ixrss and ru_isrss depend 
on execution time which contradicts the manpage, since all three fields 
are supposed to be specified in the same unit.
Lastly, I don't see how to use getrusage to deduce information on 
the program's heap use. As I said in my first message, I need to measure 
the memory footprint in terms of total process size including heap objects.

Thanks again for any tips.


~Razmig


___
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "freebsd-hackers-unsubscr...@freebsd.org"


Measuring memory footprint in C/C++ code on FreeBSD

2011-10-20 Thread Razmig K

Hello

I'd like to measure the memory footprint in C/C++ code for a 
program running under FreeBSD and Linux in terms of total process size 
including heap objects. Due to execution length, I'd like to avoid the 
use of valgrind.
I think that it would be difficult to achieve the task in a 
platform-transparent manner, that's why I'll be using /proc//status 
on Linux, and do something else on FreeBSD.
I was adviced to have a look on getrusage, which I did, but I found 
descriptions of certain fields of struct rusage in the manpage too 
cryptic to make a proper use of the call.

Could someone please point me in the right direction?
Thanks very much.

~Razmig
___
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "freebsd-hackers-unsubscr...@freebsd.org"


Re: Laptop suggestions?

2008-07-25 Thread Razmig K

Zaphod Beeblebrox a écrit :
On Fri, Jul 25, 2008 at 1:35 PM, Razmig K <[EMAIL PROTECTED] 
<mailto:[EMAIL PROTECTED]>> wrote:


How about Dell models which come with Ubuntu preinstalled? (Inspiron
1525N and 1420N, XPS M1330). Don't they have higher chances of
running FreeBSD smoothly? A quick glance over the hardware notes of
7.0-RELEASE and some googling around show that wireless, video and
audio are supported.


One problem with most of the Dell offerings is that they use the NVidia 
video chipset.  Now this is a plus if you're into playing a few games, 
but it sucks if you're running FreeBSD.  One of the original requests 
was for >4G RAM.  The NVidia binary driver only works on IA32, not AMD64 
(and the opensource driver sucks at even 2D), so your RAM is practically 
limited to around 3.5G (depending on a few things).  
[...]
 it's just that the 2D 
acceleration feels very lacking and it also can't do things like scale a 
movie at full frame rate.  
The aforementioned Dell models offer the Intel graphics accelerator 
X3100 as an option, which appears to be supported pretty well on both 32 
and 64 bit architectures. A fairly recent thread at PC-BSD forums 
reports successful use of Compiz Fusion (albeit on Ubuntu Gutsy) with 
this accelerator:

http://forums.pcbsd.org/viewtopic.php?f=25&t=10936&start=0&st=0&sk=t&sd=a


//rk
___
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


Re: Laptop suggestions?

2008-07-25 Thread Razmig K
How about Dell models which come with Ubuntu preinstalled? (Inspiron 
1525N and 1420N, XPS M1330). Don't they have higher chances of running 
FreeBSD smoothly? A quick glance over the hardware notes of 7.0-RELEASE 
and some googling around show that wireless, video and audio are supported.



//rk
___
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "[EMAIL PROTECTED]"