#include <chrono>
#include <iostream>
#include <thread>
#include <utility>
#include <vector>
#include "TrigConfHLTUtils/HLTUtils.h"
Go to the source code of this file.
|
int | main (int argc, char *argv[]) |
|
◆ main()
int main |
( |
int |
argc, |
|
|
char * |
argv[] |
|
) |
| |
Definition at line 15 of file trigconf_string2hash.cxx.
16 if (
argc <= 1 ||
argv[1]==std::string(
"-h")) {
17 std::cout <<
"Usage: trigconf_string2hash [IDENT] [-f FILE] [-t THREADS] [-r REPEAT]" << std::endl;
18 std::cout <<
" convert identifier to hash" << std::endl;
19 std::cout <<
" -f file with hashes produced by hashes2file" << std::endl;
20 std::cout <<
" -t number of threads" << std::endl;
21 std::cout <<
" -r number of times the file should be processed" << std::endl;
30 if (std::string(
argv[
i])==
"-f") {
33 else if (std::string(
argv[
i])==
"-t") {
36 else if (std::string(
argv[
i])==
"-r") {
51 for (
size_t i=0;
i<
N;
i++) HLTUtils::file2hashes(
filename);
57 std::cout <<
"Launching " << nthreads <<
" threads reading file each "
58 <<
N <<
" times" << std::endl;
59 std::vector<std::thread>
threads;
60 for (
size_t i = 0;
i<nthreads; ++
i)
threads.emplace_back(
run);
61 for (
auto& thr :
threads) thr.join();
65 std::cout << duration_cast<milliseconds>(
t2 -
t1).count() <<
" ms" << std::endl;