[][src]Function molt_shell::bench::benchmark

pub fn benchmark(interp: &mut Interp, args: &[String])

Executes the Molt benchmark harness, given the command-line arguments, in the context of the given interpreter.

The first element of the args array must be the name of the benchmark script to execute. The remaining elements are benchmark options. To see the list of options, see The Molt Book or execute this function with an empty argument list.

See molt::interp for details on how to configure and add commands to a Molt interpreter.

Example

use molt::Interp;
use std::env;

// FIRST, get the command line arguments.
let args: Vec<String> = env::args().collect();

// NEXT, create and initialize the interpreter.
let mut interp = Interp::new();

// NOTE: commands can be added to the interpreter here.

// NEXT, evaluate the file, if any.
if args.len() > 1 {
    molt_shell::benchmark(&mut interp, &args[1..]);
} else {
    eprintln!("Usage: mybench *filename.tcl");
}