Re: timing a fork

2008-08-24 Thread Raymond Wan
Hi Rob, Sorry for the delay -- enjoyed the weekend away from the computer. :-) Rob Dixon wrote: Raymond Wan wrote: Rob Dixon wrote: use strict; use warnings; $|++; # autoflush $SIG{CHLD} = 'IGNORE'; my $kid = fork; if ($kid) { print "in parent whose kid is $kid\n"; sleep 10

Re: timing a fork

2008-08-22 Thread Rob Dixon
Raymond Wan wrote: > Rob Dixon wrote: >> >> use strict; >> use warnings; >> >> $|++; # autoflush >> >> $SIG{CHLD} = 'IGNORE'; >> >> my $kid = fork; >> >> if ($kid) { >> print "in parent whose kid is $kid\n"; >> sleep 10; >> my $running = kill(0, $kid); >> print "Child process ", $running ?

Re: timing a fork

2008-08-22 Thread Raymond Wan
Hi Rob, Rob Dixon wrote: Raymond Wan wrote: Rob Dixon wrote: What do you need to accomplish that something as simple as the code below won't do? use strict; use warnings; my $kid = fork; if ($kid) { print "in parent whose kid is $kid\n"; } elsif ($kid == 0) { print "In child\

Re: timing a fork

2008-08-22 Thread Rob Dixon
Raymond Wan wrote: > Rob Dixon wrote: >> >> What do you need to accomplish that something as simple as the code below >> won't do? >> >> use strict; >> use warnings; >> >> my $kid = fork; >> >> if ($kid) { >> print "in parent whose kid is $kid\n"; >> } >> elsif ($kid == 0) { >> print "In child

Re: timing a fork

2008-08-21 Thread Raymond Wan
Hi Rob, H, true -- I may be adding and adding code unnecessarily... What the forked process does is run a C++ program and it is that program that needs to be timed. Would the code below accomplish that? I mean, having "times" in the Perl script that calls that C++ program will give th

Re: timing a fork

2008-08-21 Thread Rob Dixon
Raymond Wan wrote: > > Thank you very much for your reply! I've actually been stuck on this > for a while...but with little knowledge about forking processes, I was a > quite stuck. > > John W. Krahn wrote: >> perldoc -f times > > Ah, didn't know about that. I thought to get user time, you h

Re: timing a fork

2008-08-20 Thread Raymond Wan
Hi John, Thank you very much for your reply! I've actually been stuck on this for a while...but with little knowledge about forking processes, I was a quite stuck. John W. Krahn wrote: perldoc -f times Ah, didn't know about that. I thought to get user time, you had to run something (s

Re: timing a fork

2008-08-20 Thread John W. Krahn
Raymond Wan wrote: Hi all, Hello, I'm trying to fork a process under modperl for a web server, but I've realized that the problem / misunderstanding that I'm having is unrelated to modperl...I get the same problem under Perl. What I want to do is to fork a child process (non-perl program