#ifndef __MACHINE__PROFILER_H__
#define __MACHINE__PROFILER_H__
#include <machine/registerset.h>
#include <machine/hardware.h>
#ifdef PROFILER
#define MAX_UNIQUE_INSTRUCTIONS 94349
#define MAX_UNIQUE_CHECKPOINTS 2000
void profiler_record_sample(word_t pc) VISIBLE;
void profiler_reset(void);
void profiler_list(void);
extern bool_t profiler_enabled;
static inline void profiler_set_enabled(bool_t enabled)
{
profiler_enabled = enabled;
}
static inline bool_t profiler_is_enabled(void)
{
return profiler_enabled;
}
extern int profiler_num_entries;
extern long long profiler_dropped_instructions;
typedef struct {
word_t pc;
word_t count;
} profiler_entry_t;
#ifdef CHECKPOINT_PROFILER
extern volatile unsigned int checkpoint;
extern profiler_entry_t profiler_entries[MAX_UNIQUE_CHECKPOINTS];
#else
extern profiler_entry_t profiler_entries[MAX_UNIQUE_INSTRUCTIONS];
#endif
#endif
#endif