<commit_before>/*---------------------------------------------------------------------------
   Copyright (c) 2015 <NAME>. All rights reserved.
   Distributed under the BSD3 license, see license at the end of the file.
   %%NAME%% release %%VERSION%%
   --------------------------------------------------------------------------*/

#include <caml/mlvalues.h>
#include <caml/alloc.h>
#include <caml/memory.h>

/* Detect platform */

#if defined(__APPLE__) && defined(__MACH__)
  #define OCAML_MTIME_DARWIN

#elif defined (__unix__) || defined(__unix)
 #include <unistd.h>
 #if defined(_POSIX_VERSION)
   #define OCAML_MTIME_POSIX
 #endif
#endif

/* Darwin */

#if defined(OCAML_MTIME_DARWIN)

#include <mach/mach_time.h>
#include <stdint.h>

CAMLprim value ocaml_mtime_elapsed_ns (value unit)
{
  static uint64 start = 0L;
  static mach_timebase_info_data_t scale;
  if (start == 0L)
  {
    start = mach_absolute_time ();
    mach_timebase_info (&scale);
    if (scale.denom == 0) { scale.numer = 0; scale.denom = 1; }
  }

  uint64 now = mach_absolute_time ();
  return caml_copy_int64 (((now - start) * scale.numer) / scale.denom);
}
<commit_msg>C stub, use uint64_t type rather than uint64.<commit_after>/*---------------------------------------------------------------------------
   Copyright (c) 2015 <NAME>. All rights reserved.
   Distributed under the BSD3 license, see license at the end of the file.
   %%NAME%% release %%VERSION%%
   --------------------------------------------------------------------------*/

#include <caml/mlvalues.h>
#include <caml/alloc.h>
#include <caml/memory.h>

/* Detect platform */

#if defined(__APPLE__) && defined(__MACH__)
  #define OCAML_MTIME_DARWIN

#elif defined (__unix__) || defined(__unix)
 #include <unistd.h>
 #if defined(_POSIX_VERSION)
   #define OCAML_MTIME_POSIX
 #endif
#endif

/* Darwin */

#if defined(OCAML_MTIME_DARWIN)

#include <mach/mach_time.h>
#include <stdint.h>

CAMLprim value ocaml_mtime_elapsed_ns (value unit)
{
  static uint64_t start = 0L;
  static mach_timebase_info_data_t scale;
  if (start == 0L)
  {
    start = mach_absolute_time ();
    mach_timebase_info (&scale);
    if (scale.denom == 0) { scale.numer = 0; scale.denom = 1; }
  }

  uint64_t now = mach_absolute_time ();
  return caml_copy_int64 (((now - start) * scale.numer) / scale.denom);
}

{'fraction_non_alphanumeric': 0.24271012006861065, 'fraction_numerical': 0.015437392795883362, 'mean_word_length': 2.328102710413695, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 17, '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': '575929', 'n_tokens_mistral': 807, 'n_tokens_neox': 766, 'n_words': 189}