Re: [ptxdist] [PATCH] htop: version bump 2.0.2 -> 2.1.0
On 02/08/2018 11:19 AM, Alexander Dahl wrote: > On Thu, Feb 08, 2018 at 10:17:31AM +0100, Marc Kleine-Budde wrote: >> Have you enabled CONFIG_TASK_XACCT and CONFIG_TASK_IO_ACCOUNTING? > > Didn't have that before. I get some values now, although I'm not sure > how to interpret those. I should probably look in the htop > documentation again. But thanks for the hint, I guess htop can show > even more interesting things, I did not know it can, yet. :-) Luckily I've recently collected all needed information: > RCHAR - Number of bytes the process has read > WCHAR - Number of bytes the process has written > SYSCR - Number of read(2) syscalls for the process > SYSCW - Number of write(2) syscalls for the process > RBYTES - Bytes of read(2) I/O for the process > WBYTES - Bytes of write(2) I/O for the process > CNCLWB - Bytes of cancelled write(2) I/O > > IO_READ_RATE - The I/O rate of read(2) in bytes per second for the >process > IO_WRITE_RATE - The I/O rate of write(2) in bytes per second for the > process > IO_RATE - Total I/O rate in bytes per second > > However if you want machine readable output, you have two options: > > 1) > Parse /proc/$PID/io directly, which correspond to the absolute numbers > from htop. The *_RATE values are calculated by htop from the absolute > numbers. > > See man-page of proc(5) for more information about /proc/$PID/io: > >> > rchar: characters read >> > The number of bytes which this task has caused to >> > be read from storage. This is simply the sum of >> > bytes which this process passed to read(2) and >> > similar system calls. It includes things such as >> > terminal I/O and is unaffected by whether or not >> > actual physical disk I/O was required (the read >> > might have been satisfied from pagecache). >> > >> > wchar: characters written >> > The number of bytes which this task has caused, or >> > shall cause to be written to disk. Similar >> > caveats apply here as with rchar. > > Counts all read/write done through files (_including_ pseudo files like > /dev/zero, /dev/null, named pipes). > >> > syscr: read syscalls >> > Attempt to count the number of read I/O opera‐ >> > tions—that is, system calls such as read(2) and >> > pread(2). >> > >> > syscw: write syscalls >> > Attempt to count the number of write I/O opera‐ >> > tions—that is, system calls such as write(2) and >> > pwrite(2). >> > >> > read_bytes: bytes read >> > Attempt to count the number of bytes which this >> > process really did cause to be fetched from the >> > storage layer. This is accurate for block-backed >> > filesystems. >> > >> > write_bytes: bytes written >> > Attempt to count the number of bytes which this >> > process caused to be sent to the storage layer. > > Accounting on MTD devices is not accurate for these two. > >> > cancelled_write_bytes: >> > The big inaccuracy here is truncate. If a process >> > writes 1MB to a file and then deletes the file, it >> > will in fact perform no writeout. But it will >> > have been accounted as having caused 1MB of write. >> > In other words: this field represents the number >> > of bytes which this process caused to not happen, >> > by truncating pagecache. A task can cause "nega‐ >> > tive" I/O too. If this task truncates some dirty >> > pagecache, some I/O which another task has been >> > accounted for (in its write_bytes) will not be >> > happening. >> > >> > Note: In the current implementation, things are a bit >> > racy on 32-bit systems: if process A reads process B's >> > /proc/[pid]/io while process B is updating one of these >> > 64-bit counters, process A could see an intermediate >> > result. >> > >> > Permission to access this file is governed by a ptrace >> > access mode PTRACE_MODE_READ_FSCREDScheck;see >> > ptrace(2). > > 2) > Use the netlink bases taststats interface, which gives you the same > information, but uses far less system resources. > > See: > http://lxr.bootlin.com/linux/latest/source/Documentation/acco
Re: [ptxdist] [PATCH] htop: version bump 2.0.2 -> 2.1.0
Hei hei, On Thu, Feb 08, 2018 at 10:17:31AM +0100, Marc Kleine-Budde wrote: > Have you enabled CONFIG_TASK_XACCT and CONFIG_TASK_IO_ACCOUNTING? Didn't have that before. I get some values now, although I'm not sure how to interpret those. I should probably look in the htop documentation again. But thanks for the hint, I guess htop can show even more interesting things, I did not know it can, yet. :-) Greets Alex -- »With the first link, the chain is forged. The first speech censured, the first thought forbidden, the first freedom denied, chains us all irrevocably.« (Jean-Luc Picard, quoting Judge Aaron Satie) *** GnuPG-FP: C28E E6B9 0263 95CF 8FAF 08FA 34AD CD00 7221 5CC6 *** signature.asc Description: PGP signature ___ ptxdist mailing list ptxdist@pengutronix.de
Re: [ptxdist] [PATCH] htop: version bump 2.0.2 -> 2.1.0
On 02/08/2018 10:03 AM, Alexander Dahl wrote: > On Thu, Feb 08, 2018 at 09:24:55AM +0100, Marc Kleine-Budde wrote: >> Also add a patch to fix "number of read syscalls of process". > > Wanted to test that feature, didn't notice before htop can do that. > However on the columns SYSCR and IO_RATE I only get "no perm", > although htop is running as root. :-/ Have you enabled CONFIG_TASK_XACCT and CONFIG_TASK_IO_ACCOUNTING? What's the output of "cat /proc/$$/io" > So while I can not say anything about the added patch, the tool itself > in version 2.1.0 is running fine, so: > > Tested-by: Alexander Dahl Thanks. Marc -- Pengutronix e.K. | Marc Kleine-Budde | Industrial Linux Solutions| Phone: +49-231-2826-924 | Vertretung West/Dortmund | Fax: +49-5121-206917- | Amtsgericht Hildesheim, HRA 2686 | http://www.pengutronix.de | signature.asc Description: OpenPGP digital signature ___ ptxdist mailing list ptxdist@pengutronix.de
Re: [ptxdist] [PATCH] htop: version bump 2.0.2 -> 2.1.0
Hei hei, On Thu, Feb 08, 2018 at 09:24:55AM +0100, Marc Kleine-Budde wrote: > Also add a patch to fix "number of read syscalls of process". Wanted to test that feature, didn't notice before htop can do that. However on the columns SYSCR and IO_RATE I only get "no perm", although htop is running as root. :-/ So while I can not say anything about the added patch, the tool itself in version 2.1.0 is running fine, so: Tested-by: Alexander Dahl Greets Alex -- »With the first link, the chain is forged. The first speech censured, the first thought forbidden, the first freedom denied, chains us all irrevocably.« (Jean-Luc Picard, quoting Judge Aaron Satie) *** GnuPG-FP: C28E E6B9 0263 95CF 8FAF 08FA 34AD CD00 7221 5CC6 *** signature.asc Description: PGP signature ___ ptxdist mailing list ptxdist@pengutronix.de
[ptxdist] [PATCH] htop: version bump 2.0.2 -> 2.1.0
Also add a patch to fix "number of read syscalls of process". Signed-off-by: Marc Kleine-Budde --- ...ProcessList-fix-reading-of-number-of-read.patch | 28 ++ patches/htop-2.1.0/series | 4 rules/htop.make| 8 --- 3 files changed, 37 insertions(+), 3 deletions(-) create mode 100644 patches/htop-2.1.0/0001-linux-LinuxProcessList-fix-reading-of-number-of-read.patch create mode 100644 patches/htop-2.1.0/series diff --git a/patches/htop-2.1.0/0001-linux-LinuxProcessList-fix-reading-of-number-of-read.patch b/patches/htop-2.1.0/0001-linux-LinuxProcessList-fix-reading-of-number-of-read.patch new file mode 100644 index ..e1267a32ad71 --- /dev/null +++ b/patches/htop-2.1.0/0001-linux-LinuxProcessList-fix-reading-of-number-of-read.patch @@ -0,0 +1,28 @@ +From: Marc Kleine-Budde +Date: Wed, 7 Feb 2018 23:16:37 +0100 +Subject: [PATCH] linux/LinuxProcessList: fix reading of number of read + syscalls of process + +The "if" tests if the character at index "5" is 'r', as a first quick +check. However at index "5" will always be a colon ":". This patch fixes +the off-by-one error. htop now shows proper values in the RD_SYSC +column. + +Signed-off-by: Marc Kleine-Budde +--- + linux/LinuxProcessList.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/linux/LinuxProcessList.c b/linux/LinuxProcessList.c +index 6f2631afa12f..230770258084 100644 +--- a/linux/LinuxProcessList.c b/linux/LinuxProcessList.c +@@ -436,7 +436,7 @@ static void LinuxProcessList_readIoFile(LinuxProcess* process, const char* dirna + } + break; + case 's': +- if (line[5] == 'r' && strncmp(line+1, "yscr: ", 6) == 0) { ++ if (line[4] == 'r' && strncmp(line+1, "yscr: ", 6) == 0) { + process->io_syscr = strtoull(line+7, NULL, 10); + } else if (strncmp(line+1, "yscw: ", 6) == 0) { + process->io_syscw = strtoull(line+7, NULL, 10); diff --git a/patches/htop-2.1.0/series b/patches/htop-2.1.0/series new file mode 100644 index ..81ca0ba6e16d --- /dev/null +++ b/patches/htop-2.1.0/series @@ -0,0 +1,4 @@ +# generated by git-ptx-patches +#tag:base --start-number 1 +0001-linux-LinuxProcessList-fix-reading-of-number-of-read.patch +# f87a037f960f427f6ab7ebcbb54e5e4e - git-ptx-patches magic diff --git a/rules/htop.make b/rules/htop.make index d7d27306a617..af624c7dfc83 100644 --- a/rules/htop.make +++ b/rules/htop.make @@ -17,8 +17,8 @@ PACKAGES-$(PTXCONF_HTOP) += htop # # Paths and names # -HTOP_VERSION := 2.0.2 -HTOP_MD5 := 7d354d904bad591a931ad57e99fea84a +HTOP_VERSION := 2.1.0 +HTOP_MD5 := f262b66ad6c194782f4d3a80627e84c8 HTOP := htop-$(HTOP_VERSION) HTOP_SUFFIX:= tar.gz HTOP_URL := http://hisham.hm/htop/releases/$(HTOP_VERSION)/$(HTOP).$(HTOP_SUFFIX) @@ -44,7 +44,9 @@ HTOP_CONF_OPT := \ --enable-taskstats \ --disable-unicode \ --enable-linux-affinity \ - --disable-hwloc + --disable-hwloc \ + --disable-setuid \ + --disable-delayacct # # Target-Install -- 2.15.1 ___ ptxdist mailing list ptxdist@pengutronix.de