Skip to content
This repository has been archived by the owner on May 18, 2020. It is now read-only.
/ tester Public archive

print time and memory usage of a command

License

Notifications You must be signed in to change notification settings

Nugine/tester

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

tester

Install

cargo install --git https://github.com/Nugine/tester.git

Example

$ tester ./test/hello
Hello, world!
code: 0
real time: 3 ms
user time: 0 ms
sys time: 2 ms
memory: 1460 KB

$ echo hey | tester cat
hey
code: 0
real time: 5 ms
user time: 0 ms
sys time: 4 ms
memory: 2124 KB

$ tester -j ping -- www.baidu.com -c 5 > /dev/null 
{"code":0,"signal":null,"time":{"real":4051,"user":4,"sys":4},"memory":2748}

Usage

tester 0.3.1
Nugine <[email protected]>

USAGE:
    tester [FLAGS] [OPTIONS] <target> [-- <args>...]

FLAGS:
    -h, --help       Prints help information
    -j, --json       Json output
    -V, --version    Prints version information

OPTIONS:
    -o, --output <output>    output file path (default stderr)

ARGS:
    <target>     command to run
    <args>...    arguments to be passed

Output declaration

declare type TesterOutput = ({
    code: number
    signal: null
} | {
    code: null,
    signal: string
}) & {
    time: {
        real: number,
        user: number,
        sys: number
    },
    memory: number
}

Changelog

  • Add option --output on 0.3.1

  • Break changes on 0.3.0

    delete --arg

    pass arguments by [-- <args>...]

Todo

more test cases!