20#ifndef RCPP_BENCHMARH_TIMER_H
21#define RCPP_BENCHMARH_TIMER_H
30#include <Rinternals.h>
33 #define WIN32_LEAN_AND_MEAN
35#elif defined(__APPLE__)
36 #include <mach/mach_time.h>
37#elif defined(linux) || defined(__linux) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__GLIBC__) || defined(__GNU__) || defined(__CYGWIN__)
39#elif defined(sun) || defined(__sun) || defined(_AIX)
42 #error "Rcpp::Timer not supported by your OS."
60#elif defined(__APPLE__)
73#elif defined(linux) || defined(__linux) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__GLIBC__) || defined(__GNU__) || defined(__CYGWIN__)
94#elif defined(sun) || defined(__sun) || defined(_AIX)
108 void step(
const std::string& name){
109 data.push_back(std::make_pair(name,
now()));
113 size_t n =
data.size();
116 for (
size_t i=0; i<n; i++) {
117 names[i] =
data[i].first;
125 return std::vector<Timer>( n,
Timer() ) ;
137 typedef std::pair<std::string,nanotime_t>
Step;
AttributeProxy attr(const std::string &name)
Timer(nanotime_t start_time_)
std::vector< Step > Steps
const nanotime_t start_time
nanotime_t origin() const
void step(const std::string &name)
std::pair< std::string, nanotime_t > Step
static std::vector< Timer > get_timers(int n)