<commit_before>#ifndef __PERFMON_HPP__
#define __PERFMON_HPP__

#include <string>
#include <map>
#include "config/alloc.hpp"
#include "utils.hpp"

// Horrible hack because we define fail() as a macro
#pragma push_macro("fail")
#undef fail
#include <sstream>
#pragma pop_macro("fail")

class perfmon_watcher_t;
class perfmon_fsm_t;

typedef std::basic_string<char, std::char_traits<char>, gnew_alloc<char> > std_string_t;

typedef std::map<std_string_t, std_string_t, std::less<std_string_t>,
    gnew_alloc<std::pair<std_string_t, std_string_t> > > perfmon_stats_t;

struct perfmon_callback_t {
    virtual void on_perfmon_stats() = 0;
};

class perfmon_controller_t {
    friend class perfmon_watcher_t;
    friend class one_perfmon_fsm_t;
    friend class perfmon_fsm_t;
    
public:
    perfmon_controller_t();
    ~perfmon_controller_t();

    bool get_stats(perfmon_stats_t *dest, perfmon_callback_t *cb);<commit_msg>Removing push_macro/pop_macro because they dont work on all versions of GCC we want. Adding an even shittier fix for now<commit_after>#ifndef __PERFMON_HPP__
#define __PERFMON_HPP__

#include <string>
#include <map>
#include "config/alloc.hpp"
#include "utils.hpp"

// Horrible hack because we define fail() as a macro
#undef fail
#include <sstream>
#define fail(...) _fail(__FILE__, __LINE__, __VA_ARGS__)

class perfmon_watcher_t;
class perfmon_fsm_t;

typedef std::basic_string<char, std::char_traits<char>, gnew_alloc<char> > std_string_t;

typedef std::map<std_string_t, std_string_t, std::less<std_string_t>,
    gnew_alloc<std::pair<std_string_t, std_string_t> > > perfmon_stats_t;

struct perfmon_callback_t {
    virtual void on_perfmon_stats() = 0;
};

class perfmon_controller_t {
    friend class perfmon_watcher_t;
    friend class one_perfmon_fsm_t;
    friend class perfmon_fsm_t;
    
public:
    perfmon_controller_t();
    ~perfmon_controller_t();

    bool get_stats(perfmon_stats_t *dest, perfmon_callback_t *cb);
{'fraction_non_alphanumeric': 0.10025575447570333, 'fraction_numerical': 0.0010230179028132991, 'mean_word_length': 5.985714285714286, 'pattern_counts': {'":': 0, '<': 23, '<?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': '2173431', 'n_tokens_mistral': 733, 'n_tokens_neox': 708, 'n_words': 159}