<commit_before>#pragma once

#include <stddef.h>
#include <stdbool.h>
#include <assert.h>

#if defined(__linux__)
	#include <time.h>
	#include <unistd.h>
	#include <sys/mman.h>
#elif defined(__native_client__)
	#include <sys/time.h>
#else
	#if defined(__MACH__)
		#include <mach/mach.h>
		#include <mach/mach_time.h>
	#endif
#endif

inline static double read_timer() {
#if defined(__linux__)
	struct timespec ts;
	int result = clock_gettime(CLOCK_MONOTONIC, &ts);
	assert(result == 0);
	return ((double) ts.tv_sec) + ((double) ts.tv_nsec) * 1.0e-9;
#elif defined(__MACH__)
	static mach_timebase_info_data_t timebase_info;
	if (timebase_info.denom == 0) {
		mach_timebase_info(&timebase_info);
	}

	return ((double) (mach_absolute_time() * timebase_info.numer / timebase_info.denom)) * 1.0e-9;
#elif defined(__native_client__)
	struct timeval walltime;
	int result = gettimeofday(&walltime, NULL);
	assert(result == 0);
	return ((double) walltime.tv_sec) + ((double) walltime.tv_usec) * 1.0e-6;
#else
	#error No implementation available
#endif
}

#define NNP_TOTAL_START(profile_ptr) \
	double total_start; \
	if (profile_ptr != NULL) { \
		total_start = read_timer(); \
	}

#define NNP_KERNEL_TRANSFORM_START(profile_ptr) \
	double kernel_transform_start; \
	if (profile_ptr != NULL) { \
		kernel_transform_start = read_timer(); \
	}
<commit_msg>Profile: fix uninitialized variable bug in timing code<commit_after>#pragma once

#include <stddef.h>
#include <stdbool.h>
#include <assert.h>

#if defined(__linux__) || defined(__native_client__)
	#include <time.h>
	#include <unistd.h>
	#include <sys/mman.h>
#else
	#if defined(__MACH__)
		#include <mach/mach.h>
		#include <mach/mach_time.h>
	#endif
#endif

inline static double read_timer() {
#if defined(__linux__) || defined(__native_client__)
	struct timespec ts;
	int result = clock_gettime(CLOCK_MONOTONIC, &ts);
	assert(result == 0);
	return ((double) ts.tv_sec) + ((double) ts.tv_nsec) * 1.0e-9;
#elif defined(__MACH__)
	static mach_timebase_info_data_t timebase_info;
	if (timebase_info.denom == 0) {
		mach_timebase_info(&timebase_info);
	}

	return ((double) (mach_absolute_time() * timebase_info.numer / timebase_info.denom)) * 1.0e-9;
#else
	#error No implementation available
#endif
}

#define NNP_TOTAL_START(profile_ptr) \
	double total_start; \
	if (profile_ptr != NULL) { \
		*profile_ptr = (struct nnp_profile) { 0 }; \
		total_start = read_timer(); \
	}

#define NNP_KERNEL_TRANSFORM_START(profile_ptr) \
	double kernel_transform_start; \
	if (profile_ptr != NULL) { \
		kernel_transform_start = read_timer(); \
	}

{'fraction_non_alphanumeric': 0.1389856755710414, 'fraction_numerical': 0.008130081300813009, 'mean_word_length': 5.226506024096386, 'pattern_counts': {'":': 0, '<': 20, '<?xml version=': 0, '>': 20, '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': '1515207', 'n_tokens_mistral': 1023, 'n_tokens_neox': 997, 'n_words': 204}