Commit 8eb07ab67c834c112ad4de0d720c2f3127683c14

Authored by David Mayerich
1 parent 08d1c3b9

edited profiling code for BSQ->BIL

Showing 1 changed file with 11 additions and 3 deletions   Show diff stats
stim/envi/bsq.h
... ... @@ -377,6 +377,10 @@ public:
377 377 }
378 378  
379 379 bool bil(std::string outname, bool PROGRESS = false){
  380 +
  381 + size_t in_time, out_time, calc_time; //initialize the timing variables
  382 + in_time = out_time = calc_time = 0;
  383 +
380 384 size_t XY = X() * Y(); //number of elements in an input slice
381 385 size_t XB = X() * Z(); //number of elements in an output slice
382 386 size_t XYbytes = XY * sizeof(T); //number of bytes in an input slice
... ... @@ -413,7 +417,7 @@ public:
413 417 file.seekg(jump, std::ios::cur); //jump to the next band
414 418 }
415 419 auto in_end = std::chrono::high_resolution_clock::now();
416   - std::cout << std::chrono::duration_cast<std::chrono::milliseconds>(in_end-in_begin).count() << "ms" << std::endl;
  420 + in_time += std::chrono::duration_cast<std::chrono::milliseconds>(in_end-in_begin).count();
417 421  
418 422 auto calc_begin = std::chrono::high_resolution_clock::now();
419 423  
... ... @@ -428,15 +432,19 @@ public:
428 432 }
429 433 }
430 434 auto calc_end = std::chrono::high_resolution_clock::now();
431   - std::cout << std::chrono::duration_cast<std::chrono::milliseconds>(calc_end-calc_begin).count() << "ms" << std::endl;
  435 + calc_time += std::chrono::duration_cast<std::chrono::milliseconds>(calc_end-calc_begin).count();
432 436  
433 437 auto out_begin = std::chrono::high_resolution_clock::now();
434 438 target.write((char*)ptrOut, batch_bytes); //write the batch to disk
435 439 auto out_end = std::chrono::high_resolution_clock::now();
436   - std::cout << std::chrono::duration_cast<std::chrono::milliseconds>(out_end-out_begin).count() << "ms" << std::endl;
  440 + out_time += std::chrono::duration_cast<std::chrono::milliseconds>(out_end-out_begin).count();
437 441 if(PROGRESS) progress = (double)( c + 1 ) / (batches) * 100;
438 442 }
439 443  
  444 + std::cout<<"BSQ->BIL reads: "<<(double)in_time / (1000 * 60)<<" min"<<std::endl;
  445 + std::cout<<"BSQ->BIL calculations: "<<(double)calc_time / (1000 * 60)<<" min"<<std::endl;
  446 + std::cout<<"BSQ->BIL writes: "<<(double)out_time / (1000 * 60)<<" min"<<std::endl;
  447 +
440 448 free(ptrIn);
441 449 free(ptrOut);
442 450 target.close();
... ...