Where to find iowait stat for a single process (as a file)

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 am writing a script and I need to find a file in which statistics for a single process/pid/service's iowait are stored. Is there any such file at all on Debian-based distributions?



Nor /proc/<pid>/stat, neither /proc/<pid>/io have any stat for iowait, according to the man pages. I am aware I can parse the output of other tools like iotop, sar, and etc., however, parsing stdout of external commands is a performance issue which I have to avoid.



Note: I am aware of /proc/stat and the meaning of its contents. I need the iowait stat for a single process, not for the whole CPU or a core.







share|improve this question



























    up vote
    0
    down vote

    favorite












    I am writing a script and I need to find a file in which statistics for a single process/pid/service's iowait are stored. Is there any such file at all on Debian-based distributions?



    Nor /proc/<pid>/stat, neither /proc/<pid>/io have any stat for iowait, according to the man pages. I am aware I can parse the output of other tools like iotop, sar, and etc., however, parsing stdout of external commands is a performance issue which I have to avoid.



    Note: I am aware of /proc/stat and the meaning of its contents. I need the iowait stat for a single process, not for the whole CPU or a core.







    share|improve this question























      up vote
      0
      down vote

      favorite









      up vote
      0
      down vote

      favorite











      I am writing a script and I need to find a file in which statistics for a single process/pid/service's iowait are stored. Is there any such file at all on Debian-based distributions?



      Nor /proc/<pid>/stat, neither /proc/<pid>/io have any stat for iowait, according to the man pages. I am aware I can parse the output of other tools like iotop, sar, and etc., however, parsing stdout of external commands is a performance issue which I have to avoid.



      Note: I am aware of /proc/stat and the meaning of its contents. I need the iowait stat for a single process, not for the whole CPU or a core.







      share|improve this question













      I am writing a script and I need to find a file in which statistics for a single process/pid/service's iowait are stored. Is there any such file at all on Debian-based distributions?



      Nor /proc/<pid>/stat, neither /proc/<pid>/io have any stat for iowait, according to the man pages. I am aware I can parse the output of other tools like iotop, sar, and etc., however, parsing stdout of external commands is a performance issue which I have to avoid.



      Note: I am aware of /proc/stat and the meaning of its contents. I need the iowait stat for a single process, not for the whole CPU or a core.









      share|improve this question












      share|improve this question




      share|improve this question








      edited Jul 30 at 10:01
























      asked Jul 30 at 8:54









      Fanatique

      788




      788




















          1 Answer
          1






          active

          oldest

          votes

















          up vote
          2
          down vote



          accepted










          Theoretically you can obtain iowait per process from /proc/[pid]/stat, since from corresponding block of PROC(5) we read:



          (42) delayacct_blkio_ticks %llu (since Linux 2.6.18)
          Aggregated block I/O delays, measured in clock ticks (centiseconds).


          I have no idea what the delayacct_blkio_ticks means practically. Anyway, the only man proc will be useful to you.



          There is related question, check it: Measuring block I/O delays using proc FS



          Additionally, pay your attention to notes for /proc/stat in the per CPU iowait block:




          1. The CPU will not wait for I/O to complete; iowait is the time that a task is waiting for I/O to complete. When a CPU goes into idle
            state for outstanding task I/O, another task will be scheduled on this
            CPU.

          2. On a multi-core CPU, the task waiting for I/O to complete is not running on any CPU, so the iowait of each CPU is difficult to
            calculate.

          3. The value in this field may decrease in certain conditions.



          You can get iowait data per CPU from /proc/stat. On my Ubuntu 18.04 in the /proc/stat there is such the part:



          cpu 2752162 16054 941158 49212025 789607 0 217089 0 0 0
          cpu0 1397207 7767 500620 24623046 407078 0 70574 0 0 0
          cpu1 1354955 8286 440538 24588978 382529 0 146515 0 0 0


          The fifth column besides cpus column is iowait value in my particular case. The number of columns and its meaning can be various depending on your kernel in use.



          To get every column exact meaning you have to look at your documentation. In Ubuntu install linux-doc package first:



          sudo apt install linux-doc


          and look at man proc:



          man proc


          There is part with exact /proc/stat explanation for every column.



          Read additionally How to read the Linux /proc/stat file to know how to calculate values.



          In CentOS it's necessary to install kernel-doc package:



          yum install kernel-doc


          then read the file:



          /usr/share/doc/kernel-doc/Documentation/filesystems/proc.txt





          share|improve this answer























          • I am aware of what /proc/stat is and of its contents. However, I've explicitly said that I need iowait for a single process, not for a core. Thank you for the detailed answer nonetheless.
            – Fanatique
            Jul 30 at 10:00










          • @Fanatique I have edited my answer, please, check it.
            – Bob
            Jul 30 at 11:49










          • I'll have to do with that. Anyways, great! Thank you, I have no idea how I've missed that in the man pages.. Guess I haven't been reading enough thoroughly.
            – Fanatique
            Jul 30 at 12:02










          • @Fanatique You're welcome!
            – Bob
            Jul 30 at 12:03










          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%2f459288%2fwhere-to-find-iowait-stat-for-a-single-process-as-a-file%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
          2
          down vote



          accepted










          Theoretically you can obtain iowait per process from /proc/[pid]/stat, since from corresponding block of PROC(5) we read:



          (42) delayacct_blkio_ticks %llu (since Linux 2.6.18)
          Aggregated block I/O delays, measured in clock ticks (centiseconds).


          I have no idea what the delayacct_blkio_ticks means practically. Anyway, the only man proc will be useful to you.



          There is related question, check it: Measuring block I/O delays using proc FS



          Additionally, pay your attention to notes for /proc/stat in the per CPU iowait block:




          1. The CPU will not wait for I/O to complete; iowait is the time that a task is waiting for I/O to complete. When a CPU goes into idle
            state for outstanding task I/O, another task will be scheduled on this
            CPU.

          2. On a multi-core CPU, the task waiting for I/O to complete is not running on any CPU, so the iowait of each CPU is difficult to
            calculate.

          3. The value in this field may decrease in certain conditions.



          You can get iowait data per CPU from /proc/stat. On my Ubuntu 18.04 in the /proc/stat there is such the part:



          cpu 2752162 16054 941158 49212025 789607 0 217089 0 0 0
          cpu0 1397207 7767 500620 24623046 407078 0 70574 0 0 0
          cpu1 1354955 8286 440538 24588978 382529 0 146515 0 0 0


          The fifth column besides cpus column is iowait value in my particular case. The number of columns and its meaning can be various depending on your kernel in use.



          To get every column exact meaning you have to look at your documentation. In Ubuntu install linux-doc package first:



          sudo apt install linux-doc


          and look at man proc:



          man proc


          There is part with exact /proc/stat explanation for every column.



          Read additionally How to read the Linux /proc/stat file to know how to calculate values.



          In CentOS it's necessary to install kernel-doc package:



          yum install kernel-doc


          then read the file:



          /usr/share/doc/kernel-doc/Documentation/filesystems/proc.txt





          share|improve this answer























          • I am aware of what /proc/stat is and of its contents. However, I've explicitly said that I need iowait for a single process, not for a core. Thank you for the detailed answer nonetheless.
            – Fanatique
            Jul 30 at 10:00










          • @Fanatique I have edited my answer, please, check it.
            – Bob
            Jul 30 at 11:49










          • I'll have to do with that. Anyways, great! Thank you, I have no idea how I've missed that in the man pages.. Guess I haven't been reading enough thoroughly.
            – Fanatique
            Jul 30 at 12:02










          • @Fanatique You're welcome!
            – Bob
            Jul 30 at 12:03














          up vote
          2
          down vote



          accepted










          Theoretically you can obtain iowait per process from /proc/[pid]/stat, since from corresponding block of PROC(5) we read:



          (42) delayacct_blkio_ticks %llu (since Linux 2.6.18)
          Aggregated block I/O delays, measured in clock ticks (centiseconds).


          I have no idea what the delayacct_blkio_ticks means practically. Anyway, the only man proc will be useful to you.



          There is related question, check it: Measuring block I/O delays using proc FS



          Additionally, pay your attention to notes for /proc/stat in the per CPU iowait block:




          1. The CPU will not wait for I/O to complete; iowait is the time that a task is waiting for I/O to complete. When a CPU goes into idle
            state for outstanding task I/O, another task will be scheduled on this
            CPU.

          2. On a multi-core CPU, the task waiting for I/O to complete is not running on any CPU, so the iowait of each CPU is difficult to
            calculate.

          3. The value in this field may decrease in certain conditions.



          You can get iowait data per CPU from /proc/stat. On my Ubuntu 18.04 in the /proc/stat there is such the part:



          cpu 2752162 16054 941158 49212025 789607 0 217089 0 0 0
          cpu0 1397207 7767 500620 24623046 407078 0 70574 0 0 0
          cpu1 1354955 8286 440538 24588978 382529 0 146515 0 0 0


          The fifth column besides cpus column is iowait value in my particular case. The number of columns and its meaning can be various depending on your kernel in use.



          To get every column exact meaning you have to look at your documentation. In Ubuntu install linux-doc package first:



          sudo apt install linux-doc


          and look at man proc:



          man proc


          There is part with exact /proc/stat explanation for every column.



          Read additionally How to read the Linux /proc/stat file to know how to calculate values.



          In CentOS it's necessary to install kernel-doc package:



          yum install kernel-doc


          then read the file:



          /usr/share/doc/kernel-doc/Documentation/filesystems/proc.txt





          share|improve this answer























          • I am aware of what /proc/stat is and of its contents. However, I've explicitly said that I need iowait for a single process, not for a core. Thank you for the detailed answer nonetheless.
            – Fanatique
            Jul 30 at 10:00










          • @Fanatique I have edited my answer, please, check it.
            – Bob
            Jul 30 at 11:49










          • I'll have to do with that. Anyways, great! Thank you, I have no idea how I've missed that in the man pages.. Guess I haven't been reading enough thoroughly.
            – Fanatique
            Jul 30 at 12:02










          • @Fanatique You're welcome!
            – Bob
            Jul 30 at 12:03












          up vote
          2
          down vote



          accepted







          up vote
          2
          down vote



          accepted






          Theoretically you can obtain iowait per process from /proc/[pid]/stat, since from corresponding block of PROC(5) we read:



          (42) delayacct_blkio_ticks %llu (since Linux 2.6.18)
          Aggregated block I/O delays, measured in clock ticks (centiseconds).


          I have no idea what the delayacct_blkio_ticks means practically. Anyway, the only man proc will be useful to you.



          There is related question, check it: Measuring block I/O delays using proc FS



          Additionally, pay your attention to notes for /proc/stat in the per CPU iowait block:




          1. The CPU will not wait for I/O to complete; iowait is the time that a task is waiting for I/O to complete. When a CPU goes into idle
            state for outstanding task I/O, another task will be scheduled on this
            CPU.

          2. On a multi-core CPU, the task waiting for I/O to complete is not running on any CPU, so the iowait of each CPU is difficult to
            calculate.

          3. The value in this field may decrease in certain conditions.



          You can get iowait data per CPU from /proc/stat. On my Ubuntu 18.04 in the /proc/stat there is such the part:



          cpu 2752162 16054 941158 49212025 789607 0 217089 0 0 0
          cpu0 1397207 7767 500620 24623046 407078 0 70574 0 0 0
          cpu1 1354955 8286 440538 24588978 382529 0 146515 0 0 0


          The fifth column besides cpus column is iowait value in my particular case. The number of columns and its meaning can be various depending on your kernel in use.



          To get every column exact meaning you have to look at your documentation. In Ubuntu install linux-doc package first:



          sudo apt install linux-doc


          and look at man proc:



          man proc


          There is part with exact /proc/stat explanation for every column.



          Read additionally How to read the Linux /proc/stat file to know how to calculate values.



          In CentOS it's necessary to install kernel-doc package:



          yum install kernel-doc


          then read the file:



          /usr/share/doc/kernel-doc/Documentation/filesystems/proc.txt





          share|improve this answer















          Theoretically you can obtain iowait per process from /proc/[pid]/stat, since from corresponding block of PROC(5) we read:



          (42) delayacct_blkio_ticks %llu (since Linux 2.6.18)
          Aggregated block I/O delays, measured in clock ticks (centiseconds).


          I have no idea what the delayacct_blkio_ticks means practically. Anyway, the only man proc will be useful to you.



          There is related question, check it: Measuring block I/O delays using proc FS



          Additionally, pay your attention to notes for /proc/stat in the per CPU iowait block:




          1. The CPU will not wait for I/O to complete; iowait is the time that a task is waiting for I/O to complete. When a CPU goes into idle
            state for outstanding task I/O, another task will be scheduled on this
            CPU.

          2. On a multi-core CPU, the task waiting for I/O to complete is not running on any CPU, so the iowait of each CPU is difficult to
            calculate.

          3. The value in this field may decrease in certain conditions.



          You can get iowait data per CPU from /proc/stat. On my Ubuntu 18.04 in the /proc/stat there is such the part:



          cpu 2752162 16054 941158 49212025 789607 0 217089 0 0 0
          cpu0 1397207 7767 500620 24623046 407078 0 70574 0 0 0
          cpu1 1354955 8286 440538 24588978 382529 0 146515 0 0 0


          The fifth column besides cpus column is iowait value in my particular case. The number of columns and its meaning can be various depending on your kernel in use.



          To get every column exact meaning you have to look at your documentation. In Ubuntu install linux-doc package first:



          sudo apt install linux-doc


          and look at man proc:



          man proc


          There is part with exact /proc/stat explanation for every column.



          Read additionally How to read the Linux /proc/stat file to know how to calculate values.



          In CentOS it's necessary to install kernel-doc package:



          yum install kernel-doc


          then read the file:



          /usr/share/doc/kernel-doc/Documentation/filesystems/proc.txt






          share|improve this answer















          share|improve this answer



          share|improve this answer








          edited Jul 30 at 12:01


























          answered Jul 30 at 9:51









          Bob

          5057




          5057











          • I am aware of what /proc/stat is and of its contents. However, I've explicitly said that I need iowait for a single process, not for a core. Thank you for the detailed answer nonetheless.
            – Fanatique
            Jul 30 at 10:00










          • @Fanatique I have edited my answer, please, check it.
            – Bob
            Jul 30 at 11:49










          • I'll have to do with that. Anyways, great! Thank you, I have no idea how I've missed that in the man pages.. Guess I haven't been reading enough thoroughly.
            – Fanatique
            Jul 30 at 12:02










          • @Fanatique You're welcome!
            – Bob
            Jul 30 at 12:03
















          • I am aware of what /proc/stat is and of its contents. However, I've explicitly said that I need iowait for a single process, not for a core. Thank you for the detailed answer nonetheless.
            – Fanatique
            Jul 30 at 10:00










          • @Fanatique I have edited my answer, please, check it.
            – Bob
            Jul 30 at 11:49










          • I'll have to do with that. Anyways, great! Thank you, I have no idea how I've missed that in the man pages.. Guess I haven't been reading enough thoroughly.
            – Fanatique
            Jul 30 at 12:02










          • @Fanatique You're welcome!
            – Bob
            Jul 30 at 12:03















          I am aware of what /proc/stat is and of its contents. However, I've explicitly said that I need iowait for a single process, not for a core. Thank you for the detailed answer nonetheless.
          – Fanatique
          Jul 30 at 10:00




          I am aware of what /proc/stat is and of its contents. However, I've explicitly said that I need iowait for a single process, not for a core. Thank you for the detailed answer nonetheless.
          – Fanatique
          Jul 30 at 10:00












          @Fanatique I have edited my answer, please, check it.
          – Bob
          Jul 30 at 11:49




          @Fanatique I have edited my answer, please, check it.
          – Bob
          Jul 30 at 11:49












          I'll have to do with that. Anyways, great! Thank you, I have no idea how I've missed that in the man pages.. Guess I haven't been reading enough thoroughly.
          – Fanatique
          Jul 30 at 12:02




          I'll have to do with that. Anyways, great! Thank you, I have no idea how I've missed that in the man pages.. Guess I haven't been reading enough thoroughly.
          – Fanatique
          Jul 30 at 12:02












          @Fanatique You're welcome!
          – Bob
          Jul 30 at 12:03




          @Fanatique You're welcome!
          – Bob
          Jul 30 at 12:03












           

          draft saved


          draft discarded


























           


          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f459288%2fwhere-to-find-iowait-stat-for-a-single-process-as-a-file%23new-answer', 'question_page');

          );

          Post as a guest













































































          Popular posts from this blog

          Peggy Mitchell

          Palaiologos

          The Forum (Inglewood, California)