Skip to content

Commit 3a01649

Browse files
committed
Merge pull request #157 from romainfrancois/master
Minor improvements to Timer to make slightly more useful with multi threads Thanks a lot, will apply. If it is not too much of a bother, entries in ChangeLog and/or NEWS are always welcome too.
2 parents 55e7c87 + 70e2ab9 commit 3a01649

File tree

1 file changed

+4
-9
lines changed

1 file changed

+4
-9
lines changed

inst/include/Rcpp/Benchmark/Timer.h

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -100,15 +100,6 @@ namespace Rcpp{
100100

101101
#endif
102102

103-
namespace{
104-
std::string get_first(const std::pair<std::string,nanotime_t>& pair) {
105-
return pair.first;
106-
}
107-
double get_second(const std::pair<std::string,nanotime_t>& pair){
108-
return static_cast<double>(pair.second);
109-
}
110-
}
111-
112103
class Timer {
113104
public:
114105
Timer() : data(), start_time( get_nanotime() ){}
@@ -130,6 +121,10 @@ namespace Rcpp{
130121
out.attr("names") = names;
131122
return out;
132123
}
124+
125+
static std::vector<Timer> get_timers(int n){
126+
return std::vector<Timer>( n, Timer() ) ;
127+
}
133128

134129
private:
135130
typedef std::pair<std::string,nanotime_t> Step;

0 commit comments

Comments
 (0)