#pragma once
#ifndef _PERFCOUNTER_H_
#define _PERFCOUNTER_H_
#include <tuple>
class PerfCounter
{
private:
    int cmp, mov, mem;

public:
    PerfCounter() { reset(); }
    void reset() { cmp = mov = mem = 0; }
    std::tuple<int, int, int> save() const { return std::make_tuple(cmp, mov, mem); }
#define __def_inc_func(field) \
    void inc_##field(int v) noexcept { field += v; }
#define __def_get_func(field) \
    int get_##field() const noexcept { return field; }
#define __def_func(field) __def_get_func(field) __def_inc_func(field)
    __def_func(cmp);
    __def_func(mov);
    __def_func(mem);
};
#endif // !_PERFCOUNTER_H_
