Measure time during AES run
This commit is contained in:
parent
d85966bb6d
commit
bbfbbc4908
1 changed files with 13 additions and 4 deletions
|
@ -1,3 +1,4 @@
|
||||||
|
#include <chrono>
|
||||||
#include <cstdio>
|
#include <cstdio>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
@ -195,9 +196,17 @@ int main(int argc, char* argv[])
|
||||||
cycles = std::atoi(argv[1]);
|
cycles = std::atoi(argv[1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const auto start{std::chrono::steady_clock::now()};
|
||||||
|
{
|
||||||
for (int i = 0; i < cycles; i++) {
|
for (int i = 0; i < cycles; i++) {
|
||||||
uint8_t key[16] = { 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff };
|
uint8_t key[16] = { 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff };
|
||||||
uint8_t in[16] = { 0xab, 0xcd, 0xef, 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef, 0x01, 0x23, 0x45, 0x67, 0x89};
|
uint8_t in[16] = { 0xab, 0xcd, 0xef, 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef, 0x01, 0x23, 0x45, 0x67, 0x89};
|
||||||
aes(in, in, key);
|
aes(in, in, key);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
const auto end{std::chrono::steady_clock::now()};
|
||||||
|
const std::chrono::duration<double> elapsed_seconds{end - start};
|
||||||
|
|
||||||
|
std::cout << "AES (" << cycles << " runs)\nElapsed time: ";
|
||||||
|
std::cout << elapsed_seconds.count() << "s\n"; // Before C++20
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue