Implement profiler

This commit is contained in:
2019-05-14 15:03:14 +02:00
parent 3887b041f6
commit 702c37656f
5 changed files with 37 additions and 51 deletions

View File

@@ -6,6 +6,8 @@
#include <thread>
#include <cstring>
#include "profiler.hpp"
using namespace std;
using namespace std::chrono;
@@ -13,18 +15,16 @@ int main(int argc, char **argv) {
uint8_t data[16] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
const uint8_t key[16] = {0xA0,0x7C,0x3D,0x99,0xFA,0x00,0x02,0x46,0x97,0x33,0x73,0x50,0x31,0x7C,0xD3,0xDC};
ifstream input("/dev/urandom", ios::binary);
for (int i = 0;i < 50000;i++)
for (int i = 0;i < 5000;i++)
{
input.read((char*) data, 16);
this_thread::sleep_for(nanoseconds(0));
for (int d = 0;d < 16;d++)
{
cout << dec << (int) data[d] << ",";
}
auto start = high_resolution_clock::now();
AES::encrypt_ecb(data, key);
auto stop = high_resolution_clock::now();
cout << (stop - start).count() << endl;
cout << profiler.calls["gf_reduce"] << endl;
profiler.clear();
}
return 0;
}