News for hackers. Stuff that matters.
Re:Benchmarking shell pipelines and the Unix “tools” philosophy by tuldia on Tuesday January 07, 2020 @04:02PM (#21984806)
Thanks for this!

Another nice thing about /usr/bin/time is the --verbose flag which gives:

  Command being timed: "ls"
  User time (seconds): 0.00
  System time (seconds): 0.00
  Percent of CPU this job got: 0%
  Elapsed (wall clock) time (h:mm:ss or m:ss): 0:00.00
  Average shared text size (kbytes): 0
  Average unshared data size (kbytes): 0
  Average stack size (kbytes): 0
  Average total size (kbytes): 0
  Maximum resident set size (kbytes): 1912
  Average resident set size (kbytes): 0
  Major (requiring I/O) page faults: 0
  Minor (reclaiming a frame) page faults: 112
  Voluntary context switches: 1
  Involuntary context switches: 1
  Swaps: 0
  File system inputs: 0
  File system outputs: 0
  Socket messages sent: 0
  Socket messages received: 0
  Signals delivered: 0
  Page size (bytes): 4096
  Exit status: 0
:)
Re:Benchmarking shell pipelines and the Unix “tools” philosophy by yingw787 on Tuesday January 07, 2020 @06:07PM (#21986233)
Wow this looks amazing! I didn’t know time could track all of those!
Re:Benchmarking shell pipelines and the Unix “tools” philosophy by vaingloriole on Tuesday January 07, 2020 @06:59PM (#21986661)
man getrusage
Re:Benchmarking shell pipelines and the Unix “tools” philosophy by boyter on Wednesday January 08, 2020 @12:55AM (#21988734)
Can anyone comment why you can only use the verbose flag if you use the full path of time?

    time -v ls
does not work but

    /usr/bin/time -v ls
does? I don't have enough knowledge of either linux applications or bash to know whats happening to cause this.
Re:Benchmarking shell pipelines and the Unix “tools” philosophy by dtwwtd on Wednesday January 08, 2020 @01:03AM (#21988768)
This is very likely because without the full path your shell is using the `time` builtin function of your shell as opposed to using the binary.

The shell's builtin keyword for `time` is more limited in nature than the full `time` binary. This is true of a number of other common unix commands as well, e.g. `echo`. The manpage for your shell should describe the builtins functions.

Re:Benchmarking shell pipelines and the Unix “tools” philosophy by eesmith on Wednesday January 08, 2020 @01:01AM (#21988762)
Your shell has a built-in "time" command.

man bash:

    If the time reserved word precedes a pipeline, the elapsed as well
    as user and system time consumed by its execution are reported when
    the pipeline terminates.
man time:

     Some shells may provide a builtin time command which is similar
     or identical to this utility.  Consult the builtin(1) manual page.
Re:Benchmarking shell pipelines and the Unix “tools” philosophy by inimino on Wednesday January 08, 2020 @02:05AM (#21989034)
You can also type `type time` to see that time is a builtin. `which` and `hash` may also be interesting.
Re:Benchmarking shell pipelines and the Unix “tools” philosophy by amypinka on Wednesday January 08, 2020 @01:05AM (#21988775)
The full path calls a GNU tool, the other calls your shell's builtin function.
Re:Benchmarking shell pipelines and the Unix “tools” philosophy by tuldia on Wednesday January 08, 2020 @02:57AM (#21989314)
You can also use:

  \time -v ls
to skip the builtin version.