<commit_before>/* $Id$ */

#include <basic/timer.h>
#include <ctime>
#include <sys/time.h>



#if #cpu(transputer)
#  define TIMER TimeNowLow()
#  define DIVIDE CLK_TCK_LOW
#endif
#ifdef _ARCH_PPC
#  if #system(parix)
#    define TIMER TimeNow()
#    define DIVIDE CLOCK_TICK
#  endif
#  if #system(aix)
#    define DIVIDE CLOCKS_PER_SEC
#  endif
#endif
#if #cpu(sparc)
#  define DIVIDE 1.e6
#endif

#ifndef TIMER
#define TIMER clock();
#endif

#ifndef OVER_TIME
#define OVER_TIME 4294967296./DIVIDE
#endif

#ifndef DIVIDE
#define DIVIDE 1.e6
#endif


const double Timer::overtime = OVER_TIME;


Timer::Timer()
  : cumulative_time(0.)
{
  start();
};


void Timer::start () {
  running    = tru;
  overflow   = 0;
  start_time = TIMER / DIVIDE;
};



double Timer::stop () {
  running = false;
  double dtime =  TIMER / DIVIDE - start_time;
  if (dtime < 0) {
    overflow++;
  };
  
  cumulative_time += dtime;
  return full_time ();
};



double Timer::operator() () {
  if (running) {
    const double dtime =  TIMER / DIVIDE - start_time;
    if (dtime < 0) {
      overflow++;
    };
    
    return dtime + full_time();
  };
  
  return full_time();
};



void Timer::reset () {
  cumulative_time = 0.;
  running         = false;
};



double Timer::full_time () const {
  return cumulative_time + overflow*overtime;
};


<commit_msg>Small change.<commit_after>/* $Id$ */

#include <basic/timer.h>
#include <ctime>
#include <sys/time.h>



#if #cpu(transputer)
#  define TIMER TimeNowLow()
#  define DIVIDE CLK_TCK_LOW
#endif
#ifdef _ARCH_PPC
#  if #system(parix)
#    define TIMER TimeNow()
#    define DIVIDE CLOCK_TICK
#  endif
#  if #system(aix)
#    define DIVIDE CLOCKS_PER_SEC
#  endif
#endif
#if #cpu(sparc)
#  define DIVIDE 1.e6
#endif

#ifndef TIMER
#define TIMER clock()
#endif

#ifndef OVER_TIME
#define OVER_TIME 4294967296./DIVIDE
#endif

#ifndef DIVIDE
#define DIVIDE 1.e6
#endif


const double Timer::overtime = OVER_TIME;


Timer::Timer()
  : cumulative_time(0.)
{
  start();
};


void Timer::start () {
  running    = true;
  overflow   = 0;
  start_time = TIMER / DIVIDE;
};



double Timer::stop () {
  running = false;
  double dtime =  TIMER / DIVIDE - start_time;
  if (dtime < 0) {
    overflow++;
  };
  
  cumulative_time += dtime;
  return full_time ();
};



double Timer::operator() () {
  if (running) {
    const double dtime =  TIMER / DIVIDE - start_time;
    if (dtime < 0) {
      overflow++;
    };
    
    return dtime + full_time();
  };
  
  return full_time();
};



void Timer::reset () {
  cumulative_time = 0.;
  running         = false;
};



double Timer::full_time () const {
  return cumulative_time + overflow*overtime;
};



{'fraction_non_alphanumeric': 0.13880597014925372, 'fraction_numerical': 0.014179104477611941, 'mean_word_length': 3.118279569892473, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 9, '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': '7121832', 'n_tokens_mistral': 1117, 'n_tokens_neox': 1001, 'n_words': 247}