<commit_before>/*
 * ============================================================================
 *
 *         Author:  <NAME> (), <EMAIL>
 *   Organization:  Stony Brook University
 *
 * ============================================================================
 */

#define _GNU_SOURCE
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <sched.h>
#include <sys/sysinfo.h>
#include <linux/unistd.h>
#include <sys/syscall.h>
#include <errno.h>

#include "partitioned_counter.h"

#define min(a,b) ((a) < (b) ? (a) : (b))

int pc_init(pc_t *pc, int64_t *global_counter, uint32_t num_counters,
						int32_t threshold) {
	int num_cpus = (int)sysconf( _SC_NPROCESSORS_ONLN );
	if (num_cpus < 0) {
		perror( "sysconf" );
		return PC_ERROR;
	}
	num_counters = num_counters == 0 ? num_cpus : min(num_cpus, num_counters);<commit_msg>more minor fixes.<commit_after>/*
 * ============================================================================
 *
 *         Author:  <NAME> (), <EMAIL>
 *   Organization:  Stony Brook University
 *
 * ============================================================================
 */

#define _GNU_SOURCE
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <sched.h>
#include <sys/sysinfo.h>
#include <linux/unistd.h>
#include <sys/syscall.h>
#include <errno.h>

#include "partitioned_counter.h"

#define min(a,b) ((a) < (b) ? (a) : (b))

int pc_init(pc_t *pc, int64_t *global_counter, uint32_t num_counters,
						int32_t threshold) {
	int num_cpus = (int)sysconf( _SC_NPROCESSORS_ONLN );
	if (num_cpus < 0) {
		perror( "sysconf" );
		return PC_ERROR;
	}
	pc->num_counters = num_counters == 0 ? num_cpus : min(num_cpus, num_counters);
{'fraction_non_alphanumeric': 0.3138987043580683, 'fraction_numerical': 0.009422850412249705, 'mean_word_length': 5.2234432234432235, 'pattern_counts': {'":': 0, '<': 27, '<?xml version=': 0, '>': 24, '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': '1430033', 'n_tokens_mistral': 654, 'n_tokens_neox': 596, 'n_words': 121}