diff --git a/src/Mitos.cpp b/src/Mitos.cpp new file mode 100644 index 0000000..413a9a5 --- /dev/null +++ b/src/Mitos.cpp @@ -0,0 +1,18 @@ +#include "Mitos.h" + +static perfsmpl m_perfsmpl; +static mattr m_mattr; + +void Mitos_set_sample_mode(sample_mode m) { m_perfsmpl.set_sample_mode(m); } +void Mitos_set_sample_period(uint64_t p) { m_perfsmpl.set_sample_period(p); } +void Mitos_set_sample_threshold(uint64_t t) { m_perfsmpl.set_sample_threshold(t); } +void Mitos_set_handler(sample_handler_fn_t h) { m_perfsmpl.set_handler(h); } + +void Mitos_prepare() { m_perfsmpl.prepare(); } +void Mitos_prepare(pid_t pid) { m_perfsmpl.prepare(pid); } +void Mitos_begin_sampler() { m_perfsmpl.begin_sampler(); } +void Mitos_end_sampler() { m_perfsmpl.end_sampler(); } + +void Mitos_add_symbol(std::string n, void *a, size_t s, size_t l) { m_mattr.add_symbol(n,a,s,l); } + +mem_symbol* Mitos_find_symbol(uint64_t addr) { return m_mattr.find_symbol(addr); } diff --git a/src/Mitos.h b/src/Mitos.h new file mode 100644 index 0000000..1f8767f --- /dev/null +++ b/src/Mitos.h @@ -0,0 +1,23 @@ +#include "perfsmpl.h" +#include "mattr.h" + +#include + +/* + * Mitos: performance event sampling library + * All programs must invoke from these functions. + */ +void Mitos_set_sample_mode(sample_mode m); +void Mitos_set_sample_period(uint64_t p); +void Mitos_set_sample_threshold(uint64_t t); +void Mitos_set_handler(sample_handler_fn_t h); + +void Mitos_prepare(); +void Mitos_prepare(pid_t pid); +void Mitos_begin_sampler(); +void Mitos_end_sampler(); + +void Mitos_add_symbol(std::string n, void *a, size_t s, size_t l); + +mem_symbol* Mitos_find_symbol(uint64_t addr); +