bug-time
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

time output buffering


From: Philip Rowlands
Subject: time output buffering
Date: Fri, 30 Oct 2020 22:56:15 +0000
User-agent: Cyrus-JMAP/3.3.0-530-g8da6958-fm-20201021.003-g69105b13-v35

time makes a lot of syscalls for a small amount of output, due to putc(3) 
writing to stderr.

Suggest that time calls setvbuf(stderr, NULL, _IOLBF, 0), specified in C89.


Cheers,
Phil

### Before
$ strace -e trace=write -c time true
0.00user 0.00system 0:00.01elapsed 0%CPU (0avgtext+0avgdata 472maxresident)k
0inputs+0outputs (0major+145minor)pagefaults 0swaps
% time     seconds  usecs/call     calls    errors syscall
------ ----------- ----------- --------- --------- ----------------
  0.00    0.000000           0       112           write
------ ----------- ----------- --------- --------- ----------------
100.00    0.000000                   112           total


### After
$ strace -e trace=write -c ./time true
0.00user 0.00system 0:00.00elapsed 0%CPU (0avgtext+0avgdata 476maxresident)k
0inputs+0outputs (0major+147minor)pagefaults 0swaps
% time     seconds  usecs/call     calls    errors syscall
------ ----------- ----------- --------- --------- ----------------
  0.00    0.000000           0         2           write
------ ----------- ----------- --------- --------- ----------------
100.00    0.000000                     2           total



reply via email to

[Prev in Thread] Current Thread [Next in Thread]