58 unsigned int lines_to_write = 500;
61 std::cout << std::endl;
62 std::cout <<
"***********************************************************" << std::endl;
63 std::cout <<
" OFile Write" << std::endl;
64 std::cout <<
"***********************************************************" << std::endl;
65 std::cout << std::endl;
67 OFile o_file(
"odude.txt",
New);
68 for (
unsigned int i = 0; i < lines_to_write; ++i ) {
69 o_file.write(
"Heya Dude\n",10);
73 for (
unsigned int i = 0; i < lines_to_write; ++i ) {
74 o_file.write(
"Heya Dude\n",10);
77 times[0] = stopwatch.split();
79 std::cout << std::endl;
80 std::cout <<
"***********************************************************" << std::endl;
81 std::cout <<
" Shared File Write" << std::endl;
82 std::cout <<
"***********************************************************" << std::endl;
83 std::cout << std::endl;
86 for (
unsigned int i = 0; i < lines_to_write; ++i ) {
87 s_file.
write(
"Heya Dude\n",10);
91 for (
unsigned int i = 0; i < lines_to_write; ++i ) {
92 s_file.
write(
"Heya Dude\n",10);
95 times[1] = stopwatch.split();
97 std::cout << std::endl;
98 std::cout <<
"***********************************************************" << std::endl;
99 std::cout <<
" TextStream<OFile>" << std::endl;
100 std::cout <<
"***********************************************************" << std::endl;
101 std::cout << std::endl;
104 ostream.device().open(
"dude_stream.txt",
New);
106 for (
unsigned int i = 0; i < lines_to_write; ++i ) {
107 ostream <<
"Heya Dude\n";
111 for (
unsigned int i = 0; i < lines_to_write; ++i ) {
112 ostream <<
"Heya Dude\n";
115 times[2] = stopwatch.split();
117 for (
unsigned int i = 0; i < lines_to_write; ++i ) {
118 ostream << f <<
"\n";
122 for (
unsigned int i = 0; i < lines_to_write; ++i ) {
123 ostream << f <<
"\n";
126 times[3] = stopwatch.split();
128 std::cout << std::endl;
129 std::cout <<
"***********************************************************" << std::endl;
130 std::cout <<
" std::ofstream" << std::endl;
131 std::cout <<
"***********************************************************" << std::endl;
132 std::cout << std::endl;
134 std::ofstream cpp_ostream(
"dude_ofstream.txt");
136 for (
unsigned int i = 0; i < lines_to_write; ++i ) {
137 cpp_ostream <<
"Heya Dude\n";
141 for (
unsigned int i = 0; i < lines_to_write; ++i ) {
142 cpp_ostream <<
"Heya Dude\n";
145 times[4] = stopwatch.split();
147 for (
unsigned int i = 0; i < lines_to_write; ++i ) {
148 cpp_ostream << f <<
"\n";
152 for (
unsigned int i = 0; i < lines_to_write; ++i ) {
153 cpp_ostream << f <<
"\n";
156 times[5] = stopwatch.split();
159 std::cout << std::endl;
160 std::cout <<
"***********************************************************" << std::endl;
161 std::cout <<
" LogStream" << std::endl;
162 std::cout <<
"***********************************************************" << std::endl;
163 std::cout << std::endl;
171 for (
unsigned int i = 0; i < lines_to_write; ++i ) {
172 LOG(log_stream,
Warning) <<
"Heya Dude\n";
176 for (
unsigned int i = 0; i < lines_to_write; ++i ) {
177 LOG(log_stream,
Warning) <<
"Heya Dude\n";
180 times[9] = stopwatch.split();
182 for (
unsigned int i = 0; i < lines_to_write; ++i ) {
183 LOG(log_stream,
Warning) << f <<
"\n";
187 for (
unsigned int i = 0; i < lines_to_write; ++i ) {
188 LOG(log_stream,
Warning) << f <<
"\n";
191 times[10] = stopwatch.split();
193 std::cout << std::endl;
194 std::cout <<
"***********************************************************" << std::endl;
195 std::cout <<
" Times" << std::endl;
196 std::cout <<
"***********************************************************" << std::endl;
197 std::cout << std::endl;
199 std::cout <<
"Writing Char Strings:" << std::endl;
200 std::cout <<
" OFile write : " << times[0].nsec() <<
" ns" << std::endl;
201 std::cout <<
" SharedFile write : " << times[1].nsec() <<
" ns" << std::endl;
202 std::cout <<
" OFile stream : " << times[2].nsec() <<
" ns" << std::endl;
203 std::cout <<
" LogStream : " << times[9].nsec() <<
" ns" << std::endl;
204 std::cout <<
" C++ ofstream : " << times[4].nsec() <<
" ns" << std::endl;
205 std::cout <<
"Streaming Floats:" << std::endl;
206 std::cout <<
" OFileStream : " << times[3].nsec() <<
" ns" << std::endl;
207 std::cout <<
" Log stream : " << times[10].nsec() <<
" ns" << std::endl;
208 std::cout <<
" C++ ofstream : " << times[5].nsec() <<
" ns" << std::endl;
210 std::cout << std::endl;
211 std::cout <<
"***********************************************************" << std::endl;
212 std::cout <<
" Passed" << std::endl;
213 std::cout <<
"***********************************************************" << std::endl;
214 std::cout << std::endl;
void enableMode(int mode, const std::string header="")
bool flush() ecl_debug_throw_decl(StandardException)
long write(const char &c) ecl_debug_throw_decl(StandardException)
void f(int i) ecl_debug_throw_decl(StandardException)