* atom (hiprof) woes
@ 2001-01-04 20:21 Rajanish Calisa
2001-01-05 15:11 ` Robert Mulley
0 siblings, 1 reply; 3+ messages in thread
From: Rajanish Calisa @ 2001-01-04 20:21 UTC (permalink / raw)
Hi all,
We are using Digital Unix 4.0D, Atom(V2.17f/V2.17d), DEC C++(6.2).
I am trying to use hiprof to profile a multi-threaded app.
To begin with, I wrote a simple program as given below to
tried to profile it:
-----------------------------------------------------------
int
bar()
{
for ( int i = 0 ; i < 100 ; i++ ) ;
return 0 ;
}
int
foo()
{
for ( int i = 0 ; i < 100 ; i++ ) { bar() ; }
return 0 ;
}
int
main()
{
for ( int i = 0 ; i < 100 ; i++ ) { foo() ; }
return 0 ;
}
-------------------------------------------------------
I compiled the program as follows:
cxx -g -pthread hp.cc -o hp
I tried to profile it as follows:
atom hp -tool hiprof -env threads \
-toolargs="-textout -cputime -threads" -all -g
When I run hp.hiprof.threads, I get the following message:
Hiprof Panic: hacked stack back to nothing
I do not understand what I am doing wrong, when the "threads"
option is not specified during profile and compilation time
it seems to work fine.
Any help in this regard is appreciated.
Thanks
rajanish...
Sent via Deja.com
http://www.deja.com/
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: atom (hiprof) woes
2001-01-04 20:21 atom (hiprof) woes Rajanish Calisa
@ 2001-01-05 15:11 ` Robert Mulley
2001-01-05 23:00 ` Rajanish Calisa
0 siblings, 1 reply; 3+ messages in thread
From: Robert Mulley @ 2001-01-05 15:11 UTC (permalink / raw)
Rajanish Calisa wrote:
> Hi all,
>
> We are using Digital Unix 4.0D, Atom(V2.17f/V2.17d), DEC C++(6.2).
>
> I am trying to use hiprof to profile a multi-threaded app.
> To begin with, I wrote a simple program as given below to
> tried to profile it:
>
> -----------------------------------------------------------
> int
> bar()
> {
> for ( int i = 0 ; i < 100 ; i++ ) ;
> return 0 ;
> }
>
> int
> foo()
> {
> for ( int i = 0 ; i < 100 ; i++ ) { bar() ; }
> return 0 ;
> }
>
> int
> main()
> {
> for ( int i = 0 ; i < 100 ; i++ ) { foo() ; }
> return 0 ;
> }
> -------------------------------------------------------
>
> I compiled the program as follows:
> cxx -g -pthread hp.cc -o hp
>
> I tried to profile it as follows:
> atom hp -tool hiprof -env threads \
> -toolargs="-textout -cputime -threads" -all -g
>
> When I run hp.hiprof.threads, I get the following message:
> Hiprof Panic: hacked stack back to nothing
>
> I do not understand what I am doing wrong, when the "threads"
> option is not specified during profile and compilation time
> it seems to work fine.
>
> Any help in this regard is appreciated.
>
> Thanks
>
> rajanish...
>
> Sent via Deja.com
> http://www.deja.com/
The problem lies in the fact that this is not a multi-threaded program.
Nothing about it is thread aware. Every thing is executed sequentially.
ie main calls foo which calls bar 100 times, then main calls foo which
calls bar 100 times. In total main calls foo 100 times.
You need to read up some more about thread programming.
Robert Mulley
Unix admin
Standard Disclaimer: I could be completely wrong but I think I'm right.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: atom (hiprof) woes
2001-01-05 15:11 ` Robert Mulley
@ 2001-01-05 23:00 ` Rajanish Calisa
0 siblings, 0 replies; 3+ messages in thread
From: Rajanish Calisa @ 2001-01-05 23:00 UTC (permalink / raw)
Robert Mulley <gnscon@one.net.au> wrote in message
news:3A55E434.D4EE19DF@one.net.au...
> Rajanish Calisa wrote:
>
> > Hi all,
> >
> > We are using Digital Unix 4.0D, Atom(V2.17f/V2.17d), DEC C++(6.2).
> >
> > I am trying to use hiprof to profile a multi-threaded app.
> > To begin with, I wrote a simple program as given below to
> > tried to profile it:
> >
> > -----------------------------------------------------------
> > int
> > bar()
> > {
> > for ( int i = 0 ; i < 100 ; i++ ) ;
> > return 0 ;
> > }
> >
> > int
> > foo()
> > {
> > for ( int i = 0 ; i < 100 ; i++ ) { bar() ; }
> > return 0 ;
> > }
> >
> > int
> > main()
> > {
> > for ( int i = 0 ; i < 100 ; i++ ) { foo() ; }
> > return 0 ;
> > }
> > -------------------------------------------------------
> >
> > I compiled the program as follows:
> > cxx -g -pthread hp.cc -o hp
> >
> > I tried to profile it as follows:
> > atom hp -tool hiprof -env threads \
> > -toolargs="-textout -cputime -threads" -all -g
> >
> > When I run hp.hiprof.threads, I get the following message:
> > Hiprof Panic: hacked stack back to nothing
> >
> > I do not understand what I am doing wrong, when the "threads"
> > option is not specified during profile and compilation time
> > it seems to work fine.
> >
> > Any help in this regard is appreciated.
> >
> > Thanks
> >
> > rajanish...
> >
> > Sent via Deja.com
> > http://www.deja.com/
>
> The problem lies in the fact that this is not a multi-threaded program.
>
You are wrong. All multi-threaded programs initially start off with one
thread, but that does not mean that during such a time, hiprof will
not work. hiprof does not care if there is one thread or more, atleast
it does not document that I should create more than one thread to
make it work, if I specify "-threads" option. The "-threads" option
exists only to make hiprof aware that it is an MT program and it
provides thread-dependent analysis. Please read up the man pages
for "hiprof".
As a matter of fact, we are successfully using hiprof/atom on 4.0f.
That is why I mentioned at the beginning the versions of various
software that we use.
> Nothing about it is thread aware. Every thing is executed sequentially.
> ie main calls foo which calls bar 100 times, then main calls foo which
> calls bar 100 times. In total main calls foo 100 times.
>
I do not need a explanation of the program, I am the one who wrote it.
> You need to read up some more about thread programming.
>
I know about threads, I wanted to keep the program as simple as
possible.
rajanish...
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2001-01-05 23:00 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2001-01-04 20:21 atom (hiprof) woes Rajanish Calisa
2001-01-05 15:11 ` Robert Mulley
2001-01-05 23:00 ` Rajanish Calisa
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox