]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/compute/perf/perf_stl_rotate.cpp
1 //---------------------------------------------------------------------------//
2 // Copyright (c) 2014 Roshan <thisisroshansmail@gmail.com>
4 // Distributed under the Boost Software License, Version 1.0
5 // See accompanying file LICENSE_1_0.txt or copy at
6 // http://www.boost.org/LICENSE_1_0.txt
8 // See http://boostorg.github.com/compute for more information.
9 //---------------------------------------------------------------------------//
20 return static_cast<int>((rand() / double(RAND_MAX
)) * 25.0);
23 int main(int argc
, char *argv
[])
25 perf_parse_args(argc
, argv
);
26 std::cout
<< "size: " << PERF_N
<< std::endl
;
28 // create vector of random numbers on the host
29 std::vector
<int> host_vector(PERF_N
);
30 std::generate(host_vector
.begin(), host_vector
.end(), rand_int
);
33 for(size_t trial
= 0; trial
< PERF_TRIALS
; trial
++){
35 std::rotate(host_vector
.begin(), host_vector
.begin()+(PERF_N
/2), host_vector
.end());
38 std::cout
<< "time: " << t
.min_time() / 1e6
<< " ms" << std::endl
;