<commit_before>/*
 * x86_adapt.c
 *
 *  Created on: 21.06.2018
 *      Author: rschoene
 */

#include <unistd.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>

#include <x86_adapt.h>

#include "../../include/x86_energy.h"
#include "../include/cpuid.h"
#include "../include/access.h"
#include "../include/architecture.h"
#include "../include/overflow_thread.h"

#define BUFFER_SIZE 4096
#define POWER_UNIT_REGISTER "Intel_RAPL_Power_Unit"
#define PKG_REGISTER "AMD_RAPL_Pckg_Energy"
#define CORE_REGISTER "AMD_RAPL_Core_Energy"

struct reader_def
{
    uint64_t last_reading;
    uint64_t reg;
    double unit;
    int device;
    int pkg;
    int cpu;
    int is_per_core;
    pthread_t thread;
    pthread_mutex_t mutex;
};

static struct ov_struct x86a_ov;

static double do_read( x86_energy_single_counter_t  counter);

static int init( void ){

    int ret = x86_adapt_init();

    if ( ret )
        return 1;

    /* search for core freq parameters */
    int xa_index = x86_adapt_lookup_ci_name(X86_ADAPT_DIE, PKG_REGISTER);
    if (xa_index < 0 )
        return 1;<commit_msg>renamed registers<commit_after>/*
 * x86_adapt.c
 *
 *  Created on: 21.06.2018
 *      Author: rschoene
 */

#include <unistd.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>

#include <x86_adapt.h>

#include "../../include/x86_energy.h"
#include "../include/cpuid.h"
#include "../include/access.h"
#include "../include/architecture.h"
#include "../include/overflow_thread.h"

#define BUFFER_SIZE 4096
#define POWER_UNIT_REGISTER "Intel_RAPL_Power_Unit"
#define PKG_REGISTER "Intel_RAPL_Pckg_Energy"
#define CORE_REGISTER "Intel_RAPL_Core_Energy"

struct reader_def
{
    uint64_t last_reading;
    uint64_t reg;
    double unit;
    int device;
    int pkg;
    int cpu;
    int is_per_core;
    pthread_t thread;
    pthread_mutex_t mutex;
};

static struct ov_struct x86a_ov;

static double do_read( x86_energy_single_counter_t  counter);

static int init( void ){

    int ret = x86_adapt_init();

    if ( ret )
        return 1;

    /* search for core freq parameters */
    int xa_index = x86_adapt_lookup_ci_name(X86_ADAPT_DIE, PKG_REGISTER);
    if (xa_index < 0 )
        return 1;
{'fraction_non_alphanumeric': 0.11636363636363636, 'fraction_numerical': 0.031818181818181815, 'mean_word_length': 3.5102459016393444, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 13, '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': '2618379', 'n_tokens_mistral': 913, 'n_tokens_neox': 841, 'n_words': 186}