fpclock – a program measuring process execution time
Author: Paul Lipkowski
- Required: FreePascal Compiler
fpc
(version 3.0.4 or newer) - So far works on Linux amd64, MacOS AArch64/ARM64, and Windows x64 only.
- Not designed for 32-bit computers.
- If using Linux, FreeBSD or MacOS, then just compile by executing
compile.sh
- Then you can install fpclock to
$PATH
usinginstallBash.sh
(for Linux users)
- Then you can install fpclock to
- If using Windows, then compile by executing
compile.bat
- The default version of FPC is 3.2.2. If you use the another version of it, then edit the
compile.bat
script and change the setting containing FPC version (variablever
) in order to match your version.
- The default version of FPC is 3.2.2. If you use the another version of it, then edit the
- Syntax:
fpclock 'process' [flags]
- Available flags:
- (no flag) – Show execution time of COMMAND in seconds with precision of 4 digits and feed the line afterwards
-c
,--cstring
– Input command is C-like formatted (e.g.'echo \"Hello world\"'
)-e
,--env=E
– Choose the environment –E
is eithercmd
(default) orpowershell
(Windows only)-h
,--help
– Print help-n
,--no-feed-line
– Do not feed the line after having shown output-p N
,--prec=N
– Set precision to N digits (default N=4)-P
,--prompt
– Prompt for a command from standard input-u U
,--units=U
– Set measurement unit to U' (see more Us below)-v
,--version
– Show program version-V
,--version-full
– Show full program information (version + target)-w
,--wait
– Pause after measuring time (Windows only)-w N
,--wait=N
– Wait N milliseconds after measuring time (Windows only, default N=0)
- Available units with their flag values (
U
):- weeks -
w
orweeks
- days –
d
ordays
- hours -
h
,hr
,hrs
orhours
- minutes –
m
,min
,mins
orminutes
- seconds –
s
,sec
,secs
orseconds
- milliseconds –
ms
,milli
ormilliseconds
- microseconds –
u
,us
,μs
,mus
,micro
ormicroseconds
- ticks –
t
,ticks
- nanoseconds –
n
,ns
,nano
ornanoseconds
(The stopwatch is accurate to 1 tick = 100 ns though - or 1 μs = 1000 ns, if you use MacOS/FreeBSD) - clock –
c
,clock
(output like00:00:00.0000
, amount of decimal numbers depends onprec
flag).
- weeks -
- Examples:
fpclock 'ls -l'
fpclock 'cp ./foo/ ./bar -r' -n
fpclock 'cp ./foo/ ./bar -r' -n -p 6 -u ms
fpclock 'cp ./foo/ ./bar -r' -n --prec=6 --units=milliseconds