Skip to content

Version 1.33

Latest

Choose a tag to compare

@bbonev bbonev released this 21 Oct 19:32
v1.33
ef5088a

iotop 1.33

Changed behavior

  • Accumulated values count from the start of each task. In -a and -A modes, iotop now shows the I/O that a task did since it started, as counted by the kernel, instead of only the I/O since iotop first saw it. A process that did its I/O before iotop was started is no longer shown as idle. With -A the average is over the age of the task. The total of a process includes its threads that iotop saw, but not the threads that exited before. --no-lifetime brings back the previous behavior, Ctrl-A toggles it and the setting is saved in the config file. (#84)
  • The IO and SWAPIN of a process are the longest that one of its threads waited in the cycle. They used to follow only the thread with the most delay since it started, so a process whose worker thread waited all the time could show 0 and sort as idle.
  • The interactive view refreshes when the delay is over. It used to wait in steps of 200 ms, so -d 0.5 refreshed every 0.6 s and any delay below 0.2 s became 0.2 s. A delay of 0 now refreshes as fast as the data can be read.
  • After an exec a process starts over as the new program that it shows, with a new graph and new totals since first seen.
  • Batch mode with -p reads only the process of the given task, with all its threads, instead of every task of the system. With many tasks a cycle took seconds before; now it takes almost nothing. The Total DISK READ and Total DISK WRITE then cover only that process.
  • The config file is replaced only when the new one is complete. -W and W write a temporary file next to it and rename it over the old one, so a crash or a failed write no longer leaves the config empty or cut. A symlinked config keeps its link, and the file keeps its mode and owner, also when root saves the config of a user. When that is not possible, e.g. in a directory that is not writable, the config is written in place as before. On a full disk the save now fails and keeps the old config.

New features

  • --flat lists the threads alone in the interactive view, sorted by their own values, instead of grouping them below their process. Ctrl-F toggles it, --no-flat turns it off and the setting is saved in the config file. It has no effect when only processes are shown. (#87)
  • --no-inverse turns off --inverse, e.g. after it was saved in the config file.
  • --debug-write works like -W, but writes the config with the preceding options to standard output instead of saving it, and exits. It is meant for debugging and testing. (Masatake YAMATO)
  • make check runs a test of the option parsing (Masatake YAMATO), without the config file of the user.
  • make scan runs the clang static analyzer (scan-build-23, or the one set in SCANBUILD) on a clean build. make pv also shows the compiler and the analyzer.

Fixes

  • With -c, a task whose command line has megabytes no longer crashes iotop. The shown command was built on the stack, so any user could crash an iotop that runs as root.
  • The short options from -5 onwards set the wrong flags in 1.32, after the VFS columns were added. (Masatake YAMATO, #101)
  • In -a and -A modes:
    • The default sort by the GRAPH column follows the totals that the columns show, so a task that did a lot of I/O and went idle no longer sinks among the idle ones. (#92)
    • o keeps the tasks with non-zero totals, like batch mode does, instead of hiding everything that is idle at the moment. (#84)
  • In the interactive thread view, processes are sorted by the values of the whole process, so a process whose I/O is done by worker threads is no longer sorted as idle. (#87)
  • Process totals:
    • The I/O of a process is no longer lost for a cycle when one of its threads exits.
    • A thread that calls exec no longer makes its I/O count twice in its process.
    • With -P, batch mode filtered by -p or -u now counts all the threads of a process. A process filtered by -p used to show none of the I/O of its threads.
    • An exited process no longer keeps the values of its last cycle for sorting, so it no longer stays above the live ones while it shows 0, and -P -o no longer keeps showing it.
  • Tasks are matched between cycles by their start on the monotonic clock. After a suspend and resume or a step of the wall clock, no task was matched: the graphs and the totals started over and all the command lines were read again.
  • A new task that gets the TID of an exited one no longer takes over the history and the accumulated values of the old task.
  • A counter that goes down is no longer taken as a huge growth.
  • A task whose taskstats query can not be sent, e.g. under memory pressure, is shown with Error. It was shown as TID 0, and the real task was missing for that cycle.
  • Where time_t has 32 bits, e.g. on i386, iotop no longer goes wrong after 24.8 days of uptime. The length of a cycle came out wrong, all tasks looked new for one cycle, and from 49.7 days on the interactive view stopped refreshing.
  • On 64-bit CPUs that trap on an unaligned access, e.g. sparc64, reading the taskstats replies could trap.
  • The full command line no longer ends with a space, which also showed in batch mode and kept a search ending with $ from matching.
  • The interactive view:
    • It computes the values of a cycle as soon as the data is read, not when it is drawn. Holding down a key that does not redraw could skip that step for a cycle. The accumulated bandwidth then showed gigabytes per second for the rest of the run, the graphs started over and exited tasks were lost.
    • The last row of the list can be scrolled to, paging no longer skips a row and the scrollbar reaches the bottom.
    • With about a million tasks on a tall terminal, the scrollbar was drawn in the wrong place or not at all.
    • The search cursor stays at the end of the text when the text scrolls over double width characters. It was one column to the right.
    • On a narrow terminal the COMMAND column no longer shows garbage.
    • The header graphs no longer move while the data is frozen.
    • The sort by COMMAND follows the shown command, also with the thread names that -c adds.
    • D keeps IOTOP_NO_RENICE, NO_COLOR and the count of -n. After D, i could change I/O priorities that IOTOP_NO_RENICE locks, and iotop no longer stopped after -n refreshes.
    • The I/O priority of a typed TID is changed only when the prompt shows that task. An invalid TID applied realtime 0, and TID 0 changed the priority of iotop itself.
  • Tasks with SCHED_DEADLINE and no I/O priority of their own show the realtime class, as the kernel uses it. They were shown as best effort.
  • An invalid option in the config file names the config file. iotop still stops, so that it does not run with only a part of the config.
  • A signal no longer cleans up inside its handler, which could break the heap or leave the terminal in raw mode. iotop now exits from its loops, also during the delay of batch mode.
  • -W and W no longer save --no-color when only NO_COLOR turns the colors off, and --color under NO_COLOR is saved.
  • The search filter loads back from the config file as it was saved: spaces at its end are kept. A filter with a line break, only possible from the command line, is not saved; it was saved as two lines and iotop did not start again until the config was edited.
  • The batch header is aligned with its columns from USER onwards, and the TID column is as wide as the largest TID, e.g. 7 digits with the pid_max that systemd sets.
  • With -k, or with a threshold of 10, values of 5 digits and more no longer push the rest of the row and the header out of their columns. They show fewer decimals instead.
  • When the config file can not be saved because there is no home or XDG directory, or the path is too long, the reason is shown.
  • Builds with a compiler that has -flto but not -flto=auto use LTO.
  • With glibc older than 2.17, -lrt comes after the objects on the link line, so a linker with --as-needed no longer drops it.
  • Bigger taskstats replies of future kernels fit. Before, a few more fields would have made all tasks show no I/O.
  • Memory leaks on exit are fixed in the interactive view and with --filter in batch mode. (Masatake YAMATO, #102)
  • The help, the man page and the README match the code again. The man page now says that USER is the real user of a task, so a set-user-ID program shows the user that started it, and that batch mode keeps its columns fixed: only the VFS columns follow the options that hide or show them. It no longer says that the start of a task needs taskstats version 12, that exited tasks stay 3 seconds when the GRAPH column is hidden (they stay two refresh cycles), or that the values of the threads are always summed in their process (only with -P).

Internals

  • iotop keeps all the I/O data as integers: byte counts, delays in nanoseconds and times in milliseconds. The graph history sums no longer drift, and floating point is used only to format the values for the display.
  • Sorting by accumulated values computes the value of each task once instead of in every comparison, which matters with many tasks and on CPUs without a floating point unit.
  • The threads of a process whose main thread exited reuse their command line between cycles, like the other tasks, instead of reading it in every cycle.
  • Each task uses 80 bytes less memory, and the graph history of a task is freed once it has been idle for the whole graph. With many long running tasks that did I/O once, the histories used to grow to gigabytes.

What's Changed

  • Fix memory leaks on exit in interactive mode by @masatake in #102
  • Fix option offset mismatch in str_opt and add a basic test by @masatake in #101

Full Changelog: v1.32...v1.33