MyNixOS website logo
Description

record historical command runtimes for later prediction.

track historical runtimes for this directory and command, predict if there's time for a sandwich on this run

sandwatch

Remember how long commands take, tell me if I have enough time to make a sandwich?

This is inspired by arbtt, the shell built-in time, and the rust utility tally.

The name was suggested by qu1j0t3.

Why?

Rather than telling me how long something has taken, I would like to know roughly how long this task will take, based on historical records.

Sandwatch records the current directory, the command line, and the runtime for a command.

When running a new command that matches the directory and the first two words of the command line, sandwatch reports expected completion time in sandwich units (five minutes?).

How to use it?

It's a wrapper command. sandwatch cabal build or sandwatch make or whatever you like. Perhaps one day this will become a shell builtin written in Rust.

How to install it?

I suggest using ghcup to install the Haskell compiler and then cabal build in your clone of this git repo.

How does it work?

Sandwatch creates a json file holding entries recording the working directory, the command line, and the execution time.

When a command matches in the same directory, execution from previous runs is average together to give you a rough idea as to whether you have time to make a sandwich or not!

Tell me the root problem?

I don't have insight into the progress of a running program. I wish all programs would dump some number of percent complete events. I could use that to estimate completion time from start time.

Ideas

  • Is there a good way to turn command line arguments into a set? For example, ls -o -a is the same as ls -a -o but the strings are different. How could they be the same?
  • Is there some good way to automatically figure out how much of a command line to compare for equality?
  • How could I compare command lines for equality across directories? While make does different things in different directories, apt install is always the same. How do you decide?
Metadata

Version

0.1.1.0

Platforms (75)

    Darwin
    FreeBSD
    Genode
    GHCJS
    Linux
    MMIXware
    NetBSD
    none
    OpenBSD
    Redox
    Solaris
    WASI
    Windows
Show all
  • aarch64-darwin
  • aarch64-genode
  • aarch64-linux
  • aarch64-netbsd
  • aarch64-none
  • aarch64_be-none
  • arm-none
  • armv5tel-linux
  • armv6l-linux
  • armv6l-netbsd
  • armv6l-none
  • armv7a-darwin
  • armv7a-linux
  • armv7a-netbsd
  • armv7l-linux
  • armv7l-netbsd
  • avr-none
  • i686-cygwin
  • i686-darwin
  • i686-freebsd
  • i686-genode
  • i686-linux
  • i686-netbsd
  • i686-none
  • i686-openbsd
  • i686-windows
  • javascript-ghcjs
  • loongarch64-linux
  • m68k-linux
  • m68k-netbsd
  • m68k-none
  • microblaze-linux
  • microblaze-none
  • microblazeel-linux
  • microblazeel-none
  • mips-linux
  • mips-none
  • mips64-linux
  • mips64-none
  • mips64el-linux
  • mipsel-linux
  • mipsel-netbsd
  • mmix-mmixware
  • msp430-none
  • or1k-none
  • powerpc-netbsd
  • powerpc-none
  • powerpc64-linux
  • powerpc64le-linux
  • powerpcle-none
  • riscv32-linux
  • riscv32-netbsd
  • riscv32-none
  • riscv64-linux
  • riscv64-netbsd
  • riscv64-none
  • rx-none
  • s390-linux
  • s390-none
  • s390x-linux
  • s390x-none
  • vc4-none
  • wasm32-wasi
  • wasm64-wasi
  • x86_64-cygwin
  • x86_64-darwin
  • x86_64-freebsd
  • x86_64-genode
  • x86_64-linux
  • x86_64-netbsd
  • x86_64-none
  • x86_64-openbsd
  • x86_64-redox
  • x86_64-solaris
  • x86_64-windows