What units are the I/O measures in GNU "time" in?

Solution 1:

From the manual:

The `%I' and `%O' values are allegedly only `real'
input and output and do not include those supplied
by caching devices. The meaning of `real' I/O reported
by `%I' and `%O' may be muddled for workstations,
especially diskless ones.

So units are in I/Os. Perhaps the source code knows what that means. From the summarize function documentation in time.c:

...
I == file system inputs (ru_inblock)
...
O == file system outputs (ru_oublock)
...

ru_inblock and ru_oblock come from getrusage. From the getrusage manual:

ru_inblock (since Linux 2.6.22)
  The number of times the filesystem had to perform input.

ru_oublock (since Linux 2.6.22)
  The number of times the filesystem had to perform output.

Well that's not particularly useful, but LKML shows the patches being discussed(https://lkml.org/lkml/2007/3/19/100) to add ru_inblock and ru_oublock:

As TASK_IO_ACCOUNTING currently counts bytes, we approximate blocks
count doing : nr_blocks = nr_bytes / 512

A check on the current kernel source code(https://github.com/spotify/linux/blob/master/include/linux/task_io_accounting_ops.h) shows:

/*
 * We approximate number of blocks, because we account bytes only.
 * A 'block' is 512 bytes
 */
static inline unsigned long task_io_get_inblock(const struct task_struct *p)
{
    return p->ioac.read_bytes >> 9;
}

and

/*
 * We approximate number of blocks, because we account bytes only.
 * A 'block' is 512 bytes
 */
static inline unsigned long task_io_get_oublock(const struct task_struct *p)
{
    return p->ioac.write_bytes >> 9;
}

In short, yes, blocks are approximately 512 bytes each.

Solution 2:

I would guess the "filesystem inputs/outputs" means the block size, so if the underlying filesystem has been formatted with 512 byte blocks, it returns that, if something else, then that.

But this is just a guess.