|
| 1 | +#include <chrono> |
1 | 2 | #include <csv2/reader.hpp>
|
2 | 3 | #include <iostream>
|
3 |
| -#include <chrono> |
4 | 4 | using namespace csv2;
|
5 | 5 |
|
6 | 6 | int main(int argc, char **argv) {
|
7 | 7 |
|
8 | 8 | auto print_exec_time = [](auto start, auto stop) {
|
9 |
| - auto duration_us = |
10 |
| - std::chrono::duration_cast<std::chrono::microseconds>(stop - start); |
11 |
| - auto duration_ms = |
12 |
| - std::chrono::duration_cast<std::chrono::milliseconds>(stop - start); |
13 |
| - auto duration_s = |
14 |
| - std::chrono::duration_cast<std::chrono::seconds>(stop - start); |
15 |
| - |
16 |
| - std::cout << duration_us.count() << " us | " |
17 |
| - << duration_ms.count() << " ms | " |
18 |
| - << duration_s.count() << " s\n"; |
19 |
| - }; |
| 9 | + auto duration_us = std::chrono::duration_cast<std::chrono::microseconds>(stop - start); |
| 10 | + auto duration_ms = std::chrono::duration_cast<std::chrono::milliseconds>(stop - start); |
| 11 | + auto duration_s = std::chrono::duration_cast<std::chrono::seconds>(stop - start); |
| 12 | + |
| 13 | + std::cout << duration_us.count() << " us | " << duration_ms.count() << " ms | " |
| 14 | + << duration_s.count() << " s\n"; |
| 15 | + }; |
20 | 16 |
|
21 | 17 | auto start = std::chrono::high_resolution_clock::now();
|
22 |
| - |
| 18 | + |
23 | 19 | Reader csv{
|
24 |
| - option::Filename{std::string(argv[1])}, |
25 |
| - option::Delimiter{','}, |
26 |
| - option::SkipInitialSpace{true}, |
27 |
| - option::TrimCharacters{std::vector<char>{'\n', '\r'}}, |
28 |
| - option::TrimPolicy{Trim::trailing} |
29 |
| - // ... |
| 20 | + option::Filename{std::string(argv[1])}, option::Delimiter{','}, |
| 21 | + option::SkipInitialSpace{true}, option::TrimCharacters{std::vector<char>{'\n', '\r'}}, |
| 22 | + option::TrimPolicy{Trim::trailing} |
| 23 | + // ... |
30 | 24 | };
|
31 | 25 |
|
32 | 26 | auto stop = std::chrono::high_resolution_clock::now();
|
|
0 commit comments