Commit e4c3ae76c1df9a1e3818c5ef7150a940ee17d575

Authored by David Mayerich
1 parent 2fce2c1e

added time estimates to the progress bar

Showing 1 changed file with 6 additions and 1 deletions   Show diff stats
@@ -92,10 +92,15 @@ void gpu_absorbance(T* A, T* I, T* I0, size_t N){ @@ -92,10 +92,15 @@ void gpu_absorbance(T* A, T* I, T* I0, size_t N){
92 void progressbar_thread(double* e){ 92 void progressbar_thread(double* e){
93 93
94 unsigned int p = 0; 94 unsigned int p = 0;
  95 + std::chrono::system_clock::time_point start = std::chrono::system_clock::now(); //initialize the previous time point
  96 + std::chrono::system_clock::time_point now;
  97 + std::chrono::duration<double> elapsed, remaining;
95 while(p != 100){ 98 while(p != 100){
96 if(*e > p){ 99 if(*e > p){
  100 + now = std::chrono::system_clock::now(); //get the current time
  101 + elapsed = now - start; //calculate the elapsed time
97 p = (unsigned int)(*e); 102 p = (unsigned int)(*e);
98 - rtsProgressBar(p); 103 + rtsProgressBar(p, elapsed.count());
99 } 104 }
100 } 105 }
101 std::cout<<std::endl; //put a newline after the completed progress bar 106 std::cout<<std::endl; //put a newline after the completed progress bar