MCPcopy Create free account
hub / github.com/antmachineintelligence/mtgbmcode / main

Function main

compute/perf/perf_stl_count.cpp:22–45  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

20}
21
22int main(int argc, char *argv[])
23{
24 perf_parse_args(argc, argv);
25 std::cout << "size: " << PERF_N << std::endl;
26
27 // create vector of random numbers on the host
28 std::vector<int> host_vector(PERF_N);
29 std::generate(host_vector.begin(), host_vector.end(), rand_int);
30
31 // count values equal to four in the vector
32 size_t count = 0;
33 perf_timer t;
34 for(size_t trial = 0; trial < PERF_TRIALS; trial++){
35 t.start();
36 count = std::count(
37 host_vector.begin(), host_vector.end(), 4
38 );
39 t.stop();
40 }
41 std::cout << "time: " << t.min_time() / 1e6 << " ms" << std::endl;
42 std::cout << "count: " << count << std::endl;
43
44 return 0;
45}

Callers

nothing calls this directly

Calls 8

perf_parse_argsFunction · 0.85
countFunction · 0.85
startMethod · 0.80
stopMethod · 0.80
min_timeMethod · 0.80
generateFunction · 0.50
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected