Changeset 2258 for trunk/src


Ignore:
Timestamp:
08/01/11 15:08:42 (13 years ago)
Author:
Takeshi Nakazato
Message:

New Development: No

JIRA Issue: No

Ready for Test: Yes

Interface Changes: No

What Interface Changed: Please list interface changes

Test Programs: List test programs

Put in Release Notes: Yes/No

Module(s): Module Names change impacts.

Description: Describe your changes here...

gettimeofday_sec() is defined in MathUtil.h instead to define
in each class.

Location:
trunk/src
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/MSFiller.cpp

    r2257 r2258  
    5151#include "STHeader.h"
    5252
    53 #include <ctime>
    54 #include <sys/time.h>
     53// #include <ctime>
     54// #include <sys/time.h>
     55
     56#include "MathUtils.h"
    5557
    5658using namespace casa ;
     
    5860
    5961namespace asap {
    60 double MSFiller::gettimeofday_sec()
    61 {
    62   struct timeval tv ;
    63   gettimeofday( &tv, NULL ) ;
    64   return tv.tv_sec + (double)tv.tv_usec*1.0e-6 ;
    65 }
     62// double MSFiller::gettimeofday_sec()
     63// {
     64//   struct timeval tv ;
     65//   gettimeofday( &tv, NULL ) ;
     66//   return tv.tv_sec + (double)tv.tv_usec*1.0e-6 ;
     67// }
    6668
    6769MSFiller::MSFiller( casa::CountedPtr<Scantable> stable )
     
    9597{
    9698  os_.origin( LogOrigin( "MSFiller", "open()", WHERE ) ) ;
    97   //double startSec = gettimeofday_sec() ;
     99  //double startSec = mathutil::gettimeofday_sec() ;
    98100  //os_ << "start MSFiller::open() startsec=" << startSec << LogIO::POST ;
    99101  //os_ << "   filename = " << filename << endl ;
     
    147149  isData_ = mstable_.tableDesc().isColumn( "DATA" ) ;
    148150
    149   //double endSec = gettimeofday_sec() ;
     151  //double endSec = mathutil::gettimeofday_sec() ;
    150152  //os_ << "end MSFiller::open() endSec=" << endSec << " (" << endSec-startSec << "sec)" << LogIO::POST ;
    151153  return true ;
     
    155157{
    156158  os_.origin( LogOrigin( "MSFiller", "fill()", WHERE ) ) ;
    157   //double startSec = gettimeofday_sec() ;
     159  //double startSec = mathutil::gettimeofday_sec() ;
    158160  //os_ << "start MSFiller::fill() startSec=" << startSec << LogIO::POST ;
    159161
    160   //double time0 = gettimeofday_sec() ;
     162  //double time0 = mathutil::gettimeofday_sec() ;
    161163  //os_ << "start init fill: " << time0 << LogIO::POST ;
    162164
     
    280282  String telescopeName = "" ;
    281283
    282   //double time1 = gettimeofday_sec() ;
     284  //double time1 = mathutil::gettimeofday_sec() ;
    283285  //os_ << "end init fill: " << time1 << " (" << time1-time0 << "sec)" << LogIO::POST ;
    284286
     
    331333  TableIterator iter0( mstable_, "OBSERVATION_ID" ) ;
    332334  while( !iter0.pastEnd() ) {
    333     //time0 = gettimeofday_sec() ;
     335    //time0 = mathutil::gettimeofday_sec() ;
    334336    //os_ << "start 0th iteration: " << time0 << LogIO::POST ;
    335337    Table t0 = iter0.table() ;
     
    351353    }
    352354    Int nbeam = 0 ;
    353     //time1 = gettimeofday_sec() ;
     355    //time1 = mathutil::gettimeofday_sec() ;
    354356    //os_ << "end 0th iteration init: " << time1 << " (" << time1-time0 << "sec)" << LogIO::POST ;
    355357    //
     
    358360    TableIterator iter1( t0, "FEED1" ) ;
    359361    while( !iter1.pastEnd() ) {
    360       //time0 = gettimeofday_sec() ;
     362      //time0 = mathutil::gettimeofday_sec() ;
    361363      //os_ << "start 1st iteration: " << time0 << LogIO::POST ;
    362364      Table t1 = iter1.table() ;
     
    371373      *focusidRF = 0 ;
    372374
    373       //time1 = gettimeofday_sec() ;
     375      //time1 = mathutil::gettimeofday_sec() ;
    374376      //os_ << "end 1st iteration init: " << time1 << " (" << time1-time0 << "sec)" << LogIO::POST ;
    375377      //
     
    378380      TableIterator iter2( t1, "FIELD_ID" ) ;
    379381      while( !iter2.pastEnd() ) {
    380         //time0 = gettimeofday_sec() ;
     382        //time0 = mathutil::gettimeofday_sec() ;
    381383        //os_ << "start 2nd iteration: " << time0 << LogIO::POST ;
    382384        Table t2 = iter2.table() ;
     
    393395
    394396
    395         //time1 = gettimeofday_sec() ;
     397        //time1 = mathutil::gettimeofday_sec() ;
    396398        //os_ << "end 2nd iteration init: " << time1 << " (" << time1-time0 << "sec)" << LogIO::POST ;
    397399        //
     
    400402        TableIterator iter3( t2, "DATA_DESC_ID" ) ;
    401403        while( !iter3.pastEnd() ) {
    402           //time0 = gettimeofday_sec() ;
     404          //time0 = mathutil::gettimeofday_sec() ;
    403405          //os_ << "start 3rd iteration: " << time0 << LogIO::POST ;
    404406          Table t3 = iter3.table() ;
     
    514516          if ( !iswvr && sdh.poltype == "" ) sdh.poltype = getPolType( corrtype[0] ) ;
    515517
    516           //time1 = gettimeofday_sec() ;
     518          //time1 = mathutil::gettimeofday_sec() ;
    517519          //os_ << "end 3rd iteration init: " << time1 << " (" << time1-time0 << "sec)" << LogIO::POST ;
    518520          //
     
    521523          TableIterator iter4( t3, "SCAN_NUMBER" ) ;
    522524          while( !iter4.pastEnd() ) {
    523             //time0 = gettimeofday_sec() ;
     525            //time0 = mathutil::gettimeofday_sec() ;
    524526            //os_ << "start 4th iteration: " << time0 << LogIO::POST ;
    525527            Table t4 = iter4.table() ;
     
    531533            uInt cycle = 0 ;
    532534
    533             //time1 = gettimeofday_sec() ;
     535            //time1 = mathutil::gettimeofday_sec() ;
    534536            //os_ << "end 4th iteration init: " << time1 << " (" << time1-time0 << "sec)" << LogIO::POST ;
    535537            //
     
    538540            TableIterator iter5( t4, "STATE_ID" ) ;
    539541            while( !iter5.pastEnd() ) {
    540               //time0 = gettimeofday_sec() ;
     542              //time0 = mathutil::gettimeofday_sec() ;
    541543              //os_ << "start 5th iteration: " << time0 << LogIO::POST ;
    542544              Table t5 = iter5.table() ;
     
    546548
    547549              Int nrow = t5.nrow() ;
    548               //time1 = gettimeofday_sec() ;
     550              //time1 = mathutil::gettimeofday_sec() ;
    549551              //os_ << "end 5th iteration init: " << time1 << " (" << time1-time0 << "sec)" << LogIO::POST ;
    550552
     
    680682              }
    681683             
    682               //time1 = gettimeofday_sec() ;
     684              //time1 = mathutil::gettimeofday_sec() ;
    683685              //os_ << "end 5th iteration: " << time1 << " (" << time1-time0 << "sec)" << LogIO::POST ;
    684686
     
    770772  }
    771773
    772   //double endSec = gettimeofday_sec() ;
     774  //double endSec = mathutil::gettimeofday_sec() ;
    773775  //os_ << "end MSFiller::fill() endSec=" << endSec << " (" << endSec-startSec << "sec)" << LogIO::POST ;
    774776}
     
    784786Int MSFiller::getSrcType( Int stateId, boost::object_pool<ROTableColumn> *tpool )
    785787{
    786   //double startSec = gettimeofday_sec() ;
     788  //double startSec = mathutil::gettimeofday_sec() ;
    787789  //os_ << "start MSFiller::getSrcType() startSec=" << startSec << LogIO::POST ;
    788790
     
    940942   
    941943  //os_ << "srcType = " << srcType << LogIO::POST ;
    942   //double endSec = gettimeofday_sec() ;
     944  //double endSec = mathutil::gettimeofday_sec() ;
    943945  //os_ << "end MSFiller::getSrcType() endSec=" << endSec << " (" << endSec-startSec << "sec)" << LogIO::POST ;
    944946  return srcType ;
     
    948950Block<uInt> MSFiller::getPolNo( Int corrType )
    949951{
    950   //double startSec = gettimeofday_sec() ;
     952  //double startSec = mathutil::gettimeofday_sec() ;
    951953  //os_ << "start MSFiller::getPolNo() startSec=" << startSec << LogIO::POST ;
    952954  Block<uInt> polno( 1 ) ;
     
    979981  }
    980982  //os_ << "polno = " << polno << LogIO::POST ;
    981   //double endSec = gettimeofday_sec() ;
     983  //double endSec = mathutil::gettimeofday_sec() ;
    982984  //os_ << "end MSFiller::getPolNo() endSec=" << endSec << " (" << endSec-startSec << "sec)" << LogIO::POST ;
    983985 
     
    987989String MSFiller::getPolType( Int corrType )
    988990{
    989   //double startSec = gettimeofday_sec() ;
     991  //double startSec = mathutil::gettimeofday_sec() ;
    990992  //os_ << "start MSFiller::getPolType() startSec=" << startSec << LogIO::POST ;
    991993  String poltype = "" ;
     
    10001002    poltype = "linpol" ;
    10011003
    1002   //double endSec = gettimeofday_sec() ;
     1004  //double endSec = mathutil::gettimeofday_sec() ;
    10031005  //os_ << "end MSFiller::getPolType() endSec=" << endSec << " (" << endSec-startSec << "sec)" << LogIO::POST ;
    10041006  return poltype ;
     
    10071009void MSFiller::fillWeather()
    10081010{
    1009   //double startSec = gettimeofday_sec() ;
     1011  //double startSec = mathutil::gettimeofday_sec() ;
    10101012  //os_ << "start MSFiller::fillWeather() startSec=" << startSec << LogIO::POST ;
    10111013
     
    11481150  }
    11491151  //os_ << "mwTime[0] = " << mwTime_[0] << " mwInterval[0] = " << mwInterval_[0] << LogIO::POST ;
    1150   //double endSec = gettimeofday_sec() ;
     1152  //double endSec = mathutil::gettimeofday_sec() ;
    11511153  //os_ << "end MSFiller::fillWeather() endSec=" << endSec << " (" << endSec-startSec << "sec)" << LogIO::POST ;
    11521154}
     
    11541156void MSFiller::fillFocus()
    11551157{
    1156   //double startSec = gettimeofday_sec() ;
     1158  //double startSec = mathutil::gettimeofday_sec() ;
    11571159  //os_ << "start MSFiller::fillFocus() startSec=" << startSec << LogIO::POST ;
    11581160  // tentative
    11591161  table_->focus().addEntry( 0.0, 0.0, 0.0, 0.0 ) ;
    1160   //double endSec = gettimeofday_sec() ;
     1162  //double endSec = mathutil::gettimeofday_sec() ;
    11611163  //os_ << "end MSFiller::fillFocus() endSec=" << endSec << " (" << endSec-startSec << "sec)" << LogIO::POST ;
    11621164}
     
    11641166void MSFiller::fillTcal( boost::object_pool<ROTableColumn> *tpoolr )
    11651167{
    1166   //double startSec = gettimeofday_sec() ;
     1168  //double startSec = mathutil::gettimeofday_sec() ;
    11671169  //os_ << "start MSFiller::fillTcal() startSec=" << startSec << LogIO::POST ;
    11681170
     
    12681270
    12691271  //tcalrec_.print( std::cout ) ;
    1270   //double endSec = gettimeofday_sec() ;
     1272  //double endSec = mathutil::gettimeofday_sec() ;
    12711273  //os_ << "end MSFiller::fillTcal() endSec=" << endSec << " (" << endSec-startSec << "sec)" << LogIO::POST ;
    12721274}
     
    12741276uInt MSFiller::getWeatherId( uInt idx, Double wtime )
    12751277{
    1276   //double startSec = gettimeofday_sec() ;
     1278  //double startSec = mathutil::gettimeofday_sec() ;
    12771279  //os_ << "start MSFiller::getWeatherId() startSec=" << startSec << LogIO::POST ;
    12781280  uInt nrow = mwTime_.size() ;
     
    13121314  //os_ << LogIO::WARN << "Couldn't find correct WEATHER_ID for time " << wtime << LogIO::POST ;
    13131315
    1314   //double endSec = gettimeofday_sec() ;
     1316  //double endSec = mathutil::gettimeofday_sec() ;
    13151317  //os_ << "end MSFiller::getWeatherId() endSec=" << endSec << " (" << endSec-startSec << "sec)" << LogIO::POST ;
    13161318  return wid ;
     
    13191321void MSFiller::getSysCalTime( Vector<MEpoch> &scTime, Vector<Double> &scInterval, Block<MEpoch> &tcol, Block<Int> &tidx )
    13201322{
    1321   //double startSec = gettimeofday_sec() ;
     1323  //double startSec = mathutil::gettimeofday_sec() ;
    13221324  //os_ << "start MSFiller::getSysCalTime() startSec=" << startSec << LogIO::POST ;
    13231325
     
    13661368    }
    13671369  }
    1368   //double endSec = gettimeofday_sec() ;
     1370  //double endSec = mathutil::gettimeofday_sec() ;
    13691371  //os_ << "end MSFiller::getSysCalTime() endSec=" << endSec << " (" << endSec-startSec << "sec) scnrow = " << scnrow << " tcol.nelements = " << tcol.nelements() << LogIO::POST ;
    13701372  return ;
     
    13731375Block<uInt> MSFiller::getTcalId( Int fid, Int spwid, MEpoch &t )
    13741376{
    1375   //double startSec = gettimeofday_sec() ;
     1377  //double startSec = mathutil::gettimeofday_sec() ;
    13761378  //os_ << "start MSFiller::getTcalId() startSec=" << startSec << LogIO::POST ;
    13771379  //if ( table_->tcal().table().nrow() == 0 ) {
     
    13971399    tcalids[ipol] = ids[0] + ipol - 1 ;
    13981400
    1399   //double endSec = gettimeofday_sec() ;
     1401  //double endSec = mathutil::gettimeofday_sec() ;
    14001402  //os_ << "end MSFiller::getTcalId() endSec=" << endSec << " (" << endSec-startSec << "sec)" << LogIO::POST ;
    14011403  return tcalids ;
     
    14101412                             Double t )
    14111413{
    1412   //double startSec = gettimeofday_sec() ;
     1414  //double startSec = mathutil::gettimeofday_sec() ;
    14131415  //os_ << "start MSFiller::getDirection1() startSec=" << startSec << LogIO::POST ;
    1414   //double time0 = gettimeofday_sec() ;
     1416  //double time0 = mathutil::gettimeofday_sec() ;
    14151417  //os_ << "start getDirection 1st stage startSec=" << time0 << LogIO::POST ;
    14161418  // assume that cols is sorted by TIME
     
    14451447    }
    14461448  }
    1447   //double time1 = gettimeofday_sec() ;
     1449  //double time1 = mathutil::gettimeofday_sec() ;
    14481450  //os_ << "end getDirection 1st stage endSec=" << time1 << " (" << time1-time0 << "sec)" << LogIO::POST ;
    14491451  // ensure that tcol(idx) < t
    14501452  //os_ << "tcol(idx) = " << tcol(idx).get("s").getValue() << " t = " << t << " diff = " << tcol(idx).get("s").getValue()-t << endl ;
    1451   //time0 = gettimeofday_sec() ;
     1453  //time0 = mathutil::gettimeofday_sec() ;
    14521454  //os_ << "start getDirection 2nd stage startSec=" << time0 << LogIO::POST ;
    14531455  //while( tcol( idx ) * factor > t && idx > 0 )
     
    14771479    }
    14781480  }
    1479   //time1 = gettimeofday_sec() ;
     1481  //time1 = mathutil::gettimeofday_sec() ;
    14801482  //os_ << "end getDirection 2nd stage endSec=" << time1 << " (" << time1-time0 << "sec)" << LogIO::POST ;
    14811483  //os_ << "searched idx = " << idx << LogIO::POST ;
    14821484
    1483   //time0 = gettimeofday_sec() ;
     1485  //time0 = mathutil::gettimeofday_sec() ;
    14841486  //os_ << "start getDirection 3rd stage startSec=" << time0 << LogIO::POST ;
    14851487  //os_ << "dmcol(idx).shape() = " << dmcol(idx).shape() << LogIO::POST ;
     
    15221524  }
    15231525
    1524   //time1 = gettimeofday_sec() ;
     1526  //time1 = mathutil::gettimeofday_sec() ;
    15251527  //os_ << "end getDirection 3rd stage endSec=" << time1 << " (" << time1-time0 << "sec)" << LogIO::POST ;
    1526   //double endSec = gettimeofday_sec() ;
     1528  //double endSec = mathutil::gettimeofday_sec() ;
    15271529  //os_ << "end MSFiller::getDirection1() endSec=" << endSec << " (" << endSec-startSec << "sec)" << LogIO::POST ;
    15281530  return idx ;
     
    16101612                                         Vector<Int> &corrtype )
    16111613{
    1612   //double startSec = gettimeofday_sec() ;
     1614  //double startSec = mathutil::gettimeofday_sec() ;
    16131615  //os_ << "start MSFiller::reshapeSpectraAndFlagtra() startSec=" << startSec << LogIO::POST ; 
    16141616  if ( isFloatData_ ) {
     
    16691671    }
    16701672  }
    1671   //double endSec = gettimeofday_sec() ;
     1673  //double endSec = mathutil::gettimeofday_sec() ;
    16721674  //os_ << "end MSFiller::reshapeSpectraAndFlagtra() endSec=" << endSec << " (" << endSec-startSec << "sec)" << LogIO::POST ;
    16731675}
     
    16821684                             MPosition &antpos )
    16831685{
    1684   //double startSec = gettimeofday_sec() ;
     1686  //double startSec = mathutil::gettimeofday_sec() ;
    16851687  //os_ << "start MSFiller::getDirection2() startSec=" << startSec << LogIO::POST ; 
    16861688  String refString ;
     
    17081710    srate = 0.0 ;
    17091711  }
    1710   //double endSec = gettimeofday_sec() ;
     1712  //double endSec = mathutil::gettimeofday_sec() ;
    17111713  //os_ << "end MSFiller::getDirection2() endSec=" << endSec << " (" << endSec-startSec << "sec)" << LogIO::POST ;
    17121714  return diridx ;
     
    17201722                                   Vector<MDirection> &srcdir )
    17211723{
    1722   //double startSec = gettimeofday_sec() ;
     1724  //double startSec = mathutil::gettimeofday_sec() ;
    17231725  //os_ << "start MSFiller::getSourceDirection() startSec=" << startSec << LogIO::POST ;
    17241726  Vector<Double> defaultDir = srcdir[0].getAngle( "rad" ).getValue() ;
     
    17371739  MDirection::Convert toazel( dirType, MDirection::Ref( MDirection::AZELGEO, mf ) ) ;
    17381740  azel = toazel( defaultDir ).getAngle("rad").getValue() ;
    1739   //double endSec = gettimeofday_sec() ;
     1741  //double endSec = mathutil::gettimeofday_sec() ;
    17401742  //os_ << "end MSFiller::getSourceDirection() endSec=" << endSec << " (" << endSec-startSec << "sec)" << LogIO::POST ;
    17411743}
     
    18381840                           boost::object_pool<ROTableColumn> *tpoolr )
    18391841{
    1840   //double startSec = gettimeofday_sec() ;
     1842  //double startSec = mathutil::gettimeofday_sec() ;
    18411843  //os_ << "start MSFiller::sourceInfo() startSec=" << startSec << LogIO::POST ;
    18421844
     
    18921894  }
    18931895 
    1894   //double endSec = gettimeofday_sec() ;
     1896  //double endSec = mathutil::gettimeofday_sec() ;
    18951897  //os_ << "end MSFiller::sourceInfo() endSec=" << endSec << " (" << endSec-startSec << "sec)" << LogIO::POST ;
    18961898}
     
    19091911                              boost::object_pool<ROTableColumn> *tpoolr )
    19101912{
    1911   //double startSec = gettimeofday_sec() ;
     1913  //double startSec = mathutil::gettimeofday_sec() ;
    19121914  //os_ << "start MSFiller::spectralSetup() startSec=" << startSec << LogIO::POST ;
    19131915
     
    19711973  }
    19721974 
    1973   //double endSec = gettimeofday_sec() ;
     1975  //double endSec = mathutil::gettimeofday_sec() ;
    19741976  //os_ << "end MSFiller::spectralSetup() endSec=" << endSec << " (" << endSec-startSec << "sec)" << LogIO::POST ;
    19751977}
  • trunk/src/MSFiller.h

    r2246 r2258  
    117117
    118118  // tool for HPC
    119   double gettimeofday_sec() ;
     119//   double gettimeofday_sec() ;
    120120
    121121  // get frequency frame
  • trunk/src/MSWriter.cpp

    r2244 r2258  
    3838#include "STMolecules.h"
    3939#include "STTcal.h"
    40 
    41 #include <ctime>
    42 #include <sys/time.h>
     40#include "MathUtils.h"
     41
     42// #include <ctime>
     43// #include <sys/time.h>
     44
    4345
    4446using namespace casa ;
     
    4648
    4749namespace asap {
    48 double MSWriter::gettimeofday_sec()
    49 {
    50   struct timeval tv ;
    51   gettimeofday( &tv, NULL ) ;
    52   return tv.tv_sec + (double)tv.tv_usec*1.0e-6 ;
    53 }
     50// double MSWriter::gettimeofday_sec()
     51// {
     52//   struct timeval tv ;
     53//   gettimeofday( &tv, NULL ) ;
     54//   return tv.tv_sec + (double)tv.tv_usec*1.0e-6 ;
     55// }
    5456
    5557MSWriter::MSWriter(CountedPtr<Scantable> stable)
     
    8183{
    8284  os_.origin( LogOrigin( "MSWriter", "write()", WHERE ) ) ;
    83 //   double startSec = gettimeofday_sec() ;
     85//   double startSec = mathutil::gettimeofday_sec() ;
    8486//   os_ << "start MSWriter::write() startSec=" << startSec << LogIO::POST ;
    8587
     
    473475  }
    474476
    475 //   double endSec = gettimeofday_sec() ;
     477//   double endSec = mathutil::gettimeofday_sec() ;
    476478//   os_ << "end MSWriter::write() endSec=" << endSec << " (" << endSec-startSec << "sec)" << LogIO::POST ;
    477479
     
    482484{
    483485//   os_.origin( LogOrigin( "MSWriter", "init()", WHERE ) ) ;
    484 //   double startSec = gettimeofday_sec() ;
     486//   double startSec = mathutil::gettimeofday_sec() ;
    485487//   os_ << "start MSWriter::init() startSec=" << startSec << LogIO::POST ;
    486488 
     
    574576  }
    575577
    576 //   double endSec = gettimeofday_sec() ;
     578//   double endSec = mathutil::gettimeofday_sec() ;
    577579//   os_ << "end MSWriter::init() endSec=" << endSec << " (" << endSec-startSec << "sec)" << LogIO::POST ;
    578580}
     
    581583{
    582584//   os_.origin( LogOrigin( "MSWriter", "setupMS()", WHERE ) ) ;
    583 //   double startSec = gettimeofday_sec() ;
     585//   double startSec = mathutil::gettimeofday_sec() ;
    584586//   os_ << "start MSWriter::setupMS() startSec=" << startSec << LogIO::POST ;
    585587 
     
    689691  mstable_->initRefs() ;
    690692
    691 //   double endSec = gettimeofday_sec() ;
     693//   double endSec = mathutil::gettimeofday_sec() ;
    692694//   os_ << "end MSWriter::setupMS() endSec=" << endSec << " (" << endSec-startSec << "sec)" << LogIO::POST ;
    693695}
     
    695697void MSWriter::fillObservation()
    696698{
    697 //   double startSec = gettimeofday_sec() ;
     699//   double startSec = mathutil::gettimeofday_sec() ;
    698700//   os_ << "start MSWriter::fillObservation() startSec=" << startSec << LogIO::POST ;
    699701
     
    724726  msObsCols.timeRangeMeas().put( 0, trange ) ;
    725727
    726 //   double endSec = gettimeofday_sec() ;
     728//   double endSec = mathutil::gettimeofday_sec() ;
    727729//   os_ << "end MSWriter::fillObservation() endSec=" << endSec << " (" << endSec-startSec << "sec)" << LogIO::POST ;
    728730}
     
    730732void MSWriter::fillAntenna()
    731733{
    732 //   double startSec = gettimeofday_sec() ;
     734//   double startSec = mathutil::gettimeofday_sec() ;
    733735//   os_ << "start MSWriter::fillAntenna() startSec=" << startSec << LogIO::POST ;
    734736
     
    769771  msAntCols.dishDiameterQuant().put( 0, Quantity( diameter, "m" ) ) ;
    770772
    771 //   double endSec = gettimeofday_sec() ;
     773//   double endSec = mathutil::gettimeofday_sec() ;
    772774//   os_ << "end MSWriter::fillAntenna() endSec=" << endSec << " (" << endSec-startSec << "sec)" << LogIO::POST ;
    773775}
     
    775777void MSWriter::fillProcessor()
    776778{
    777 //   double startSec = gettimeofday_sec() ;
     779//   double startSec = mathutil::gettimeofday_sec() ;
    778780//   os_ << "start MSWriter::fillProcessor() startSec=" << startSec << LogIO::POST ;
    779781 
     
    782784  msProc.addRow( 1, True ) ;
    783785
    784 //   double endSec = gettimeofday_sec() ;
     786//   double endSec = mathutil::gettimeofday_sec() ;
    785787//   os_ << "end MSWriter::fillProcessor() endSec=" << endSec << " (" << endSec-startSec << "sec)" << LogIO::POST ;
    786788}
     
    788790void MSWriter::fillSource()
    789791{
    790 //   double startSec = gettimeofday_sec() ;
     792//   double startSec = mathutil::gettimeofday_sec() ;
    791793//   os_ << "start MSWriter::fillSource() startSec=" << startSec << LogIO::POST ;
    792794 
     
    926928  }
    927929
    928 //   double endSec = gettimeofday_sec() ;
     930//   double endSec = mathutil::gettimeofday_sec() ;
    929931//   os_ << "end MSWriter::fillSource() endSec=" << endSec << " (" << endSec-startSec << "sec)" << LogIO::POST ;
    930932}
     
    932934void MSWriter::fillWeather()
    933935{
    934 //   double startSec = gettimeofday_sec() ;
     936//   double startSec = mathutil::gettimeofday_sec() ;
    935937//   os_ << "start MSWriter::fillWeather() startSec=" << startSec << LogIO::POST ;
    936938
     
    984986  mswCols.interval().putColumn( intervalArr ) ;
    985987
    986 //   double endSec = gettimeofday_sec() ;
     988//   double endSec = mathutil::gettimeofday_sec() ;
    987989//   os_ << "end MSWriter::fillWeather() endSec=" << endSec << " (" << endSec-startSec << "sec)" << LogIO::POST ;
    988990}
     
    990992void MSWriter::fillSysCal()
    991993{
    992 //   double startSec = gettimeofday_sec() ;
     994//   double startSec = mathutil::gettimeofday_sec() ;
    993995//   os_ << "start MSWriter::fillSysCal() startSec=" << startSec << LogIO::POST ;
    994996
     
    10511053  ROTableColumn ifnoCol( tab, "IFNO" ) ;
    10521054  for ( uInt irow = 0 ; irow < nrow ; irow++ ) {
    1053 //     double t1 = gettimeofday_sec() ;
     1055//     double t1 = mathutil::gettimeofday_sec() ;
    10541056    Vector<uInt> ids = tcalIdRec_.asArrayuInt( irow ) ;
    10551057//     os_ << "ids = " << ids << LogIO::POST ;
     
    11871189    row.put( mssc.nrow()-1 ) ;
    11881190
    1189 //     double t2 = gettimeofday_sec() ;
     1191//     double t2 = mathutil::gettimeofday_sec() ;
    11901192//     os_ << irow << "th loop elapsed time = " << t2-t1 << "sec" << LogIO::POST ;
    11911193  }
    11921194 
    1193 //   double endSec = gettimeofday_sec() ;
     1195//   double endSec = mathutil::gettimeofday_sec() ;
    11941196//   os_ << "end MSWriter::fillSysCal() endSec=" << endSec << " (" << endSec-startSec << "sec)" << LogIO::POST ;
    11951197}
     
    11971199void MSWriter::addFeed( Int id )
    11981200{
    1199 //   double startSec = gettimeofday_sec() ;
     1201//   double startSec = mathutil::gettimeofday_sec() ;
    12001202//   os_ << "start MSWriter::addFeed() startSec=" << startSec << LogIO::POST ;
    12011203
     
    12351237  msFeedCols.polResponse().put( nrow-1, polResponse ) ;
    12361238
    1237 //   double endSec = gettimeofday_sec() ;
     1239//   double endSec = mathutil::gettimeofday_sec() ;
    12381240//   os_ << "end MSWriter::addFeed() endSec=" << endSec << " (" << endSec-startSec << "sec)" << LogIO::POST ;
    12391241}
     
    12411243void MSWriter::addSpectralWindow( Int spwid, Int freqid )
    12421244{
    1243 //   double startSec = gettimeofday_sec() ;
     1245//   double startSec = mathutil::gettimeofday_sec() ;
    12441246//   os_ << "start MSWriter::addSpectralWindow() startSec=" << startSec << LogIO::POST ;
    12451247 
     
    12941296  msSpwCols.chanFreq().put( spwid, sharedDoubleArr ) ;
    12951297
    1296 //   double endSec = gettimeofday_sec() ;
     1298//   double endSec = mathutil::gettimeofday_sec() ;
    12971299//   os_ << "end MSWriter::addSpectralWindow() endSec=" << endSec << " (" << endSec-startSec << "sec)" << LogIO::POST ;
    12981300}
     
    13001302void MSWriter::addField( Int fid, String fieldname, String srcname, Double t, Vector<Double> rate )
    13011303{
    1302 //   double startSec = gettimeofday_sec() ;
     1304//   double startSec = mathutil::gettimeofday_sec() ;
    13031305//   os_ << "start MSWriter::addField() startSec=" << startSec << LogIO::POST ;
    13041306 
     
    13401342  msFieldCols.sourceId().put( fid, srcId ) ;
    13411343
    1342 //   double endSec = gettimeofday_sec() ;
     1344//   double endSec = mathutil::gettimeofday_sec() ;
    13431345//   os_ << "end MSWriter::addField() endSec=" << endSec << " (" << endSec-startSec << "sec)" << LogIO::POST ;
    13441346}
     
    13461348void MSWriter::addPointing( String &name, Double &me, Double &interval, Matrix<Double> &dir )
    13471349{
    1348 //   double startSec = gettimeofday_sec() ;
     1350//   double startSec = mathutil::gettimeofday_sec() ;
    13491351//   os_ << "start MSWriter::addPointing() startSec=" << startSec << LogIO::POST ;
    13501352 
     
    13791381  row.put( nrow ) ;
    13801382
    1381 //   double endSec = gettimeofday_sec() ;
     1383//   double endSec = mathutil::gettimeofday_sec() ;
    13821384//   os_ << "end MSWriter::addPointing() endSec=" << endSec << " (" << endSec-startSec << "sec)" << LogIO::POST ;
    13831385}
     
    13851387Int MSWriter::addPolarization( Vector<Int> polnos )
    13861388{
    1387 //   double startSec = gettimeofday_sec() ;
     1389//   double startSec = mathutil::gettimeofday_sec() ;
    13881390//   os_ << "start MSWriter::addPolarization() startSec=" << startSec << LogIO::POST ;
    13891391
     
    14441446  }
    14451447
    1446 //   double endSec = gettimeofday_sec() ;
     1448//   double endSec = mathutil::gettimeofday_sec() ;
    14471449//   os_ << "end MSWriter::addPolarization() endSec=" << endSec << " (" << endSec-startSec << "sec)" << LogIO::POST ;
    14481450
     
    14521454Int MSWriter::addDataDescription( Int polid, Int spwid )
    14531455{
    1454 //   double startSec = gettimeofday_sec() ;
     1456//   double startSec = mathutil::gettimeofday_sec() ;
    14551457//   os_ << "start MSWriter::addDataDescription() startSec=" << startSec << LogIO::POST ;
    14561458
     
    14821484  }
    14831485
    1484 //   double endSec = gettimeofday_sec() ;
     1486//   double endSec = mathutil::gettimeofday_sec() ;
    14851487//   os_ << "end MSWriter::addDataDescription() endSec=" << endSec << " (" << endSec-startSec << "sec)" << LogIO::POST ;
    14861488
     
    14901492Int MSWriter::addState( Int st, Int &subscan )
    14911493{
    1492 //   double startSec = gettimeofday_sec() ;
     1494//   double startSec = mathutil::gettimeofday_sec() ;
    14931495//   os_ << "start MSWriter::addState() startSec=" << startSec << LogIO::POST ;
    14941496
     
    15371539  subscan++ ;
    15381540
    1539 //   double endSec = gettimeofday_sec() ;
     1541//   double endSec = mathutil::gettimeofday_sec() ;
    15401542//   os_ << "end MSWriter::addState() endSec=" << endSec << " (" << endSec-startSec << "sec)" << LogIO::POST ;
    15411543
     
    15451547Vector<Int> MSWriter::toCorrType( Vector<Int> polnos )
    15461548{
    1547 //   double startSec = gettimeofday_sec() ;
     1549//   double startSec = mathutil::gettimeofday_sec() ;
    15481550//   os_ << "start MSWriter::toCorrType() startSec=" << startSec << LogIO::POST ;
    15491551
     
    16321634  }
    16331635
    1634 //   double endSec = gettimeofday_sec() ;
     1636//   double endSec = mathutil::gettimeofday_sec() ;
    16351637//   os_ << "end MSWriter::toCorrType() endSec=" << endSec << " (" << endSec-startSec << "sec)" << LogIO::POST ;
    16361638
     
    16401642void MSWriter::getValidTimeRange( Double &me, Double &interval, Table &tab )
    16411643{
    1642 //   double startSec = gettimeofday_sec() ;
     1644//   double startSec = mathutil::gettimeofday_sec() ;
    16431645//   os_ << "start MSWriter::getVaridTimeRange() startSec=" << startSec << LogIO::POST ;
    16441646
     
    16581660  interval = ( maxTime - minTime ) * 86400.0 ;
    16591661
    1660 //   double endSec = gettimeofday_sec() ;
     1662//   double endSec = mathutil::gettimeofday_sec() ;
    16611663//   os_ << "end MSWriter::getValidTimeRange() endSec=" << endSec << " (" << endSec-startSec << "sec)" << LogIO::POST ;
    16621664}
     
    16641666void MSWriter::getValidTimeRange( Double &me, Double &interval, Vector<Double> &atime, Vector<Double> &ainterval )
    16651667{
    1666 //   double startSec = gettimeofday_sec() ;
     1668//   double startSec = mathutil::gettimeofday_sec() ;
    16671669//   os_ << "start MSWriter::getVaridTimeRange() startSec=" << startSec << LogIO::POST ;
    16681670
     
    16801682  interval = ( maxTime - minTime ) * 86400.0 + mean( ainterval ) ;
    16811683
    1682 //   double endSec = gettimeofday_sec() ;
     1684//   double endSec = mathutil::gettimeofday_sec() ;
    16831685//   os_ << "end MSWriter::getValidTimeRange() endSec=" << endSec << " (" << endSec-startSec << "sec)" << LogIO::POST ;
    16841686}
     
    16871689void MSWriter::queryType( Int type, String &stype, Bool &b, Double &t, Double &l )
    16881690{
    1689 //   double startSec = gettimeofday_sec() ;
     1691//   double startSec = mathutil::gettimeofday_sec() ;
    16901692//   os_ << "start MSWriter::queryType() startSec=" << startSec << LogIO::POST ;
    16911693
     
    19161918  }
    19171919
    1918 //   double endSec = gettimeofday_sec() ;
     1920//   double endSec = mathutil::gettimeofday_sec() ;
    19191921//   os_ << "end MSWriter::queryType() endSec=" << endSec << " (" << endSec-startSec << "sec)" << LogIO::POST ;
    19201922}
  • trunk/src/MSWriter.h

    r2104 r2258  
    8888
    8989  // tool for HPC
    90   double gettimeofday_sec() ;
     90//   double gettimeofday_sec() ;
    9191
    9292  casa::CountedPtr<Scantable> table_ ;
  • trunk/src/MathUtils.cpp

    r2186 r2258  
    4444#include <scimath/Mathematics/AutoDiff.h>
    4545
     46#include <ctime>
     47#include <sys/time.h>
    4648
    4749#include "MathUtils.h"
     
    287289    fend = -1;
    288290  }
    289 }
     291
     292}
     293
     294double mathutil::gettimeofday_sec()
     295{
     296  struct timeval tv ;
     297  gettimeofday( &tv, NULL ) ;
     298  return tv.tv_sec + (double)tv.tv_usec*1.0e-6 ;
     299}
  • trunk/src/MathUtils.h

    r2186 r2258  
    109109                              std::vector<bool>& mask);
    110110
     111/**
     112 * tool to record current time stamp
     113 **/
     114double gettimeofday_sec() ;
     115
    111116}
    112117
Note: See TracChangeset for help on using the changeset viewer.