Elfspy/examples/example5.cpp

21 lines
415 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"
2016-10-09 15:39:53 +02:00
#include "demo.h"
2016-09-16 17:45:35 +02:00
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;
}