473,394 Members | 1,700 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Good ways to analyze a running c-program?

I would like to analyze my running c-program.

What I would like to know for example is the range of the entire
address space of my running c-program (memory reserved for/by the
running program), starting address and sizes of text (code), stack,
heap, bss, constant data, linked in libraries, etc.

What are some good ways to extract this kind of information?

What (free) tools are the most common ones for displaying this kind of
information?

The main reason for this analysis is that I want to understand exactly
how my c-source code transforms to a running program and what memory
regions the program uses and for what the memory regions are used. An
example could be for example that I wanted to display all the constant
data (variables declared with the const modifier) of the running
program, is that possible?

BR!

Dec 30 '06 #1
6 2178
dspfun a écrit :
I would like to analyze my running c-program.

What I would like to know for example is the range of the entire
address space of my running c-program (memory reserved for/by the
running program), starting address and sizes of text (code), stack,
heap, bss, constant data, linked in libraries, etc.

What are some good ways to extract this kind of information?

What (free) tools are the most common ones for displaying this kind of
information?

The main reason for this analysis is that I want to understand exactly
how my c-source code transforms to a running program and what memory
regions the program uses and for what the memory regions are used. An
example could be for example that I wanted to display all the constant
data (variables declared with the const modifier) of the running
program, is that possible?

BR!
So, you want to invest zero in software and get highly sophisticated
results...

This depends on your OS. If you run under linux you can try
the GNU profiler but last time I looked at it I do not remember
that it gave this kind of information. Other tools like "top",
can give you more info, but they are not really reliable. The man
page of top says for instance
TSIZE
The code size of the task. This gives strange values
for kernel processes and is broken for ELF processes.

Since all processes are ELF processes... this will not go very far.
But maybe this has improved in later versions, I really do not know.

Another possibility is tha you call yourself routines that give
this kind of info in your program and you call them at some
specific time, etc.

Under windows you can have several tools for doing that, but the only
really free one is the task manager, that will display the
memory/handles/paged/non paged memory/memory usage delta/
page faults/ and many other information.

Better tools are Intel's profiler, that is an excellent one
and will give you more detailed info. It costs around 500 US$.

If (under windows) you use the lcc-win32 debugger it will show you the stack
size of each thread but not when the process is running...
MMM... you give an idea. An oscilloscope-like display of memory usage
would be nice actually.
Dec 31 '06 #2
jacob navia wrote:
dspfun a écrit :
>I would like to analyze my running c-program.

What I would like to know for example is the range of the entire
address space of my running c-program (memory reserved for/by the
running program), starting address and sizes of text (code), stack,
heap, bss, constant data, linked in libraries, etc.
.... snip ...
>
Under windows you can have several tools for doing that, but the
only really free one is the task manager, that will display the
memory/handles/paged/non paged memory/memory usage delta/
page faults/ and many other information.
Look up prcview. <http://www.teamcti.com/pview/prcview.htm>
--
Merry Christmas, Happy Hanukah, Happy New Year
Joyeux Noel, Bonne Annee.
Chuck F (cbfalconer at maineline dot net)
<http://cbfalconer.home.att.net>

Dec 31 '06 #3
CBFalconer a écrit :
jacob navia wrote:
>>dspfun a écrit :

>>>I would like to analyze my running c-program.

What I would like to know for example is the range of the entire
address space of my running c-program (memory reserved for/by the
running program), starting address and sizes of text (code), stack,
heap, bss, constant data, linked in libraries, etc.

... snip ...
>>Under windows you can have several tools for doing that, but the
only really free one is the task manager, that will display the
memory/handles/paged/non paged memory/memory usage delta/
page faults/ and many other information.


Look up prcview. <http://www.teamcti.com/pview/prcview.htm>

I downloaded that, it is a nice utility but it doesn't
display (as far as I see) any memory information...

Dec 31 '06 #4
On Sun, 31 Dec 2006 01:37:33 +0100, in comp.lang.c , jacob navia
<ja***@jacob.remcomp.frwrote:
>dspfun a écrit :
>I would like to analyze my running c-program.

What I would like to know for example is the range of the entire
address space of my running c-program (memory reserved for/by the
running program), starting address and sizes of text (code), stack,
heap, bss, constant data, linked in libraries, etc.

What are some good ways to extract this kind of information?

What (free) tools are the most common ones for displaying this kind of
information?

So, you want to invest zero in software and get highly sophisticated
results...
No, he wants to use some free tools. You imply by the above that no
free software can be sophisticated, which is untrue as I'm sure you
know. There's even a compiler which is reputed to be fairly
sophisticated which is free.
>This depends on your OS.
Agreed. The OP wold be better advised to ask in a group specialising
in his OS, as such tools will be highly OS-dependent.
>can give you more info, but they are not really reliable. The man
page of top says for instance
(man pages are notorious for getting out of date mind you)
>Under windows you can have several tools for doing that, but the only
really free one is the task manager, that will display the
memory/handles/paged/non paged memory/memory usage delta/
page faults/ and many other information.
FWIW there /are/ various free profiling and analysis tools for
Windows, eg at winternals.com
>MMM... you give an idea. An oscilloscope-like display of memory usage
would be nice actually.
procexp.exe

--
Mark McIntyre

"Debugging is twice as hard as writing the code in the first place.
Therefore, if you write the code as cleverly as possible, you are,
by definition, not smart enough to debug it."
--Brian Kernighan
Dec 31 '06 #5
jacob navia wrote:
CBFalconer a écrit :
.... snip ...
>>
Look up prcview. <http://www.teamcti.com/pview/prcview.htm>

I downloaded that, it is a nice utility but it doesn't
display (as far as I see) any memory information...
Select the process. Then: Process | Memory.

--
Some informative links:
<http://members.fortunecity.com/nnqweb/ (newusers)
<http://www.catb.org/~esr/faqs/smart-questions.html>
<http://www.caliburn.nl/topposting.html>
<http://www.netmeister.org/news/learn2quote.html>
<http://cfaj.freeshell.org/google/ (taming google)
Dec 31 '06 #6
look at this program
http://www.microsoft.com/technet/sys...sExplorer.mspx
and other of sysinternals

Dec 31 '06 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: AaronV | last post by:
Hello, I'm a webmaster for a college newspaper and I'm implementing an article search. I'm running PHP with a MySQL database to store the weekly stories. Does anyone know of an article that...
6
by: Holger Marzen | last post by:
Hi all, the docs are not clear for me. If I want (in version 7.1.x, 7.2.x) to help the analyzer AND free unused space do I have to do a vacuum vacuum analyze or is a
10
by: Greg Stark | last post by:
This query is odd, it seems to be taking over a second according to my log_duration logs and according to psql's \timing numbers. However explain analyze says it's running in about a third of a...
3
by: Joseph Shraibman | last post by:
Trying this: VACUUM VERBOSE ANALYZE; on a 7.4.1 database only does a vacuum, not the analyze. I've tried this on two seperate databases. Is this a known bug? I haven't seen anything about...
0
by: DB Developer | last post by:
This is in Springfield, Illinois. It is to monitor SQL calls and analyze the DB performance with the tools that come with DB2 or public domain tools. This is DB2/UDB running under AIX on a...
3
by: user_5701 | last post by:
Hello, I have an Access 2000 database that I need to export certain queries to Excel 2000. The problem is that I have to take the toolbars away from the users for security purposes, but still let...
5
by: Jon Lapham | last post by:
I have been using the EXPLAIN ANALYZE command to debug some performance bottlenecks in my database. In doing so, I have found an oddity (to me anyway). The "19ms" total runtime reported below...
16
by: Ed L. | last post by:
I'm getting a slew of these repeatable errors when running ANALYZE and/or VACUUM ANALYZE (from an autovacuum process) against a 7.3.4 cluster on HP-UX B.11.00: 2004-09-29 18:14:53.621 ERROR:...
4
by: Ed L. | last post by:
I *think* I'm seeing "vacuum analyze" queries launched automatically on an 8.0.0beta3 (unless I have a rogue autovac running that I haven't spotted). Is this something new in 8.0 and to be...
6
by: George M. Garner Jr. | last post by:
VC8.0 crashes while compiling boost-1.33.1 serialization library (or any other library that includes the serialization headers) if code analysis (/analyze) is enabled. This problem did not occur...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.