<commit_before>/*
 *  Copyright (c) 2011 <NAME>
 *
 *  This is free software; see gpl-3.0.txt
 */

#include <stdint.h>
#include <sys/time.h>
#include <math.h>
#include <string.h>

#include "transaction.h"
#include "measures.h"
#include "dbg.h"

#define MAX(A,B)    ((A)>(B) ? (A) : (B))
#define MIN(A,B)    ((A)<(B) ? (A) : (B))

bool autotune_period = false;

static double offer_accept = 1;
static double acc_to_ack = 0;

double offer_accept_smoothing = 0.9;	// %
double offer_accept_min = 0.3;	// %
double acc_to_ack_max = 0.075;	// sec
double period_change_rate_up = 1.0;	// %/sec
double period_change_rate_down = 0.1;	// %/sec

extern struct timeval period;
#define PERIOD_MIN 1000
#define PERIOD_MAX 1000000

int64_t tv2int(struct timeval *tv)
{
  return tv->tv_sec * 1000000 + tv->tv_usec;
}

void int2tv(struct timeval *tv, int64_t t)
{
  tv->tv_sec = t / 1000000;
  tv->tv_usec = t % 1000000;
}

static int64_t get_period()
{<commit_msg>turning on rate control by default<commit_after>/*
 *  Copyright (c) 2011 <NAME>
 *
 *  This is free software; see gpl-3.0.txt
 */

#include <stdint.h>
#include <sys/time.h>
#include <math.h>
#include <string.h>

#include "transaction.h"
#include "measures.h"
#include "dbg.h"

#define MAX(A,B)    ((A)>(B) ? (A) : (B))
#define MIN(A,B)    ((A)<(B) ? (A) : (B))

bool autotune_period = true;

static double offer_accept = 1;
static double acc_to_ack = 0;

double offer_accept_smoothing = 0.9;	// %
double offer_accept_min = 0.3;	// %
double acc_to_ack_max = 0.075;	// sec
double period_change_rate_up = 1.0;	// %/sec
double period_change_rate_down = 0.1;	// %/sec

extern struct timeval period;
#define PERIOD_MIN 1000
#define PERIOD_MAX 1000000

int64_t tv2int(struct timeval *tv)
{
  return tv->tv_sec * 1000000 + tv->tv_usec;
}

void int2tv(struct timeval *tv, int64_t t)
{
  tv->tv_sec = t / 1000000;
  tv->tv_usec = t % 1000000;
}

static int64_t get_period()
{
{'fraction_non_alphanumeric': 0.1589958158995816, 'fraction_numerical': 0.06276150627615062, 'mean_word_length': 3.8801020408163267, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 23, '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': '2302045', 'n_tokens_mistral': 901, 'n_tokens_neox': 796, 'n_words': 199}