From e5cfb4725f13fa8613c6b34ac5280cd24e58feeb Mon Sep 17 00:00:00 2001
From: Ger van Diepen <diepen@astron.nl>
Date: Wed, 5 Oct 2011 12:50:35 +0000
Subject: [PATCH] bug 1684: Fix bug if timing = 0

---
 CEP/Imager/LofarFT/src/LofarConvolutionFunction.cc | 1 -
 CEP/Imager/LofarFT/src/LofarFTMachine.cc           | 8 +++++---
 2 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/CEP/Imager/LofarFT/src/LofarConvolutionFunction.cc b/CEP/Imager/LofarFT/src/LofarConvolutionFunction.cc
index 9ae3098c9ff..3e16b4013ca 100644
--- a/CEP/Imager/LofarFT/src/LofarConvolutionFunction.cc
+++ b/CEP/Imager/LofarFT/src/LofarConvolutionFunction.cc
@@ -918,7 +918,6 @@ namespace LOFAR
                                               double duration,
 					      double timeCF) const
   {
-    os << duration<<' '<<itsTimeW<<' '<<itsTimeA<<' '<<timeCF<<endl;
     os << "  Wterm calculation ";
     showPerc1 (os, itsTimeW, duration);
     os << "    fft-part ";
diff --git a/CEP/Imager/LofarFT/src/LofarFTMachine.cc b/CEP/Imager/LofarFT/src/LofarFTMachine.cc
index 350641910e9..13e27b34020 100644
--- a/CEP/Imager/LofarFT/src/LofarFTMachine.cc
+++ b/CEP/Imager/LofarFT/src/LofarFTMachine.cc
@@ -2019,9 +2019,11 @@ void LofarFTMachine::ComputeResiduals(VisBuffer&vb, Bool useCorrected)
     // The total time is the real elapsed time.
     // The cf and (de)gridding time is the sum of all threads, so scale
     // them back to real time.
-    double scale = itsTotalTimer.getReal() /
-                   (itsCFTime + itsGriddingTime + itsDegriddingTime);
-    cout << itsTotalTimer.getReal() <<' '<< itsCFTime<<' '<<scale<<endl;
+    double total = itsCFTime + itsGriddingTime + itsDegriddingTime;
+    double scale = 1;
+    if (total > 0) {
+      scale = itsTotalTimer.getReal() / total;
+    }
     itsConvFunc->showTimings (os, duration, itsCFTime*scale);
     if (itsGriddingTime > 0) {
       os << "  gridding          ";
-- 
GitLab