<commit_before>#include <stdlib.h>
#include <stdio.h>

#include <pthread.h>


extern void moin(void);
#define SHARED_LIB_FUNC moin

#define VTRACE_OFF __attribute__((__no_instrument_function__))
#define STR(x) #x
#define EVAL(x,y) x(y)

static FILE *tf = NULL;


static long VTRACE_OFF get_ns()
{
	long ns;
	struct timespec ts;

	clock_gettime(CLOCK_MONOTONIC, &ts);
	ns = ts.tv_nsec + (ts.tv_sec * 1000000000l);

	return ns;
}


static void VTRACE_OFF vtrace_exit()
{
	fclose(tf);
}


static void VTRACE_OFF vtrace_init()
{
	tf = fopen("test.vtrc", "w");

	fprintf(tf, "VTRACE\n");
	fprintf(tf,"date:now :o)\n");

#ifdef SHARED_LIB_FUNC
	fprintf(tf,"mapping: %s %p\n", EVAL(STR,SHARED_LIB_FUNC), moin);
#endif

	fprintf(tf,"data:\n");

	atexit(vtrace_exit);
}


void VTRACE_OFF __cyg_profile_func_enter(void *this_fn, void *call_site)
{
	static int init = 0;
	pthread_t t = pthread_self();

	if(!init)
	{
		init = 1;
		vtrace_init();
	}

	fprintf(tf, "%ld>%p\n", get_ns(), this_fn);
}


void  VTRACE_OFF __cyg_profile_func_exit(void *this_fn, void *call_site)
{
	pthread_t t = pthread_self();

	fprintf(tf, "%ld<%p\n", get_ns(), this_fn);
}
<commit_msg>Set file buffer to 256 MB.<commit_after>#include <stdlib.h>
#include <stdio.h>

#include <pthread.h>

#define BUFFER_SIZE (256*1024*1024)
#define SHARED_LIB_FUNC __cyg_profile_func_enter

#define VTRACE_OFF __attribute__((__no_instrument_function__))
#define STR(x) #x
#define EVAL(x,y) x(y)

static FILE *tf = NULL;


static long VTRACE_OFF get_ns()
{
	long ns;
	struct timespec ts;

	clock_gettime(CLOCK_MONOTONIC, &ts);
	ns = ts.tv_nsec + (ts.tv_sec * 1000000000l);

	return ns;
}


static void VTRACE_OFF vtrace_exit()
{
	fclose(tf);
}


static void VTRACE_OFF vtrace_init()
{
	char *buffer;
	tf = fopen("test.vtrc", "w");	

	buffer = malloc(BUFFER_SIZE);

	if(!buffer)
		printf("[VTRACE] Could not allocate buffer.\n");

	setbuf(tf, buffer); 

	fprintf(tf, "VTRACE\n");
	fprintf(tf,"date:now :o)\n");

#ifdef SHARED_LIB_FUNC
	fprintf(tf,"mapping: %s %p\n", EVAL(STR,SHARED_LIB_FUNC), SHARED_LIB_FUNC);
#endif

	fprintf(tf,"data:\n");

	atexit(vtrace_exit);
}


void VTRACE_OFF __cyg_profile_func_enter(void *this_fn, void *call_site)
{
	static int init = 0;
	pthread_t t = pthread_self();

	if(!init)
	{
		init = 1;
		vtrace_init();
	}

	fprintf(tf, "%ld>%p\n", get_ns(), this_fn);
}


void  VTRACE_OFF __cyg_profile_func_exit(void *this_fn, void *call_site)
{
	pthread_t t = pthread_self();

	fprintf(tf, "%ld<%p\n", get_ns(), this_fn);
}

{'fraction_non_alphanumeric': 0.15806322529011604, 'fraction_numerical': 0.01520608243297319, 'mean_word_length': 5.25, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 2, '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': '6572480', 'n_tokens_mistral': 1141, 'n_tokens_neox': 1076, 'n_words': 221}