#!/usr/bin/env php
<?php
/*
 * Copyright (c) 2015-2016 Flávio Veloso
 * License: Apache License V2 <http://www.apache.org/licenses/LICENSE-2.0.html>
 */

foreach ([__DIR__ . '/../../autoload.php', __DIR__ . '/../vendor/autoload.php']
         as $autoload_php) {
	if (file_exists($autoload_php)) {
		require $autoload_php;
		break;
	}
}

if ($argc == 1) {
	error_log("Usage: timeit CODE [MORE-CODE...]");
	exit(1);
}

if (!function_exists('timeit')) {
	require __DIR__ . '/../src/functions.php';
}

for ($i = 1; $i < $argc; $i++) {
	print "$argv[$i]: ";
	print timeit_str($argv[$i]) . "\n";
}
