c++ benchmark
This commit is contained in:
parent
f1d2f49f3c
commit
519053708d
1
code/C++/.gitignore
vendored
Normal file
1
code/C++/.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
run
|
@ -1,3 +1,8 @@
|
|||||||
# C++
|
# C++
|
||||||
|
|
||||||
|
## std
|
||||||
|
|
||||||
|
- [`__cplusplus`](__cplusplus.cpp) - Отображает версию языка C++
|
||||||
- [`std::filesystem`](list_files_in_folder.cpp) - Получение списка файлов в директории
|
- [`std::filesystem`](list_files_in_folder.cpp) - Получение списка файлов в директории
|
||||||
|
- [`benchmark.cpp`](benchmark.cpp) - Время выполнения операции в секундах
|
||||||
|
- []() -
|
||||||
|
24
code/C++/benchmark.cpp
Normal file
24
code/C++/benchmark.cpp
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
/**
|
||||||
|
* Время выполнения операции в секундах
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <bits/stdc++.h>
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
|
int main(int argc, char const *argv[]) {
|
||||||
|
time_t start, end;
|
||||||
|
long addition;
|
||||||
|
|
||||||
|
time(&start);
|
||||||
|
|
||||||
|
for (int i = 0; i < 20000; i++) {
|
||||||
|
for (int j = 0; j < 20000; j++)
|
||||||
|
;
|
||||||
|
}
|
||||||
|
|
||||||
|
time(&end);
|
||||||
|
|
||||||
|
std::cout << "Total " << difftime(end, start) << " seconds" << std::endl;
|
||||||
|
|
||||||
|
return EXIT_SUCCESS;
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user