@@ -62,27 +62,27 @@ phase4::output_t create_plot( const int num_threads,
6262{
6363 const auto total_begin = get_wall_time_micros ();
6464
65- std::cout << " Process ID: " << GETPID () << std::endl;
66- std::cout << " Number of Threads: " << num_threads << std::endl;
67- std::cout << " Number of Buckets: 2^" << log_num_buckets
65+ std::cout << get_curr_datetime () << " Process ID: " << GETPID () << std::endl;
66+ std::cout << get_curr_datetime () << " Number of Threads: " << num_threads << std::endl;
67+ std::cout << get_curr_datetime () << " Number of Buckets: 2^" << log_num_buckets
6868 << " (" << (1 << log_num_buckets) << " )" << std::endl;
6969
7070 bls::G1Element pool_key;
7171 bls::G1Element farmer_key;
7272 try {
7373 pool_key = bls::G1Element::FromByteVector (pool_key_bytes);
7474 } catch (std::exception& ex) {
75- std::cout << " Invalid poolkey: " << bls::Util::HexStr (pool_key_bytes) << std::endl;
75+ std::cout << get_curr_datetime () << " Invalid poolkey: " << bls::Util::HexStr (pool_key_bytes) << std::endl;
7676 throw ;
7777 }
7878 try {
7979 farmer_key = bls::G1Element::FromByteVector (farmer_key_bytes);
8080 } catch (std::exception& ex) {
81- std::cout << " Invalid farmerkey: " << bls::Util::HexStr (farmer_key_bytes) << std::endl;
81+ std::cout << get_curr_datetime () << " Invalid farmerkey: " << bls::Util::HexStr (farmer_key_bytes) << std::endl;
8282 throw ;
8383 }
84- std::cout << " Pool Public Key: " << bls::Util::HexStr (pool_key.Serialize ()) << std::endl;
85- std::cout << " Farmer Public Key: " << bls::Util::HexStr (farmer_key.Serialize ()) << std::endl;
84+ std::cout << get_curr_datetime () << " Pool Public Key: " << bls::Util::HexStr (pool_key.Serialize ()) << std::endl;
85+ std::cout << get_curr_datetime () << " Farmer Public Key: " << bls::Util::HexStr (farmer_key.Serialize ()) << std::endl;
8686
8787 vector<uint8_t > seed (32 );
8888 randombytes_buf (seed.data (), seed.size ());
@@ -109,9 +109,9 @@ phase4::output_t create_plot( const int num_threads,
109109 const std::string plot_name = " plot-k32-" + get_date_string_ex (" %Y-%m-%d-%H-%M" )
110110 + " -" + bls::Util::HexStr (params.id .data (), params.id .size ());
111111
112- std::cout << " Working Directory: " << (tmp_dir.empty () ? " $PWD" : tmp_dir) << std::endl;
113- std::cout << " Working Directory 2: " << (tmp_dir_2.empty () ? " $PWD" : tmp_dir_2) << std::endl;
114- std::cout << " Plot Name: " << plot_name << std::endl;
112+ std::cout << get_curr_datetime () << " Working Directory: " << (tmp_dir.empty () ? " $PWD" : tmp_dir) << std::endl;
113+ std::cout << get_curr_datetime () << " Working Directory 2: " << (tmp_dir_2.empty () ? " $PWD" : tmp_dir_2) << std::endl;
114+ std::cout << get_curr_datetime () << " Plot Name: " << plot_name << std::endl;
115115
116116 // memo = bytes(pool_public_key) + bytes(farmer_public_key) + bytes(local_master_sk)
117117 params.memo .insert (params.memo .end (), pool_key_bytes.begin (), pool_key_bytes.end ());
@@ -135,7 +135,7 @@ phase4::output_t create_plot( const int num_threads,
135135 phase4::compute (out_3, out_4, num_threads, log_num_buckets, plot_name, tmp_dir, tmp_dir_2);
136136
137137 const auto time_secs = (get_wall_time_micros () - total_begin) / 1e6 ;
138- std::cout << " Total plot creation time was "
138+ std::cout << get_curr_datetime () << " Total plot creation time was "
139139 << time_secs << " sec (" << time_secs / 60 . << " min)" << std::endl;
140140 return out_4;
141141}
@@ -285,6 +285,7 @@ int main(int argc, char** argv)
285285
286286 {
287287 // check that we can open required amount of files
288+ const int num_files_max = num_buckets + 20 ;
288289 std::vector<std::pair<FILE*, std::string>> files;
289290 for (int i = 0 ; i < num_files_max; ++i) {
290291 const std::string path = tmp_dir + " .chia_plot_tmp." + std::to_string (i);
@@ -312,11 +313,11 @@ int main(int argc, char** argv)
312313 std::cout << " - " << GIT_COMMIT_HASH;
313314 #endif
314315 std::cout << std::endl;
315- std::cout << " Final Directory: " << final_dir << std::endl;
316+ std::cout << get_curr_datetime () << " Final Directory: " << final_dir << std::endl;
316317 if (num_plots >= 0 ) {
317- std::cout << " Number of Plots: " << num_plots << std::endl;
318+ std::cout << get_curr_datetime () << " Number of Plots: " << num_plots << std::endl;
318319 } else {
319- std::cout << " Number of Plots: infinite" << std::endl;
320+ std::cout << get_curr_datetime () << " Number of Plots: infinite" << std::endl;
320321 }
321322
322323 Thread<std::pair<std::string, std::string>> copy_thread (
@@ -327,11 +328,11 @@ int main(int argc, char** argv)
327328 const auto bytes = final_copy (from_to.first , from_to.second );
328329
329330 const auto time = (get_wall_time_micros () - total_begin) / 1e6 ;
330- std::cout << " Copy to " << from_to.second << " finished, took " << time << " sec, "
331+ std::cout << get_curr_datetime () << " Copy to " << from_to.second << " finished, took " << time << " sec, "
331332 << ((bytes / time) / 1024 / 1024 ) << " MB/s avg." << std::endl;
332333 break ;
333334 } catch (const std::exception& ex) {
334- std::cout << " Copy to " << from_to.second << " failed with: " << ex.what () << std::endl;
335+ std::cout << get_curr_datetime () << " Copy to " << from_to.second << " failed with: " << ex.what () << std::endl;
335336 std::this_thread::sleep_for (std::chrono::minutes (5 ));
336337 }
337338 }
@@ -343,13 +344,13 @@ int main(int argc, char** argv)
343344 std::cout << std::endl << " Process has been interrupted, waiting for copy/rename operations to finish ..." << std::endl;
344345 break ;
345346 }
346- std::cout << " Crafting plot " << i+1 << " out of " << num_plots << std::endl;
347+ std::cout << get_curr_datetime () << " Crafting plot " << i+1 << " out of " << num_plots << std::endl;
347348 const auto out = create_plot (num_threads, log_num_buckets, pool_key, farmer_key, tmp_dir, tmp_dir2);
348349
349350 if (final_dir != tmp_dir)
350351 {
351352 const auto dst_path = final_dir + out.params .plot_name + " .plot" ;
352- std::cout << " Started copy to " << dst_path << std::endl;
353+ std::cout << get_curr_datetime () << " Started copy to " << dst_path << std::endl;
353354 copy_thread.take_copy (std::make_pair (out.plot_file_name , dst_path));
354355 }
355356 }
0 commit comments