tracing memory usage patterns

tracing memory usage patterns

Post by Joshua Jone » Fri, 28 Feb 2003 02:50:43




> Can anyone advise me on where I would start, to achieve this? I took a
> look around freshmeat.net for "memory trace" software, but it all seems to
> be stuff to look for leaks, and just tells you when a malloc or free is
> performed (I want individual reads/writes, so for example if "LD  r1,
> 0(r2)" was performed, I'd get as an output something like "read
> <address_in_r2>").

Does valgrind do this?  I've heard lots about it, but never used it.

Quote:> I thought maybe I should write a kernel module to watch memory accesses,
> but I'm guessing that if the word of data which is being read/written is
> already in memory (which it probably will be, most of the time), then the
> OS will never see the memory request (as a page-fault exception will never
> be raised).

Right, the kernel is only activated on an exception, interrupt, or
system call, and does not monitor specific user instructions (and
really has no reason to, and to actually implement something like
this would probably not be trivial).

--
 josh(at)cc.gatech.edu  |  http://intmain.net:800

 373080 local keystrokes since last reboot (35 days ago)

 
 
 

tracing memory usage patterns

Post by Paul Pluzhniko » Fri, 28 Feb 2003 14:05:23




> > I want individual reads/writes, so for example if "LD  r1,
> > 0(r2)" was performed, I'd get as an output something like "read
> > <address_in_r2>".

> Does valgrind do this?

It does.
That's probably OP's best hope ...

Quote:> > I thought maybe I should write a kernel module to watch memory accesses,
> Right, the kernel is only activated on an exception, interrupt, or
> system call, and does not monitor specific user instructions (and

If the kernel watched every memory access of every user process,
all your programs would slow down to a crawl. This approach is
simply unfeasible for any realistic amount of code.

Cheers,
--
In order to understand recursion you must first understand recursion.

 
 
 

tracing memory usage patterns

Post by Steve Maugha » Wed, 05 Mar 2003 06:58:22


[reformatted for readability]


>> > I want individual reads/writes, so for example if "LD  r1,
>> > 0(r2)" was performed, I'd get as an output something like "read
>> > <address_in_r2>".

>> Does valgrind do this?

> It does.
> That's probably OP's best hope ...

I've been fiddling around with valgrind but I can't seem to figure out
how to actually get it to do this - the closest I've come is using
"--skin=cachegrind". As it's simulating cache hits/misses, it must
(internally) have a list of all the reads/writes done by the processor -
but how do I get at this information?

From the docs, I see that cachegrind produces a cachegrind.out.pid file,
of "line-by-line information" - is this the raw cache information (it
doesn't really look like it)? How do I interpret it if it is?

Thanks for everyones help.

Steve

 
 
 

tracing memory usage patterns

Post by Andi Klee » Wed, 05 Mar 2003 06:58:11



> From the docs, I see that cachegrind produces a cachegrind.out.pid file,
> of "line-by-line information" - is this the raw cache information (it
> doesn't really look like it)? How do I interpret it if it is?

valgrind has extensive design documentation included. Perhaps you should
read it?

-Andi

 
 
 

tracing memory usage patterns

Post by Super-Us » Wed, 12 Mar 2003 08:38:09


: Hi, I'm wanting to get a list of all memory reads/writes performed by an
: application.

: Can anyone advise me on where I would start, to achieve this? I took a
: look around freshmeat.net for "memory trace" software, but it all seems to
: be stuff to look for leaks, and just tells you when a malloc or free is
: performed (I want individual reads/writes, so for example if "LD  r1,
: 0(r2)" was performed, I'd get as an output something like "read
: <address_in_r2>").

Do you realize that memory acesses are quite frequent? It is not much
more expensive to get just a list of all intructions executed by your
program. In fact I think that Bochs is closest to what you want: it
interpetts all instuctions in your program and have some support to
trigger special actions for each instucton. But, I am affraid you will
have to do some hard work (and in "tracing mode" your program will
run at say 1/1000 normal speed).
--
                              Waldek Hebisch

 
 
 

1. Memory usage trace for C++ package ?

Dear Unix experts,

I apologize if it is not an appropriate group to ask.

I'm busy with a package written in C++ and its memory
requirements are enormous. I have access to the following
Unix-like systems: Origin 2000 running IRIX 6.5; Sun E3500
running SunOS 5.7 and my own Pentium running Linux.
I can get an access to DS20 with True64 if necessary.

I want to be able to trace memory usage of my package
to find out which objects are most memory-consuming.
This is entirely object-oriented package for FEM simulations,
and I want to find out as soon as possible will I be able
to fit my calculations into 4GB on Sun E450 or not.

I tried gdb under Linux today, but even having a manual
for version 4.14 in front of me I can't find how (if possible)
to do it.
I searched dejanews and I found someone mentioned that
dbx under Sun might be of better help.
Given my tough time schedule, could some one advise me
please on which available platform I can get run-time memory
usage information and which are tools better to use ?

Thanks a lot for any help,

Andrei

2. * Passing environment vars to the same shell! *

3. fine tracing memory usage ?

4. Looking for Screen Splitting program for shell enviroment

5. what is the command to trace exact memory usage for a C/C++ program?

6. RH5.2 + UDB + PCMCIA?

7. Quota-like limit on cpu-usage/memory-usage...

8. Question about mail and /etc/nodename

9. System info (cpu usage, memory usage, etc) using SNMP?

10. How to find out the cpu usage, real & virtual memory usage ?

11. question about process memory usage and process memory limits

12. Q: How to control usage of memory for memory-mapped I/O?

13. Is "shared memory" a way to reduce physical memory usage?