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.

File:
1 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}
Note: See TracChangeset for help on using the changeset viewer.