<commit_before>class Object # :nodoc:
	@@benchmark_results = {}

	def b!(name)
		time1 = Time.now
		begin
			yield
		ensure
			time2 = Time.now
			@@benchmark_results[name] = 0 unless @@benchmark_results.has_key?(name)
			@@benchmark_results[name] += time2 - time1
		end 
	end

	def benchmark_report
		total = 0
		@@benchmark_results.each_value do |time|
			total += time
		end
		@@benchmark_results.each_pair do |name, time|
			printf "%-12s: %.4f (%.2f%%)\n", name, time, time / total * 100
		end
		printf "-- Total: %.4f\n", total
	end
end
<commit_msg>Benchmark times can now be calculated relative to a certain name.<commit_after>class Object # :nodoc:
	@@benchmark_results = {}

	def b!(name)
		time1 = Time.now
		begin
			yield
		ensure
			time2 = Time.now
			@@benchmark_results[name] = 0 unless @@benchmark_results.has_key?(name)
			@@benchmark_results[name] += time2 - time1
		end 
	end

	def benchmark_report(main = nil)
		total = 0
		if main.nil?
			@@benchmark_results.each_value do |time|
				total += time
			end
		else
			total = @@benchmark_results[main]
		end
		@@benchmark_results.each_pair do |name, time|
			printf "%-12s: %.4f (%.2f%%)\n", name, time, time / total * 100
		end
		printf "-- Total: %.4f\n", total
	end
end

{'fraction_non_alphanumeric': 0.13446054750402575, 'fraction_numerical': 0.02254428341384863, 'mean_word_length': 3.3461538461538463, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '6066866', 'n_tokens_mistral': 528, 'n_tokens_neox': 452, 'n_words': 121}