<commit_before>#ifndef _TIMEDEFS_H_
#define _TIMEDEFS_H_


#define BURST_TX_DRAIN_US 200
struct timestamp_option
{
	uint8_t type;
	uint8_t length;
	uint32_t timestamp;
	uint32_t echo_timestamp;
} __attribute__ ((__packed__));


uint64_t prev_tsc = 0, prev_arp = 0, prev_disp = 0, cur_tsc = 0, timer_tsc = 0;

static uint64_t one_msec		= 0;
static uint64_t one_sec			= 0;
static uint64_t one_usec 		= 0;
static uint64_t one_nsec 		= 0;

uint64_t diff_tsc abs(cur_tsc - prev_tsc)



#endif<commit_msg>timer Defines v2<commit_after>#ifndef _TIMEDEFS_H_
#define _TIMEDEFS_H_

#define MILLION 1000000UL
#define BURST_TX_DRAIN_US 200
struct timestamp_option
{
	uint8_t type;
	uint8_t length;
	uint32_t timestamp;
	uint32_t echo_timestamp;
} __attribute__ ((__packed__));

const static uint64_t one_sec		= rte_get_tsc_hz();
const static uint64_t one_msec		= (one_sec/1000UL);
const static uint64_t one_usec 		= (one_msec/1000UL);
const static uint64_t one_nsec 		= (one_usec/1000UL);

uint64_t prev_tsc = 0, cur_tsc = 0, timer_tsc = 0;

#define diff_tsc abs(cur_tsc - prev_tsc)	//--!check for bugs

/**
This function provides a sleep in msec
*/
static inline void sleep_msec(unsigned msec) {	//--! should it be in the timer_functions file?
	uint64_t curr_sleep = 0, prev_sleep = rte_rdtsc()/one_msec;
	while(curr_sleep - prev_sleep <= msec) 
		curr_sleep = rte_rdtsc()/one_msec;
	return;
}
/**
This function provides a sleep in usec
*/
static inline void sleep_usec(unsigned sec) {	//--! should it be in the timer_functions file?
	uint64_t curr_sleep = 0, prev_sleep = rte_rdtsc()/one_usec;
	while(curr_sleep - prev_sleep <= usec)
		curr_sleep = rte_rdtsc()/one_usec;
	return;
}
/**
This function provides a sleep in nsec
*/
static inline void sleep_nsec(unsigned nsec) {	//--! should it be in the timer_functions file?
	uint64_t curr_sleep = 0, prev_sleep = rte_rdtsc()/one_nsec;
	while(curr_sleep - prev_sleep <= nsec)
		curr_sleep = rte_rdtsc()/one_nsec;
	return;
}


#endif
{'fraction_non_alphanumeric': 0.09695431472081219, 'fraction_numerical': 0.04111675126903553, 'mean_word_length': 4.797058823529412, 'pattern_counts': {'":': 0, '<': 6, '<?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': '887165', 'n_tokens_mistral': 874, 'n_tokens_neox': 811, 'n_words': 199}