<commit_before>#include <stdio.h>
#include <stdlib.h>

#include <sys/time.h>

#include <libunwind.h>

#define panic(args...)							  \
	do { fprintf (stderr, args); exit (-1); } while (0)

static inline double
gettime (void)
{
  struct timeval tv;

  gettimeofday(&tv, NULL);
  return tv.tv_sec + 1e-6*tv.tv_usec;
}

static int
measure_unwind (int maxlevel)
{
  double stop, mid, start;
  unw_cursor_t cursor;
  unw_context_t uc;
  int ret, level = 0;

  start = gettime ();

  unw_getcontext (&uc);
  if (unw_init_local (&cursor, &uc) < 0)
    panic ("unw_init_local() failed\n");

  mid = gettime ();

  do
    {
      ret = unw_step (&cursor);
      if (ret < 0)
	panic ("unw_step() failed\n");
      ++level;
    }
  while (ret > 0);

  stop = gettime ();

  if (level <= maxlevel)
    panic ("Unwound only %d levels, expected at least %d levels",
	   level, maxlevel);

  printf ("initialization time = %gnsec, time per unwind-step = %gnsec\n",
	  1e9*(mid - start), 1e9*(stop - mid)/level);
}

static int
f1 (int level, int maxlevel)
{
  if (level == maxlevel)
    return measure_unwind (maxlevel);
  else
    /* defeat last-call/sibcall optimization */
    return f1 (level + 1, maxlevel) + level;
}

int
main (int argc, char **argv)
{
  int i, maxlevel = 100;

  if (argc > 1)
    maxlevel = atol (argv[1]);

  for (i = 0; i < 10; ++i)
    f1 (0, maxlevel);
  return 0;
}<commit_msg>Collect 20 samples per run.<commit_after>#include <stdio.h>
#include <stdlib.h>

#include <sys/time.h>

#include <libunwind.h>

#define panic(args...)							  \
	do { fprintf (stderr, args); exit (-1); } while (0)

static inline double
gettime (void)
{
  struct timeval tv;

  gettimeofday(&tv, NULL);
  return tv.tv_sec + 1e-6*tv.tv_usec;
}

static int
measure_unwind (int maxlevel)
{
  double stop, mid, start;
  unw_cursor_t cursor;
  unw_context_t uc;
  int ret, level = 0;

  start = gettime ();

  unw_getcontext (&uc);
  if (unw_init_local (&cursor, &uc) < 0)
    panic ("unw_init_local() failed\n");

  mid = gettime ();

  do
    {
      ret = unw_step (&cursor);
      if (ret < 0)
	panic ("unw_step() failed\n");
      ++level;
    }
  while (ret > 0);

  stop = gettime ();

  if (level <= maxlevel)
    panic ("Unwound only %d levels, expected at least %d levels",
	   level, maxlevel);

  printf ("initialization time = %gnsec, time per unwind-step = %gnsec\n",
	  1e9*(mid - start), 1e9*(stop - mid)/level);
}

static int
f1 (int level, int maxlevel)
{
  if (level == maxlevel)
    return measure_unwind (maxlevel);
  else
    /* defeat last-call/sibcall optimization */
    return f1 (level + 1, maxlevel) + level;
}

int
main (int argc, char **argv)
{
  int i, maxlevel = 100;

  if (argc > 1)
    maxlevel = atol (argv[1]);

  for (i = 0; i < 20; ++i)
    f1 (0, maxlevel);
  return 0;
}
{'fraction_non_alphanumeric': 0.1555793991416309, 'fraction_numerical': 0.019313304721030045, 'mean_word_length': 2.961756373937677, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 15, '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': '6052373', 'n_tokens_mistral': 1135, 'n_tokens_neox': 1069, 'n_words': 314}