]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/sort/benchmark/parallel/file_generator.cpp
update sources to ceph Nautilus 14.2.1
[ceph.git] / ceph / src / boost / libs / sort / benchmark / parallel / file_generator.cpp
1 //----------------------------------------------------------------------------
2 /// @file file_generator.cpp
3 /// @brief This program generte a file with random information, for to be used
4 /// in the benchmark programs
5 ///
6 /// @author Copyright (c) 2016 Francisco José Tapia (fjtapia@gmail.com )\n
7 /// Distributed under the Boost Software License, Version 1.0.\n
8 /// ( See accompanying file LICENSE_1_0.txt or copy at
9 /// http://www.boost.org/LICENSE_1_0.txt )
10 /// @version 0.1
11 ///
12 /// @remarks
13 //-----------------------------------------------------------------------------
14 #include <boost/sort/common/file_vector.hpp>
15
16 #include <iostream>
17 #include <stdio.h>
18 #include <stdlib.h>
19 #include <time.h>
20 #include <vector>
21
22 using std::cout;
23 using std::endl;
24 namespace bsc = boost::sort::common;
25
26 void print_banner();
27
28 int main(int argc, char *argv[])
29 { //---------------------------- begin--------------------------------------
30 std::string name;
31 size_t number;
32
33 if (argc < 3) {
34 cout << "This program generate a file filled with random numbers\n";
35 cout << "of 64 bits\n";
36 cout << "The invocation format is :\n";
37 cout << " file_generator file_name number_elements\n\n";
38 return 0;
39 };
40 name = argv[1];
41 number = atoi(argv[2]);
42 if (number == 0) {
43 cout << "error, the number can't be zero\n";
44 return 0;
45 };
46
47 if (bsc::generate_file(name, number) != 0)
48 std::cout << "Error in the file creation\n";
49 return 0;
50 };
51 void print_banner()
52 { //---------------------------- begin -------------------------------------
53 cout << " The format of this program is :\n";
54 cout << " file_generator number_elements\n\n";
55 cout << " The elements are 64 bits random numbers\n";
56 };