<commit_before>#include <math.h>
#include "gauge.h"

/**
 * Initializes the gauge struct
 * @arg gauge The gauge struct to initialize
 * @return 0 on success.
 */
int init_gauge(gauge_t *gauge) {
    gauge->count = 0;
    gauge->sum = 0;
    gauge->value = 0;
    return 0;
}

/**
 * Adds a new sample to the struct
 * @arg gauge The gauge to add to
 * @arg sample The new sample value
 * @arg delta   Is this a delta update?
 * @return 0 on success.
 */
int gauge_add_sample(gauge_t *gauge, double sample, bool delta) {
    if (delta) {
        gauge->value += sample;
    } else {
        gauge->value = sample;
    }
    gauge->sum += sample;
    gauge->count++;
    return 0;
}

/**
 * Returns the number of samples in the gauge
 * @arg gauge The gauge to query
 * @return The number of samples
 */
uint64_t gauge_count(gauge_t *gauge) {
    return gauge->count;
}

/**
 * Returns the mean gauge value
 * @arg gauge The gauge to query
 * @return The mean value of the gauge
 */
double gauge_mean(gauge_t *gauge) {
    return (gauge->count) ? gauge->sum / gauge->count : 0;
}

/**
 * Returns the sum of the gauge
 * @arg gauge The gauge to query
 * @return The sum of values
 */
double gauge_sum(gauge_t *gauge) {
    return gauge->sum;
}

/**
 * Returns the gauge value (for backwards compat)
 * @arg gauge  the gauge to query
 * @return The gauge value
 */
double gauge_value(gauge_t *gauge) {
    return gauge->value;
}
<commit_msg>Remove duplicate comment from the c file<commit_after>#include <math.h>
#include "gauge.h"


int init_gauge(gauge_t *gauge) {
    gauge->count = 0;
    gauge->sum = 0;
    gauge->value = 0;
    return 0;
}

int gauge_add_sample(gauge_t *gauge, double sample, bool delta) {
    if (delta) {
        gauge->value += sample;
    } else {
        gauge->value = sample;
    }
    gauge->sum += sample;
    gauge->count++;
    return 0;
}

uint64_t gauge_count(gauge_t *gauge) {
    return gauge->count;
}

double gauge_mean(gauge_t *gauge) {
    return (gauge->count) ? gauge->sum / gauge->count : 0;
}

double gauge_sum(gauge_t *gauge) {
    return gauge->sum;
}

double gauge_value(gauge_t *gauge) {
    return gauge->value;
}

{'fraction_non_alphanumeric': 0.12713823393435045, 'fraction_numerical': 0.008321775312066574, 'mean_word_length': 2.920289855072464, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 31, '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': '4374908', 'n_tokens_mistral': 758, 'n_tokens_neox': 710, 'n_words': 237}