Elfspy/example5.cpp

21 lines
422 B
C++
Raw Normal View History

2016-09-16 17:45:35 +02:00
#include <cassert>
#include <iostream>
#include "elfspy/SPY.h"
#include "elfspy/Profiler.h"
#include "elfspy/demo.h"
int main(int argc, char** argv)
{
spy::initialise(argc, argv);
auto add_spy = SPY(&add);
auto add_profiler = spy::profiler(add_spy);
int rv = f();
int run = 0;
for (auto duration : add_profiler) {
std::cout << ++run << ": " << duration << " nanoseconds" << std::endl;
}
return 0;
}