// Build as a private ld.lld and pass -B -fuse-ld=lld to GCC. // GNU time writes peak KiB, elapsed seconds, exit status, and linker arguments. module main import os fn measure() ! { linker := os.getenv('VINIX_REAL_LD') log := os.getenv('VINIX_LINK_LOG') if !os.is_abs_path(linker) || !os.is_abs_path(log) { return error('set VINIX_REAL_LD and VINIX_LINK_LOG to absolute paths') } if os.real_path(linker) == os.real_path(os.executable()) { return error('VINIX_REAL_LD resolves to the timing wrapper itself') } mut args := ['-a', '-o', log, '-f', '%M\t%e\t%x\t%C', linker] args << os.args[1..] os.execvp('time', args)! } fn main() { measure() or { eprintln(err) exit(1) } }