Is there a command to show tracepoints “live”, which includes the PID?

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
0
down vote

favorite












I have tried looking at the documentation for perf script, perf trace, and trace-cmd, including the list of commands in "SEE ALSO".



I can trace e.g. sched:sched_process_exec "live" using perf trace -a --no-syscalls -e sched:sched_process_exec. However, it only shows the process name (e.g. ls). It does not show the PID, unless the tracepoint has a specific parameter for it. perf script always shows the PID, but it does not show live output; it shows the contents of a perf.data file.



I don't need this to be a single command, like btrace is for blktrace. I am happy to use a pipeline, analogous to blktrace -d /dev/sda -o - | blkparse -i -.



(Both of the above commands show PIDs :-). It is frustrating to see the blktrace family of commands, which also use trace events, can print live output in the same format as they can print recorded traces. I can't find such power in the general-purpose tracing tools!)










share|improve this question



























    up vote
    0
    down vote

    favorite












    I have tried looking at the documentation for perf script, perf trace, and trace-cmd, including the list of commands in "SEE ALSO".



    I can trace e.g. sched:sched_process_exec "live" using perf trace -a --no-syscalls -e sched:sched_process_exec. However, it only shows the process name (e.g. ls). It does not show the PID, unless the tracepoint has a specific parameter for it. perf script always shows the PID, but it does not show live output; it shows the contents of a perf.data file.



    I don't need this to be a single command, like btrace is for blktrace. I am happy to use a pipeline, analogous to blktrace -d /dev/sda -o - | blkparse -i -.



    (Both of the above commands show PIDs :-). It is frustrating to see the blktrace family of commands, which also use trace events, can print live output in the same format as they can print recorded traces. I can't find such power in the general-purpose tracing tools!)










    share|improve this question

























      up vote
      0
      down vote

      favorite









      up vote
      0
      down vote

      favorite











      I have tried looking at the documentation for perf script, perf trace, and trace-cmd, including the list of commands in "SEE ALSO".



      I can trace e.g. sched:sched_process_exec "live" using perf trace -a --no-syscalls -e sched:sched_process_exec. However, it only shows the process name (e.g. ls). It does not show the PID, unless the tracepoint has a specific parameter for it. perf script always shows the PID, but it does not show live output; it shows the contents of a perf.data file.



      I don't need this to be a single command, like btrace is for blktrace. I am happy to use a pipeline, analogous to blktrace -d /dev/sda -o - | blkparse -i -.



      (Both of the above commands show PIDs :-). It is frustrating to see the blktrace family of commands, which also use trace events, can print live output in the same format as they can print recorded traces. I can't find such power in the general-purpose tracing tools!)










      share|improve this question















      I have tried looking at the documentation for perf script, perf trace, and trace-cmd, including the list of commands in "SEE ALSO".



      I can trace e.g. sched:sched_process_exec "live" using perf trace -a --no-syscalls -e sched:sched_process_exec. However, it only shows the process name (e.g. ls). It does not show the PID, unless the tracepoint has a specific parameter for it. perf script always shows the PID, but it does not show live output; it shows the contents of a perf.data file.



      I don't need this to be a single command, like btrace is for blktrace. I am happy to use a pipeline, analogous to blktrace -d /dev/sda -o - | blkparse -i -.



      (Both of the above commands show PIDs :-). It is frustrating to see the blktrace family of commands, which also use trace events, can print live output in the same format as they can print recorded traces. I can't find such power in the general-purpose tracing tools!)







      linux linux-kernel perf tracing






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Nov 21 at 12:10

























      asked Nov 21 at 11:46









      sourcejedi

      22k43396




      22k43396




















          1 Answer
          1






          active

          oldest

          votes

















          up vote
          0
          down vote













          perf record -a --no-syscalls -e sched:sched_process_exec sh -c read | perf script


          (sh -c read provides a way to stop this trace, just hit Enter. If I omit this command and try to interrupt the pipeline with ctrl+C, my output is lost, probably because it also interrupts perf script).



          However this output is not "live", due to buffering. E.g. running the above command shows nothing, but hitting enter causes it to stop and show a line for the exec() of sh. blktrace has special-case code to handle output to a pipe, including disabling the default C stdio buffering. Attempting to run perf record under the unbuffer command gives the error "incompatible file format"; I presume the error comes from perf script.





          man perf-report



          ...



          OPTIONS



          -i, --input= Input file name. (default: perf.data unless stdin is a fifo)







          share|improve this answer




















            Your Answer








            StackExchange.ready(function()
            var channelOptions =
            tags: "".split(" "),
            id: "106"
            ;
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function()
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled)
            StackExchange.using("snippets", function()
            createEditor();
            );

            else
            createEditor();

            );

            function createEditor()
            StackExchange.prepareEditor(
            heartbeatType: 'answer',
            convertImagesToLinks: false,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: null,
            bindNavPrevention: true,
            postfix: "",
            imageUploader:
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            ,
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            );



            );













             

            draft saved


            draft discarded


















            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f483189%2fis-there-a-command-to-show-tracepoints-live-which-includes-the-pid%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown

























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes








            up vote
            0
            down vote













            perf record -a --no-syscalls -e sched:sched_process_exec sh -c read | perf script


            (sh -c read provides a way to stop this trace, just hit Enter. If I omit this command and try to interrupt the pipeline with ctrl+C, my output is lost, probably because it also interrupts perf script).



            However this output is not "live", due to buffering. E.g. running the above command shows nothing, but hitting enter causes it to stop and show a line for the exec() of sh. blktrace has special-case code to handle output to a pipe, including disabling the default C stdio buffering. Attempting to run perf record under the unbuffer command gives the error "incompatible file format"; I presume the error comes from perf script.





            man perf-report



            ...



            OPTIONS



            -i, --input= Input file name. (default: perf.data unless stdin is a fifo)







            share|improve this answer
























              up vote
              0
              down vote













              perf record -a --no-syscalls -e sched:sched_process_exec sh -c read | perf script


              (sh -c read provides a way to stop this trace, just hit Enter. If I omit this command and try to interrupt the pipeline with ctrl+C, my output is lost, probably because it also interrupts perf script).



              However this output is not "live", due to buffering. E.g. running the above command shows nothing, but hitting enter causes it to stop and show a line for the exec() of sh. blktrace has special-case code to handle output to a pipe, including disabling the default C stdio buffering. Attempting to run perf record under the unbuffer command gives the error "incompatible file format"; I presume the error comes from perf script.





              man perf-report



              ...



              OPTIONS



              -i, --input= Input file name. (default: perf.data unless stdin is a fifo)







              share|improve this answer






















                up vote
                0
                down vote










                up vote
                0
                down vote









                perf record -a --no-syscalls -e sched:sched_process_exec sh -c read | perf script


                (sh -c read provides a way to stop this trace, just hit Enter. If I omit this command and try to interrupt the pipeline with ctrl+C, my output is lost, probably because it also interrupts perf script).



                However this output is not "live", due to buffering. E.g. running the above command shows nothing, but hitting enter causes it to stop and show a line for the exec() of sh. blktrace has special-case code to handle output to a pipe, including disabling the default C stdio buffering. Attempting to run perf record under the unbuffer command gives the error "incompatible file format"; I presume the error comes from perf script.





                man perf-report



                ...



                OPTIONS



                -i, --input= Input file name. (default: perf.data unless stdin is a fifo)







                share|improve this answer












                perf record -a --no-syscalls -e sched:sched_process_exec sh -c read | perf script


                (sh -c read provides a way to stop this trace, just hit Enter. If I omit this command and try to interrupt the pipeline with ctrl+C, my output is lost, probably because it also interrupts perf script).



                However this output is not "live", due to buffering. E.g. running the above command shows nothing, but hitting enter causes it to stop and show a line for the exec() of sh. blktrace has special-case code to handle output to a pipe, including disabling the default C stdio buffering. Attempting to run perf record under the unbuffer command gives the error "incompatible file format"; I presume the error comes from perf script.





                man perf-report



                ...



                OPTIONS



                -i, --input= Input file name. (default: perf.data unless stdin is a fifo)








                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Nov 21 at 12:37









                sourcejedi

                22k43396




                22k43396



























                     

                    draft saved


                    draft discarded















































                     


                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function ()
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f483189%2fis-there-a-command-to-show-tracepoints-live-which-includes-the-pid%23new-answer', 'question_page');

                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown






                    Popular posts from this blog

                    How to check contact read email or not when send email to Individual?

                    Displaying single band from multi-band raster using QGIS

                    How many registers does an x86_64 CPU actually have?