<commit_before><?php defined('SYSPATH') or die('No direct script access.');
/**
 * Provides simple benchmarking and profiling.
 *
 * @package    Kohana
 * @author     Kohana Team
 * @copyright  (c) 2009 Kohana Team
 * @license    http://kohanaphp.com/license.html
 */
class Profiler_Core {

	// Collected benchmarks
	protected static $_marks = array();

	/**
	 * Starts a new benchmark and returns a unique token.
	 *
	 * @param   string  benchmark name
	 * @param   string  group name
	 * @return  string
	 */
	public static function start($name, $group = 'general')
	{
		do
		{
			// Create a unique token and make sure it is not already in use
			$token = uniqid();
		}
		while (isset(Profiler::$_marks[$token]));

		Profiler::$_marks[$token] = array
		(
			'group' => $group,
			'name'  => $name,

			// Start the benchmark
			'start_time'   => microtime(TRUE),
			'start_memory' => memory_get_usage(),

			// Set NULL values
			'stop_time'    => FALSE,
			'stop_memory'  => FALSE,
		);

		return $token;
	}

	/**
	 * Stops a benchmark.
	 *
	 * @param   string  token
	 * @return  void
	 */
	public static function stop($token)
	{
		if ( ! isset(Profiler::$_marks[$token]))
		{
			throw new Kohana_Exception('Profiler token :token is not valid',
				array(':token', $token));
		}

		// Stop the benchmark
		Profiler::$_marks[$token]['stop_time']   = microtime(TRUE);
		Profiler::$_marks[$token]['stop_memory'] = memory_get_usage();
	}

	/**
	 * Deletes a benchmark.
	 * 
	 * @param   string  token
	 * @return  void
	 */
	public static function delete($token)
	{
		// Remove the benchmark
		unset(Profiler::$_marks[$token]);<commit_msg>Cleaning up Profiler, removed unnecessary isset() check and fixed a comment<commit_after><?php defined('SYSPATH') or die('No direct script access.');
/**
 * Provides simple benchmarking and profiling.
 *
 * @package    Kohana
 * @author     <NAME>
 * @copyright  (c) 2009 Kohana Team
 * @license    http://kohanaphp.com/license.html
 */
class Profiler_Core {

	// Collected benchmarks
	protected static $_marks = array();

	/**
	 * Starts a new benchmark and returns a unique token.
	 *
	 * @param   string  benchmark name
	 * @param   string  group name
	 * @return  string
	 */
	public static function start($name, $group = 'general')
	{
		do
		{
			// Create a unique token and make sure it is not already in use
			$token = uniqid();
		}
		while (isset(Profiler::$_marks[$token]));

		Profiler::$_marks[$token] = array
		(
			'group' => $group,
			'name'  => $name,

			// Start the benchmark
			'start_time'   => microtime(TRUE),
			'start_memory' => memory_get_usage(),

			// Set the stop keys without values
			'stop_time'    => FALSE,
			'stop_memory'  => FALSE,
		);

		return $token;
	}

	/**
	 * Stops a benchmark.
	 *
	 * @param   string  token
	 * @return  void
	 */
	public static function stop($token)
	{
		// Stop the benchmark
		Profiler::$_marks[$token]['stop_time']   = microtime(TRUE);
		Profiler::$_marks[$token]['stop_memory'] = memory_get_usage();
	}

	/**
	 * Deletes a benchmark.
	 * 
	 * @param   string  token
	 * @return  void
	 */
	public static function delete($token)
	{
		// Remove the benchmark
		unset(Profiler::$_marks[$token]);
{'fraction_non_alphanumeric': 0.14544319600499375, 'fraction_numerical': 0.0024968789013732834, 'mean_word_length': 3.1142490372272142, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 16, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3487993', 'n_tokens_mistral': 1176, 'n_tokens_neox': 1042, 'n_words': 287}