What is the time unit that strace uses when displaying time spent in syscalls?

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











up vote
4
down vote

favorite












When using the command strace with the flag -T, I would like to know what is the time unit used to display time spent in syscalls? I assume it should be in seconds, but I am not quite sure and it seems to be omitted from the manual.










share|improve this question









New contributor




user311285 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.























    up vote
    4
    down vote

    favorite












    When using the command strace with the flag -T, I would like to know what is the time unit used to display time spent in syscalls? I assume it should be in seconds, but I am not quite sure and it seems to be omitted from the manual.










    share|improve this question









    New contributor




    user311285 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
    Check out our Code of Conduct.





















      up vote
      4
      down vote

      favorite









      up vote
      4
      down vote

      favorite











      When using the command strace with the flag -T, I would like to know what is the time unit used to display time spent in syscalls? I assume it should be in seconds, but I am not quite sure and it seems to be omitted from the manual.










      share|improve this question









      New contributor




      user311285 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.











      When using the command strace with the flag -T, I would like to know what is the time unit used to display time spent in syscalls? I assume it should be in seconds, but I am not quite sure and it seems to be omitted from the manual.







      linux process system-calls strace syscalls






      share|improve this question









      New contributor




      user311285 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.











      share|improve this question









      New contributor




      user311285 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.









      share|improve this question




      share|improve this question








      edited 16 mins ago









      Goro

      2,55141849




      2,55141849






      New contributor




      user311285 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.









      asked 48 mins ago









      user311285

      232




      232




      New contributor




      user311285 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.





      New contributor





      user311285 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.






      user311285 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.




















          3 Answers
          3






          active

          oldest

          votes

















          up vote
          5
          down vote



          accepted










          From the source code:



          if (Tflag) 
          ts_sub(ts, ts, &tcp->etime);
          tprintf(" <%ld.%06ld>",
          (long) ts->tv_sec, (long) ts->tv_nsec / 1000);



          This means that the time is shown in seconds, with microseconds (calculated from the nanosecond value) after the decimal point.






          share|improve this answer



























            up vote
            4
            down vote













            If you run



            strace -T sleep 2


            you will see



            nanosleep(tv_sec=2, tv_nsec=0, NULL) = 0 <2.000230>


            so it looks like the time spent is in seconds.






            share|improve this answer



























              up vote
              4
              down vote













              If you run the command strace using the "flag -c" it will show you a table and the time is reported in seconds:



              strace -c -p 3569 # 3569 is PID
              strace: Process 3569 attached
              ^Cstrace: Process 3569 detached
              % time seconds usecs/call calls errors syscall
              ------ ----------- ----------- --------- --------- ----------------
              99.73 0.016000 8 1971 poll
              0.16 0.000025 0 509 75 futex
              0.06 0.000010 0 1985 1966 recvmsg
              0.06 0.000009 0 2336 mprotect
              0.00 0.000000 0 478 read
              0.00 0.000000 0 13 write
              0.00 0.000000 0 29 mmap
              0.00 0.000000 0 9 munmap
              0.00 0.000000 0 18 writev
              0.00 0.000000 0 351 madvise
              0.00 0.000000 0 1 restart_syscall
              ------ ----------- ----------- --------- --------- ----------------
              100.00 0.016044 7700 2041 total


              from strace's man




              -c



              Count time, calls, and errors for each system call and report a
              summary on program exit. On Linux, this attempts to show system time
              (CPU time spent running in the kernel) independent of wall clock time.
              If -c is used with -f or -F (below), only aggregate totals for all
              traced processes are kept.







              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: false,
                showLowRepImageUploadWarning: true,
                reputationToPostImages: null,
                bindNavPrevention: true,
                postfix: "",
                onDemand: true,
                discardSelector: ".discard-answer"
                ,immediatelyShowMarkdownHelp:true
                );



                );






                user311285 is a new contributor. Be nice, and check out our Code of Conduct.









                 

                draft saved


                draft discarded


















                StackExchange.ready(
                function ()
                StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f469585%2fwhat-is-the-time-unit-that-strace-uses-when-displaying-time-spent-in-syscalls%23new-answer', 'question_page');

                );

                Post as a guest






























                3 Answers
                3






                active

                oldest

                votes








                3 Answers
                3






                active

                oldest

                votes









                active

                oldest

                votes






                active

                oldest

                votes








                up vote
                5
                down vote



                accepted










                From the source code:



                if (Tflag) 
                ts_sub(ts, ts, &tcp->etime);
                tprintf(" <%ld.%06ld>",
                (long) ts->tv_sec, (long) ts->tv_nsec / 1000);



                This means that the time is shown in seconds, with microseconds (calculated from the nanosecond value) after the decimal point.






                share|improve this answer
























                  up vote
                  5
                  down vote



                  accepted










                  From the source code:



                  if (Tflag) 
                  ts_sub(ts, ts, &tcp->etime);
                  tprintf(" <%ld.%06ld>",
                  (long) ts->tv_sec, (long) ts->tv_nsec / 1000);



                  This means that the time is shown in seconds, with microseconds (calculated from the nanosecond value) after the decimal point.






                  share|improve this answer






















                    up vote
                    5
                    down vote



                    accepted







                    up vote
                    5
                    down vote



                    accepted






                    From the source code:



                    if (Tflag) 
                    ts_sub(ts, ts, &tcp->etime);
                    tprintf(" <%ld.%06ld>",
                    (long) ts->tv_sec, (long) ts->tv_nsec / 1000);



                    This means that the time is shown in seconds, with microseconds (calculated from the nanosecond value) after the decimal point.






                    share|improve this answer












                    From the source code:



                    if (Tflag) 
                    ts_sub(ts, ts, &tcp->etime);
                    tprintf(" <%ld.%06ld>",
                    (long) ts->tv_sec, (long) ts->tv_nsec / 1000);



                    This means that the time is shown in seconds, with microseconds (calculated from the nanosecond value) after the decimal point.







                    share|improve this answer












                    share|improve this answer



                    share|improve this answer










                    answered 40 mins ago









                    Stephen Kitt

                    145k22318383




                    145k22318383






















                        up vote
                        4
                        down vote













                        If you run



                        strace -T sleep 2


                        you will see



                        nanosleep(tv_sec=2, tv_nsec=0, NULL) = 0 <2.000230>


                        so it looks like the time spent is in seconds.






                        share|improve this answer
























                          up vote
                          4
                          down vote













                          If you run



                          strace -T sleep 2


                          you will see



                          nanosleep(tv_sec=2, tv_nsec=0, NULL) = 0 <2.000230>


                          so it looks like the time spent is in seconds.






                          share|improve this answer






















                            up vote
                            4
                            down vote










                            up vote
                            4
                            down vote









                            If you run



                            strace -T sleep 2


                            you will see



                            nanosleep(tv_sec=2, tv_nsec=0, NULL) = 0 <2.000230>


                            so it looks like the time spent is in seconds.






                            share|improve this answer












                            If you run



                            strace -T sleep 2


                            you will see



                            nanosleep(tv_sec=2, tv_nsec=0, NULL) = 0 <2.000230>


                            so it looks like the time spent is in seconds.







                            share|improve this answer












                            share|improve this answer



                            share|improve this answer










                            answered 41 mins ago









                            meuh

                            29.9k11751




                            29.9k11751




















                                up vote
                                4
                                down vote













                                If you run the command strace using the "flag -c" it will show you a table and the time is reported in seconds:



                                strace -c -p 3569 # 3569 is PID
                                strace: Process 3569 attached
                                ^Cstrace: Process 3569 detached
                                % time seconds usecs/call calls errors syscall
                                ------ ----------- ----------- --------- --------- ----------------
                                99.73 0.016000 8 1971 poll
                                0.16 0.000025 0 509 75 futex
                                0.06 0.000010 0 1985 1966 recvmsg
                                0.06 0.000009 0 2336 mprotect
                                0.00 0.000000 0 478 read
                                0.00 0.000000 0 13 write
                                0.00 0.000000 0 29 mmap
                                0.00 0.000000 0 9 munmap
                                0.00 0.000000 0 18 writev
                                0.00 0.000000 0 351 madvise
                                0.00 0.000000 0 1 restart_syscall
                                ------ ----------- ----------- --------- --------- ----------------
                                100.00 0.016044 7700 2041 total


                                from strace's man




                                -c



                                Count time, calls, and errors for each system call and report a
                                summary on program exit. On Linux, this attempts to show system time
                                (CPU time spent running in the kernel) independent of wall clock time.
                                If -c is used with -f or -F (below), only aggregate totals for all
                                traced processes are kept.







                                share|improve this answer
























                                  up vote
                                  4
                                  down vote













                                  If you run the command strace using the "flag -c" it will show you a table and the time is reported in seconds:



                                  strace -c -p 3569 # 3569 is PID
                                  strace: Process 3569 attached
                                  ^Cstrace: Process 3569 detached
                                  % time seconds usecs/call calls errors syscall
                                  ------ ----------- ----------- --------- --------- ----------------
                                  99.73 0.016000 8 1971 poll
                                  0.16 0.000025 0 509 75 futex
                                  0.06 0.000010 0 1985 1966 recvmsg
                                  0.06 0.000009 0 2336 mprotect
                                  0.00 0.000000 0 478 read
                                  0.00 0.000000 0 13 write
                                  0.00 0.000000 0 29 mmap
                                  0.00 0.000000 0 9 munmap
                                  0.00 0.000000 0 18 writev
                                  0.00 0.000000 0 351 madvise
                                  0.00 0.000000 0 1 restart_syscall
                                  ------ ----------- ----------- --------- --------- ----------------
                                  100.00 0.016044 7700 2041 total


                                  from strace's man




                                  -c



                                  Count time, calls, and errors for each system call and report a
                                  summary on program exit. On Linux, this attempts to show system time
                                  (CPU time spent running in the kernel) independent of wall clock time.
                                  If -c is used with -f or -F (below), only aggregate totals for all
                                  traced processes are kept.







                                  share|improve this answer






















                                    up vote
                                    4
                                    down vote










                                    up vote
                                    4
                                    down vote









                                    If you run the command strace using the "flag -c" it will show you a table and the time is reported in seconds:



                                    strace -c -p 3569 # 3569 is PID
                                    strace: Process 3569 attached
                                    ^Cstrace: Process 3569 detached
                                    % time seconds usecs/call calls errors syscall
                                    ------ ----------- ----------- --------- --------- ----------------
                                    99.73 0.016000 8 1971 poll
                                    0.16 0.000025 0 509 75 futex
                                    0.06 0.000010 0 1985 1966 recvmsg
                                    0.06 0.000009 0 2336 mprotect
                                    0.00 0.000000 0 478 read
                                    0.00 0.000000 0 13 write
                                    0.00 0.000000 0 29 mmap
                                    0.00 0.000000 0 9 munmap
                                    0.00 0.000000 0 18 writev
                                    0.00 0.000000 0 351 madvise
                                    0.00 0.000000 0 1 restart_syscall
                                    ------ ----------- ----------- --------- --------- ----------------
                                    100.00 0.016044 7700 2041 total


                                    from strace's man




                                    -c



                                    Count time, calls, and errors for each system call and report a
                                    summary on program exit. On Linux, this attempts to show system time
                                    (CPU time spent running in the kernel) independent of wall clock time.
                                    If -c is used with -f or -F (below), only aggregate totals for all
                                    traced processes are kept.







                                    share|improve this answer












                                    If you run the command strace using the "flag -c" it will show you a table and the time is reported in seconds:



                                    strace -c -p 3569 # 3569 is PID
                                    strace: Process 3569 attached
                                    ^Cstrace: Process 3569 detached
                                    % time seconds usecs/call calls errors syscall
                                    ------ ----------- ----------- --------- --------- ----------------
                                    99.73 0.016000 8 1971 poll
                                    0.16 0.000025 0 509 75 futex
                                    0.06 0.000010 0 1985 1966 recvmsg
                                    0.06 0.000009 0 2336 mprotect
                                    0.00 0.000000 0 478 read
                                    0.00 0.000000 0 13 write
                                    0.00 0.000000 0 29 mmap
                                    0.00 0.000000 0 9 munmap
                                    0.00 0.000000 0 18 writev
                                    0.00 0.000000 0 351 madvise
                                    0.00 0.000000 0 1 restart_syscall
                                    ------ ----------- ----------- --------- --------- ----------------
                                    100.00 0.016044 7700 2041 total


                                    from strace's man




                                    -c



                                    Count time, calls, and errors for each system call and report a
                                    summary on program exit. On Linux, this attempts to show system time
                                    (CPU time spent running in the kernel) independent of wall clock time.
                                    If -c is used with -f or -F (below), only aggregate totals for all
                                    traced processes are kept.








                                    share|improve this answer












                                    share|improve this answer



                                    share|improve this answer










                                    answered 34 mins ago









                                    Goro

                                    2,55141849




                                    2,55141849




















                                        user311285 is a new contributor. Be nice, and check out our Code of Conduct.









                                         

                                        draft saved


                                        draft discarded


















                                        user311285 is a new contributor. Be nice, and check out our Code of Conduct.












                                        user311285 is a new contributor. Be nice, and check out our Code of Conduct.











                                        user311285 is a new contributor. Be nice, and check out our Code of Conduct.













                                         


                                        draft saved


                                        draft discarded














                                        StackExchange.ready(
                                        function ()
                                        StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f469585%2fwhat-is-the-time-unit-that-strace-uses-when-displaying-time-spent-in-syscalls%23new-answer', 'question_page');

                                        );

                                        Post as a guest













































































                                        Comments

                                        Popular posts from this blog

                                        Long meetings (6-7 hours a day): Being “babysat” by supervisor

                                        What does second last employer means? [closed]

                                        One-line joke