Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re^2: tracing system calls a perl script is making

by shmem (Canon)
on May 31, 2013 at 17:52 UTC ( #1036278=note: print w/ replies, xml ) Need Help??


in reply to Re: tracing system calls a perl script is making
in thread tracing system calls a perl script is making

Anything between those is your program

...which while block buffered, on my box is optimized into a single write() system call ;-)

strace perl -le 'INIT{ print "About to start running code" } END{print "code ending"} print "hello"' 2>&1 | less execve("/usr/bin/perl", ["perl", "-le", "INIT{ print \"About to start +runn"...], [/* 51 vars */]) = 0 brk(0) = 0x1bc9000 mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, +0) = 0x7fc0fdf2f000 ... rt_sigaction(SIGIO, NULL, {SIG_DFL, [], 0}, 8) = 0 rt_sigaction(SIGSYS, NULL, {SIG_DFL, [], 0}, 8) = 0 write(1, "About to start running code\nhell"..., 46About to start runn +ing code hello code ending ) = 46 exit_group(0) = ? +++ exited with 0 +++

I wished only half of the programs in my linux distro were half as good as the perl optimizer. Not to mention the stuff I am perlpetrating :)


Comment on Re^2: tracing system calls a perl script is making
Select or Download Code
Re^3: tracing system calls a perl script is making
by BrowserUk (Pope) on May 31, 2013 at 18:46 UTC

    He can use warn or print STDERR to prevent that.


    With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
    Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
    "Science is about questioning the status quo. Questioning authority".
    In the absence of evidence, opinion is indistinguishable from prejudice.

      Of course. Setting $| to true also helps. TIMTOWTDI :-)

        I'm generally suspicious of $| ability to ensure that stdout and stderr coordinate when outputting to a file. Hence advocating outputting to the same handle.

        I'd swear I've had problems in the past; but it is possible that it was due to threading rather than IO per se.


        With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
        Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
        "Science is about questioning the status quo. Questioning authority".
        In the absence of evidence, opinion is indistinguishable from prejudice.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1036278]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (4)
As of 2015-07-05 08:42 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (61 votes), past polls