<commit_before>/* timers.h                                                        -*- C++ -*-
   <NAME>, 1 April 2009
   Copyright (c) 2009 <NAME>.  All rights reserved.

   Different types of timers.
*/

#ifndef __arch__timers_h__
#define __arch__timers_h__

#include <sys/time.h>
#include "tick_counter.h"
#include "format.h"
#include <string>

namespace ML {

inline double cpu_time()
{
    clock_t clk = clock();
    return clk / 1000000.0;  // clocks per second
}

inline double wall_time()
{
    struct timeval tv;
    struct timezone tz;
    int res = gettimeofday(&tv, &tz);
    if (res != 0)
        throw Exception("gettimeofday() returned "
                        + std::string(strerror(errno)));

    return tv.tv_sec + (tv.tv_usec / 1000000.0);
}
 
struct Timer {
    double wall_, cpu_;
    unsigned long long ticks_;
    
    Timer()
    {
        restart();
    }<commit_msg>Added missing include to timers<commit_after>/* timers.h                                                        -*- C++ -*-
   <NAME>, 1 April 2009
   Copyright (c) 2009 <NAME>.  All rights reserved.

   Different types of timers.
*/

#ifndef __arch__timers_h__
#define __arch__timers_h__

#include <sys/time.h>
#include "tick_counter.h"
#include "format.h"
#include <string>
#include <cerrno>

namespace ML {

inline double cpu_time()
{
    clock_t clk = clock();
    return clk / 1000000.0;  // clocks per second
}

inline double wall_time()
{
    struct timeval tv;
    struct timezone tz;
    int res = gettimeofday(&tv, &tz);
    if (res != 0)
        throw Exception("gettimeofday() returned "
                        + std::string(strerror(errno)));

    return tv.tv_sec + (tv.tv_usec / 1000000.0);
}
 
struct Timer {
    double wall_, cpu_;
    unsigned long long ticks_;
    
    Timer()
    {
        restart();
    }
{'fraction_non_alphanumeric': 0.12032967032967033, 'fraction_numerical': 0.02857142857142857, 'mean_word_length': 2.123499142367067, 'pattern_counts': {'":': 0, '<': 12, '<?xml version=': 0, '>': 12, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3577749', 'n_tokens_mistral': 633, 'n_tokens_neox': 567, 'n_words': 164}