Skip to main content
We’ve updated our Terms of Service. A new AI Addendum clarifies how Stack Overflow utilizes AI interactions.
added 190 characters in body
Source Link
Stéphane Chazelas
  • 586k
  • 96
  • 1.1k
  • 1.7k

You could do something like:

mv my-executable my-executable.bin

And create my-executable as a wrapper script that does:

#! /bin/bash -
{ time "$0.bin" "$@" 2>&3 3>&-; } 3>&2 2>> /tmp/times.log

The script could add more information to the log like the time it was started, by whom, the arguments it was passed...

BSD process accounting, at least on Linux does report CPU time (user + sys), though not in a cumulative way like time does (children processes CPU time is not accounted for the parent)

You could do something like:

mv my-executable my-executable.bin

And create my-executable as a wrapper script that does:

#! /bin/bash -
{ time "$0.bin" "$@" 2>&3 3>&-; } 3>&2 2>> /tmp/times.log

The script could add more information to the log like the time it was started, by whom, the arguments it was passed...

You could do something like:

mv my-executable my-executable.bin

And create my-executable as a wrapper script that does:

#! /bin/bash -
{ time "$0.bin" "$@" 2>&3 3>&-; } 3>&2 2>> /tmp/times.log

The script could add more information to the log like the time it was started, by whom, the arguments it was passed...

BSD process accounting, at least on Linux does report CPU time (user + sys), though not in a cumulative way like time does (children processes CPU time is not accounted for the parent)

Source Link
Stéphane Chazelas
  • 586k
  • 96
  • 1.1k
  • 1.7k

You could do something like:

mv my-executable my-executable.bin

And create my-executable as a wrapper script that does:

#! /bin/bash -
{ time "$0.bin" "$@" 2>&3 3>&-; } 3>&2 2>> /tmp/times.log

The script could add more information to the log like the time it was started, by whom, the arguments it was passed...