472,795 Members | 2,441 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,795 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 2145
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
linyimin
by: linyimin | last post by:
Spring Startup Analyzer generates an interactive Spring application startup report that lets you understand what contributes to the application startup time and helps to optimize it. Support for...
0
by: erikbower65 | last post by:
Here's a concise step-by-step guide for manually installing IntelliJ IDEA: 1. Download: Visit the official JetBrains website and download the IntelliJ IDEA Community or Ultimate edition based on...
0
by: kcodez | last post by:
As a H5 game development enthusiast, I recently wrote a very interesting little game - Toy Claw ((http://claw.kjeek.com/))。Here I will summarize and share the development experience here, and hope it...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Sept 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: Taofi | last post by:
I try to insert a new record but the error message says the number of query names and destination fields are not the same This are my field names ID, Budgeted, Actual, Status and Differences ...
14
DJRhino1175
by: DJRhino1175 | last post by:
When I run this code I get an error, its Run-time error# 424 Object required...This is my first attempt at doing something like this. I test the entire code and it worked until I added this - If...
0
by: Rina0 | last post by:
I am looking for a Python code to find the longest common subsequence of two strings. I found this blog post that describes the length of longest common subsequence problem and provides a solution in...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
0
by: Mushico | last post by:
How to calculate date of retirement from date of birth

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.