How to record boot time?

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





.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty margin-bottom:0;







up vote
0
down vote

favorite












I want to monitor boot time (the time needed by the system to boot) compared to software version installed (kernel and other software) day by day in order to have a look at boot performance for my arch-linux computer.



I use the systemd command systemd-analyze time to get the boot time.



My idea is to have a log with:



[day]
.......Boot time [s]: 2.145 (kernel) + 13.675 (userspace)
.......with kernel version 4.11.2
.......gnome-shell version 3.24.1
[day+1]
.......Boot time [s]: 3.145 (kernel) + 21.665 (userspace)
.......with kernel version 4.17.11
.......gnome-shell version 3.28.3


How can I do?







share|improve this question



























    up vote
    0
    down vote

    favorite












    I want to monitor boot time (the time needed by the system to boot) compared to software version installed (kernel and other software) day by day in order to have a look at boot performance for my arch-linux computer.



    I use the systemd command systemd-analyze time to get the boot time.



    My idea is to have a log with:



    [day]
    .......Boot time [s]: 2.145 (kernel) + 13.675 (userspace)
    .......with kernel version 4.11.2
    .......gnome-shell version 3.24.1
    [day+1]
    .......Boot time [s]: 3.145 (kernel) + 21.665 (userspace)
    .......with kernel version 4.17.11
    .......gnome-shell version 3.28.3


    How can I do?







    share|improve this question























      up vote
      0
      down vote

      favorite









      up vote
      0
      down vote

      favorite











      I want to monitor boot time (the time needed by the system to boot) compared to software version installed (kernel and other software) day by day in order to have a look at boot performance for my arch-linux computer.



      I use the systemd command systemd-analyze time to get the boot time.



      My idea is to have a log with:



      [day]
      .......Boot time [s]: 2.145 (kernel) + 13.675 (userspace)
      .......with kernel version 4.11.2
      .......gnome-shell version 3.24.1
      [day+1]
      .......Boot time [s]: 3.145 (kernel) + 21.665 (userspace)
      .......with kernel version 4.17.11
      .......gnome-shell version 3.28.3


      How can I do?







      share|improve this question













      I want to monitor boot time (the time needed by the system to boot) compared to software version installed (kernel and other software) day by day in order to have a look at boot performance for my arch-linux computer.



      I use the systemd command systemd-analyze time to get the boot time.



      My idea is to have a log with:



      [day]
      .......Boot time [s]: 2.145 (kernel) + 13.675 (userspace)
      .......with kernel version 4.11.2
      .......gnome-shell version 3.24.1
      [day+1]
      .......Boot time [s]: 3.145 (kernel) + 21.665 (userspace)
      .......with kernel version 4.17.11
      .......gnome-shell version 3.28.3


      How can I do?









      share|improve this question












      share|improve this question




      share|improve this question








      edited 2 days ago









      jasonwryan

      46.2k14123173




      46.2k14123173









      asked 2 days ago









      mattia.b89

      660217




      660217




















          1 Answer
          1






          active

          oldest

          votes

















          up vote
          1
          down vote



          accepted










          Basic idea



          I'd be tempted to do this as a systemd service that logs this to a file:



          $ systemd-analyze time | sed 's/Startup finished in //;s/ +.*(initrd)//;s/ =.*$//'
          442ms (kernel) + 10.224s (userspace)


          This cuts the output of systemd-analyze time down to just the bits you want. The rest of the info you want is easy to come by via uname and gnome-shell command-lines' themselves:



          $ systemd-analyze time | 
          sed 's/Startup finished in //;s/ +.*(initrd)//;s/ =.*$//';
          printf "kernel: %sngnome-shell: %sn" "$(uname -r)" "$(gnome-shell --version)"
          442ms (kernel) + 10.224s (userspace)
          kernel: 3.10.0-693.21.1.el7.x86_64
          gnome-shell: GNOME Shell 3.25.4


          More refined



          As a script the above:



          $ cat ./boottime.bash
          #!/bin/bash

          printf "[%s]n" "$(date)"
          printf ".......Boot time [s]: %sn" "$(systemd-analyze time | sed 's/Startup finished in //;s/ +.*(initrd)//;s/ =.*$//')"
          printf ".......with kernel version: %sn" "$(uname -r)"
          printf ".......gnome-shell version: %sn" "$(gnome-shell --version)"

          #[day]
          #.......Boot time [s]: 2.145 (kernel) + 13.675 (userspace)
          #.......with kernel version 4.11.2
          #.......gnome-shell version 3.24.1
          #[day+1]
          #.......Boot time [s]: 3.145 (kernel) + 21.665 (userspace)
          #.......with kernel version 4.17.11
          #.......gnome-shell version 3.28.3


          The output:



          $ ./boottime.bash
          [Sat Aug 4 14:34:40 EDT 2018]
          .......Boot time [s]: 442ms (kernel) + 10.224s (userspace)
          .......with kernel version: 3.10.0-693.21.1.el7.x86_64
          .......gnome-shell version: GNOME Shell 3.25.4


          The unit file:



          $ cat /etc/systemd/system/boottime.service
          [Unit]
          Description=Boottime Service
          After=systend-user-sessions.service

          [Service]
          Type=simple
          ExecStart=/opt/bin/boottime.bash


          TLDR; parsing systemd-analyze time



          The sed used above works as follows:



          sed 's/Startup finished in //;s/ +.*(initrd)//;s/ =.*$//')"



          • s/Startup finished in // - removes everything from left up to the word in


          • s/ +.*(initrd)// - removes everything starting at + up to (initrd)


          • s/ =.*$// - removes everything at the end of string, starting with = to the end of the line $





          share|improve this answer























          • It looks good! I am not an expert of sed, can you explain the complex part s/ +.*(initrd)//;s/ =.*$// ?
            – mattia.b89
            yesterday











          • @mattia.b89 - see updated section at end that explains
            – slm♦
            yesterday










          • thank you, now it's clear! I don't have an initrd item...
            – mattia.b89
            10 hours ago










          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
          );



          );








           

          draft saved


          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f460511%2fhow-to-record-boot-time%23new-answer', 'question_page');

          );

          Post as a guest






























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes








          up vote
          1
          down vote



          accepted










          Basic idea



          I'd be tempted to do this as a systemd service that logs this to a file:



          $ systemd-analyze time | sed 's/Startup finished in //;s/ +.*(initrd)//;s/ =.*$//'
          442ms (kernel) + 10.224s (userspace)


          This cuts the output of systemd-analyze time down to just the bits you want. The rest of the info you want is easy to come by via uname and gnome-shell command-lines' themselves:



          $ systemd-analyze time | 
          sed 's/Startup finished in //;s/ +.*(initrd)//;s/ =.*$//';
          printf "kernel: %sngnome-shell: %sn" "$(uname -r)" "$(gnome-shell --version)"
          442ms (kernel) + 10.224s (userspace)
          kernel: 3.10.0-693.21.1.el7.x86_64
          gnome-shell: GNOME Shell 3.25.4


          More refined



          As a script the above:



          $ cat ./boottime.bash
          #!/bin/bash

          printf "[%s]n" "$(date)"
          printf ".......Boot time [s]: %sn" "$(systemd-analyze time | sed 's/Startup finished in //;s/ +.*(initrd)//;s/ =.*$//')"
          printf ".......with kernel version: %sn" "$(uname -r)"
          printf ".......gnome-shell version: %sn" "$(gnome-shell --version)"

          #[day]
          #.......Boot time [s]: 2.145 (kernel) + 13.675 (userspace)
          #.......with kernel version 4.11.2
          #.......gnome-shell version 3.24.1
          #[day+1]
          #.......Boot time [s]: 3.145 (kernel) + 21.665 (userspace)
          #.......with kernel version 4.17.11
          #.......gnome-shell version 3.28.3


          The output:



          $ ./boottime.bash
          [Sat Aug 4 14:34:40 EDT 2018]
          .......Boot time [s]: 442ms (kernel) + 10.224s (userspace)
          .......with kernel version: 3.10.0-693.21.1.el7.x86_64
          .......gnome-shell version: GNOME Shell 3.25.4


          The unit file:



          $ cat /etc/systemd/system/boottime.service
          [Unit]
          Description=Boottime Service
          After=systend-user-sessions.service

          [Service]
          Type=simple
          ExecStart=/opt/bin/boottime.bash


          TLDR; parsing systemd-analyze time



          The sed used above works as follows:



          sed 's/Startup finished in //;s/ +.*(initrd)//;s/ =.*$//')"



          • s/Startup finished in // - removes everything from left up to the word in


          • s/ +.*(initrd)// - removes everything starting at + up to (initrd)


          • s/ =.*$// - removes everything at the end of string, starting with = to the end of the line $





          share|improve this answer























          • It looks good! I am not an expert of sed, can you explain the complex part s/ +.*(initrd)//;s/ =.*$// ?
            – mattia.b89
            yesterday











          • @mattia.b89 - see updated section at end that explains
            – slm♦
            yesterday










          • thank you, now it's clear! I don't have an initrd item...
            – mattia.b89
            10 hours ago














          up vote
          1
          down vote



          accepted










          Basic idea



          I'd be tempted to do this as a systemd service that logs this to a file:



          $ systemd-analyze time | sed 's/Startup finished in //;s/ +.*(initrd)//;s/ =.*$//'
          442ms (kernel) + 10.224s (userspace)


          This cuts the output of systemd-analyze time down to just the bits you want. The rest of the info you want is easy to come by via uname and gnome-shell command-lines' themselves:



          $ systemd-analyze time | 
          sed 's/Startup finished in //;s/ +.*(initrd)//;s/ =.*$//';
          printf "kernel: %sngnome-shell: %sn" "$(uname -r)" "$(gnome-shell --version)"
          442ms (kernel) + 10.224s (userspace)
          kernel: 3.10.0-693.21.1.el7.x86_64
          gnome-shell: GNOME Shell 3.25.4


          More refined



          As a script the above:



          $ cat ./boottime.bash
          #!/bin/bash

          printf "[%s]n" "$(date)"
          printf ".......Boot time [s]: %sn" "$(systemd-analyze time | sed 's/Startup finished in //;s/ +.*(initrd)//;s/ =.*$//')"
          printf ".......with kernel version: %sn" "$(uname -r)"
          printf ".......gnome-shell version: %sn" "$(gnome-shell --version)"

          #[day]
          #.......Boot time [s]: 2.145 (kernel) + 13.675 (userspace)
          #.......with kernel version 4.11.2
          #.......gnome-shell version 3.24.1
          #[day+1]
          #.......Boot time [s]: 3.145 (kernel) + 21.665 (userspace)
          #.......with kernel version 4.17.11
          #.......gnome-shell version 3.28.3


          The output:



          $ ./boottime.bash
          [Sat Aug 4 14:34:40 EDT 2018]
          .......Boot time [s]: 442ms (kernel) + 10.224s (userspace)
          .......with kernel version: 3.10.0-693.21.1.el7.x86_64
          .......gnome-shell version: GNOME Shell 3.25.4


          The unit file:



          $ cat /etc/systemd/system/boottime.service
          [Unit]
          Description=Boottime Service
          After=systend-user-sessions.service

          [Service]
          Type=simple
          ExecStart=/opt/bin/boottime.bash


          TLDR; parsing systemd-analyze time



          The sed used above works as follows:



          sed 's/Startup finished in //;s/ +.*(initrd)//;s/ =.*$//')"



          • s/Startup finished in // - removes everything from left up to the word in


          • s/ +.*(initrd)// - removes everything starting at + up to (initrd)


          • s/ =.*$// - removes everything at the end of string, starting with = to the end of the line $





          share|improve this answer























          • It looks good! I am not an expert of sed, can you explain the complex part s/ +.*(initrd)//;s/ =.*$// ?
            – mattia.b89
            yesterday











          • @mattia.b89 - see updated section at end that explains
            – slm♦
            yesterday










          • thank you, now it's clear! I don't have an initrd item...
            – mattia.b89
            10 hours ago












          up vote
          1
          down vote



          accepted







          up vote
          1
          down vote



          accepted






          Basic idea



          I'd be tempted to do this as a systemd service that logs this to a file:



          $ systemd-analyze time | sed 's/Startup finished in //;s/ +.*(initrd)//;s/ =.*$//'
          442ms (kernel) + 10.224s (userspace)


          This cuts the output of systemd-analyze time down to just the bits you want. The rest of the info you want is easy to come by via uname and gnome-shell command-lines' themselves:



          $ systemd-analyze time | 
          sed 's/Startup finished in //;s/ +.*(initrd)//;s/ =.*$//';
          printf "kernel: %sngnome-shell: %sn" "$(uname -r)" "$(gnome-shell --version)"
          442ms (kernel) + 10.224s (userspace)
          kernel: 3.10.0-693.21.1.el7.x86_64
          gnome-shell: GNOME Shell 3.25.4


          More refined



          As a script the above:



          $ cat ./boottime.bash
          #!/bin/bash

          printf "[%s]n" "$(date)"
          printf ".......Boot time [s]: %sn" "$(systemd-analyze time | sed 's/Startup finished in //;s/ +.*(initrd)//;s/ =.*$//')"
          printf ".......with kernel version: %sn" "$(uname -r)"
          printf ".......gnome-shell version: %sn" "$(gnome-shell --version)"

          #[day]
          #.......Boot time [s]: 2.145 (kernel) + 13.675 (userspace)
          #.......with kernel version 4.11.2
          #.......gnome-shell version 3.24.1
          #[day+1]
          #.......Boot time [s]: 3.145 (kernel) + 21.665 (userspace)
          #.......with kernel version 4.17.11
          #.......gnome-shell version 3.28.3


          The output:



          $ ./boottime.bash
          [Sat Aug 4 14:34:40 EDT 2018]
          .......Boot time [s]: 442ms (kernel) + 10.224s (userspace)
          .......with kernel version: 3.10.0-693.21.1.el7.x86_64
          .......gnome-shell version: GNOME Shell 3.25.4


          The unit file:



          $ cat /etc/systemd/system/boottime.service
          [Unit]
          Description=Boottime Service
          After=systend-user-sessions.service

          [Service]
          Type=simple
          ExecStart=/opt/bin/boottime.bash


          TLDR; parsing systemd-analyze time



          The sed used above works as follows:



          sed 's/Startup finished in //;s/ +.*(initrd)//;s/ =.*$//')"



          • s/Startup finished in // - removes everything from left up to the word in


          • s/ +.*(initrd)// - removes everything starting at + up to (initrd)


          • s/ =.*$// - removes everything at the end of string, starting with = to the end of the line $





          share|improve this answer















          Basic idea



          I'd be tempted to do this as a systemd service that logs this to a file:



          $ systemd-analyze time | sed 's/Startup finished in //;s/ +.*(initrd)//;s/ =.*$//'
          442ms (kernel) + 10.224s (userspace)


          This cuts the output of systemd-analyze time down to just the bits you want. The rest of the info you want is easy to come by via uname and gnome-shell command-lines' themselves:



          $ systemd-analyze time | 
          sed 's/Startup finished in //;s/ +.*(initrd)//;s/ =.*$//';
          printf "kernel: %sngnome-shell: %sn" "$(uname -r)" "$(gnome-shell --version)"
          442ms (kernel) + 10.224s (userspace)
          kernel: 3.10.0-693.21.1.el7.x86_64
          gnome-shell: GNOME Shell 3.25.4


          More refined



          As a script the above:



          $ cat ./boottime.bash
          #!/bin/bash

          printf "[%s]n" "$(date)"
          printf ".......Boot time [s]: %sn" "$(systemd-analyze time | sed 's/Startup finished in //;s/ +.*(initrd)//;s/ =.*$//')"
          printf ".......with kernel version: %sn" "$(uname -r)"
          printf ".......gnome-shell version: %sn" "$(gnome-shell --version)"

          #[day]
          #.......Boot time [s]: 2.145 (kernel) + 13.675 (userspace)
          #.......with kernel version 4.11.2
          #.......gnome-shell version 3.24.1
          #[day+1]
          #.......Boot time [s]: 3.145 (kernel) + 21.665 (userspace)
          #.......with kernel version 4.17.11
          #.......gnome-shell version 3.28.3


          The output:



          $ ./boottime.bash
          [Sat Aug 4 14:34:40 EDT 2018]
          .......Boot time [s]: 442ms (kernel) + 10.224s (userspace)
          .......with kernel version: 3.10.0-693.21.1.el7.x86_64
          .......gnome-shell version: GNOME Shell 3.25.4


          The unit file:



          $ cat /etc/systemd/system/boottime.service
          [Unit]
          Description=Boottime Service
          After=systend-user-sessions.service

          [Service]
          Type=simple
          ExecStart=/opt/bin/boottime.bash


          TLDR; parsing systemd-analyze time



          The sed used above works as follows:



          sed 's/Startup finished in //;s/ +.*(initrd)//;s/ =.*$//')"



          • s/Startup finished in // - removes everything from left up to the word in


          • s/ +.*(initrd)// - removes everything starting at + up to (initrd)


          • s/ =.*$// - removes everything at the end of string, starting with = to the end of the line $






          share|improve this answer















          share|improve this answer



          share|improve this answer








          edited yesterday


























          answered 2 days ago









          slm♦

          232k65479648




          232k65479648











          • It looks good! I am not an expert of sed, can you explain the complex part s/ +.*(initrd)//;s/ =.*$// ?
            – mattia.b89
            yesterday











          • @mattia.b89 - see updated section at end that explains
            – slm♦
            yesterday










          • thank you, now it's clear! I don't have an initrd item...
            – mattia.b89
            10 hours ago
















          • It looks good! I am not an expert of sed, can you explain the complex part s/ +.*(initrd)//;s/ =.*$// ?
            – mattia.b89
            yesterday











          • @mattia.b89 - see updated section at end that explains
            – slm♦
            yesterday










          • thank you, now it's clear! I don't have an initrd item...
            – mattia.b89
            10 hours ago















          It looks good! I am not an expert of sed, can you explain the complex part s/ +.*(initrd)//;s/ =.*$// ?
          – mattia.b89
          yesterday





          It looks good! I am not an expert of sed, can you explain the complex part s/ +.*(initrd)//;s/ =.*$// ?
          – mattia.b89
          yesterday













          @mattia.b89 - see updated section at end that explains
          – slm♦
          yesterday




          @mattia.b89 - see updated section at end that explains
          – slm♦
          yesterday












          thank you, now it's clear! I don't have an initrd item...
          – mattia.b89
          10 hours ago




          thank you, now it's clear! I don't have an initrd item...
          – mattia.b89
          10 hours ago












           

          draft saved


          draft discarded


























           


          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f460511%2fhow-to-record-boot-time%23new-answer', 'question_page');

          );

          Post as a guest













































































          Popular posts from this blog

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

          Bahrain

          Postfix configuration issue with fips on centos 7; mailgun relay