Output of nettop command











up vote
3
down vote

favorite












I want to calculate net transfer of bytes(in & out) for every 2 seconds.



I'm using nettop to know the usage(bytes_in and bytes_out).



Command:



nettop -x -k state -k interface -k rx_dupe -k rx_ooo -k re-tx -k rtt_avg -k rcvsize -k tx_win -k tc_class -k tc_mgt -k cc_algo -k P -k C -k R -k W -l 1 -t wifi -t wired


Taking bytes_in bytes_out according to application summary.



1Q). The data(bytes_in and bytes_out) displayed is calculated from startup for every application. Am I right?



I thought I'm right and ran the nettop command two times with 2 seconds interval and subtracted these two values to get the net transfer of bytes for 2 seconds.



But sometimes, the first output is greater than second output.



2Q). How is that possible? Always the second output must be greater or equal to first output right?



OS: macOS Sierra.










share|improve this question




























    up vote
    3
    down vote

    favorite












    I want to calculate net transfer of bytes(in & out) for every 2 seconds.



    I'm using nettop to know the usage(bytes_in and bytes_out).



    Command:



    nettop -x -k state -k interface -k rx_dupe -k rx_ooo -k re-tx -k rtt_avg -k rcvsize -k tx_win -k tc_class -k tc_mgt -k cc_algo -k P -k C -k R -k W -l 1 -t wifi -t wired


    Taking bytes_in bytes_out according to application summary.



    1Q). The data(bytes_in and bytes_out) displayed is calculated from startup for every application. Am I right?



    I thought I'm right and ran the nettop command two times with 2 seconds interval and subtracted these two values to get the net transfer of bytes for 2 seconds.



    But sometimes, the first output is greater than second output.



    2Q). How is that possible? Always the second output must be greater or equal to first output right?



    OS: macOS Sierra.










    share|improve this question


























      up vote
      3
      down vote

      favorite









      up vote
      3
      down vote

      favorite











      I want to calculate net transfer of bytes(in & out) for every 2 seconds.



      I'm using nettop to know the usage(bytes_in and bytes_out).



      Command:



      nettop -x -k state -k interface -k rx_dupe -k rx_ooo -k re-tx -k rtt_avg -k rcvsize -k tx_win -k tc_class -k tc_mgt -k cc_algo -k P -k C -k R -k W -l 1 -t wifi -t wired


      Taking bytes_in bytes_out according to application summary.



      1Q). The data(bytes_in and bytes_out) displayed is calculated from startup for every application. Am I right?



      I thought I'm right and ran the nettop command two times with 2 seconds interval and subtracted these two values to get the net transfer of bytes for 2 seconds.



      But sometimes, the first output is greater than second output.



      2Q). How is that possible? Always the second output must be greater or equal to first output right?



      OS: macOS Sierra.










      share|improve this question















      I want to calculate net transfer of bytes(in & out) for every 2 seconds.



      I'm using nettop to know the usage(bytes_in and bytes_out).



      Command:



      nettop -x -k state -k interface -k rx_dupe -k rx_ooo -k re-tx -k rtt_avg -k rcvsize -k tx_win -k tc_class -k tc_mgt -k cc_algo -k P -k C -k R -k W -l 1 -t wifi -t wired


      Taking bytes_in bytes_out according to application summary.



      1Q). The data(bytes_in and bytes_out) displayed is calculated from startup for every application. Am I right?



      I thought I'm right and ran the nettop command two times with 2 seconds interval and subtracted these two values to get the net transfer of bytes for 2 seconds.



      But sometimes, the first output is greater than second output.



      2Q). How is that possible? Always the second output must be greater or equal to first output right?



      OS: macOS Sierra.







      networking macos command-line terminal






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Mar 22 '17 at 12:04

























      asked Mar 22 '17 at 10:49









      SkrewEverything

      2007




      2007






















          1 Answer
          1






          active

          oldest

          votes

















          up vote
          0
          down vote













          It would make sense if the statistics were "calculated from startup for every application" but this doesn't appear to be the case. Confusingly, nettop maintains running totals since it started so you can get this data by starting a nettop session at the same time the application being observed is started but this is not really practical for most use cases.



          It's notable that the Network tab in Activity Monitor behaves in the same way (totals are from when it starts, not the application being observed) since the underlying operating system service is the same for both Activity Monitor and nettop.






          share|improve this answer





















            Your Answer








            StackExchange.ready(function() {
            var channelOptions = {
            tags: "".split(" "),
            id: "3"
            };
            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: true,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            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%2fsuperuser.com%2fquestions%2f1191161%2foutput-of-nettop-command%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













            It would make sense if the statistics were "calculated from startup for every application" but this doesn't appear to be the case. Confusingly, nettop maintains running totals since it started so you can get this data by starting a nettop session at the same time the application being observed is started but this is not really practical for most use cases.



            It's notable that the Network tab in Activity Monitor behaves in the same way (totals are from when it starts, not the application being observed) since the underlying operating system service is the same for both Activity Monitor and nettop.






            share|improve this answer

























              up vote
              0
              down vote













              It would make sense if the statistics were "calculated from startup for every application" but this doesn't appear to be the case. Confusingly, nettop maintains running totals since it started so you can get this data by starting a nettop session at the same time the application being observed is started but this is not really practical for most use cases.



              It's notable that the Network tab in Activity Monitor behaves in the same way (totals are from when it starts, not the application being observed) since the underlying operating system service is the same for both Activity Monitor and nettop.






              share|improve this answer























                up vote
                0
                down vote










                up vote
                0
                down vote









                It would make sense if the statistics were "calculated from startup for every application" but this doesn't appear to be the case. Confusingly, nettop maintains running totals since it started so you can get this data by starting a nettop session at the same time the application being observed is started but this is not really practical for most use cases.



                It's notable that the Network tab in Activity Monitor behaves in the same way (totals are from when it starts, not the application being observed) since the underlying operating system service is the same for both Activity Monitor and nettop.






                share|improve this answer












                It would make sense if the statistics were "calculated from startup for every application" but this doesn't appear to be the case. Confusingly, nettop maintains running totals since it started so you can get this data by starting a nettop session at the same time the application being observed is started but this is not really practical for most use cases.



                It's notable that the Network tab in Activity Monitor behaves in the same way (totals are from when it starts, not the application being observed) since the underlying operating system service is the same for both Activity Monitor and nettop.







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Nov 21 at 17:23









                Perry

                31117




                31117






























                     

                    draft saved


                    draft discarded



















































                     


                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function () {
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1191161%2foutput-of-nettop-command%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

                    "Incorrect syntax near the keyword 'ON'. (on update cascade, on delete cascade,)

                    Alcedinidae

                    Origin of the phrase “under your belt”?