<commit_before>#pragma once

// TODO: REWRITE to multiplatform!!!
#ifdef __MACH__

#define CLOCK_PROCESS_CPUTIME_ID 0

#include <sys/time.h>
//clock_gettime is not implemented on OSX
int clock_gettime(int /*clk_id*/, struct timespec* t) {
    struct timeval now;
    int rv = gettimeofday(&now, NULL);
    if (rv) return rv;
    t->tv_sec  = now.tv_sec;
    t->tv_nsec = now.tv_usec * 1000;
    return 0;
}
#else
#include <ctime>
#endif

namespace cetech {
    namespace time {
        struct PerfTimer {
            timespec time;
        };


        inline PerfTimer get_perftime() {
            timespec temp;

            clock_gettime(CLOCK_PROCESS_CPUTIME_ID, &temp);

            return {
                       temp
            };
        }

        inline long get_sec(const PerfTimer& timer) {
            return timer.time.tv_sec;
        }

        inline long get_nsec(const PerfTimer& timer) {
            return timer.time.tv_nsec;
        }
    }
}<commit_msg>darwin64, #112<commit_after>#pragma once

// TODO: REWRITE to multiplatform!!!
#ifdef __MACH__

#define CLOCK_PROCESS_CPUTIME_ID 0

#include <sys/time.h>
//clock_gettime is not implemented on OSX
int clock_gettime(int /*clk_id*/, struct timespec* t) {
    struct timeval now;
    int rv = gettimeofday(&now, NULL);
    if (rv) return rv;
    t->tv_sec  = now.tv_sec;
    t->tv_nsec = now.tv_usec * 1000;
    return 0;
}
#else
#include <ctime>
#endif

namespace cetech {
    namespace time {
        struct PerfTimer {
            timespec time;
        };


        inline PerfTimer get_perftime() {
            timespec temp;

            clock_gettime(CLOCK_PROCESS_CPUTIME_ID, &temp);

            return {
                       temp
            };
        }

        inline int64_t get_sec(const PerfTimer& timer) {
            return timer.time.tv_sec;
        }

        inline int64_t get_nsec(const PerfTimer& timer) {
            return timer.time.tv_nsec;
        }
    }
}
{'fraction_non_alphanumeric': 0.0958694543600204, 'fraction_numerical': 0.010708822029576747, 'mean_word_length': 1.9817629179331306, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 11, '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': '776419', 'n_tokens_mistral': 685, 'n_tokens_neox': 646, 'n_words': 157}