Changeset 12538 for trunk/FACT++


Ignore:
Timestamp:
11/16/11 15:53:10 (13 years ago)
Author:
lyard
Message:
moved the flush from every row entry to every minute
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/FACT++/src/datalogger.cc

    r12536 r12538  
    389389    //Current day variable. Used to close nightly files when night changes
    390390    int fCurrentDay;
     391    Time lastFlush;
    391392public:
    392393    int Write(const Time &time, const std::string &txt, int qos=kMessage);
     
    759760    const Time nowMinusTwelve = timeNow-boost::posix_time::hours(12);
    760761    fCurrentDay = nowMinusTwelve.M()*31 + nowMinusTwelve.D();//assume 31 days per month. we do not really care, only want unique number per day of the year
     762    lastFlush = Time();
    761763
    762764    //Give a name to this machine's specific states
     
    11781180    int newDayNumber = nowMinusTwelve.M()*31 + nowMinusTwelve.D();//assume 31 days per month. we do not really care, only want unique number per day of the year
    11791181
     1182    //also check if we should flush the nightly files
     1183    if (lastFlush < timeNow-boost::posix_time::minutes(1))
     1184    {
     1185        lastFlush = timeNow;
     1186        SubscriptionsListType::iterator x;
     1187        map<string, SubscriptionType>::iterator y;
     1188        for (x=fServiceSubscriptions.begin(); x != fServiceSubscriptions.end(); x++)
     1189        {//find current service is subscriptions
     1190            for (y=x->second.begin(); y!=x->second.end();y++)
     1191                if (y->second.nightlyFile.IsOpen())
     1192                {
     1193                    y->second.nightlyFile.Flush();
     1194                }
     1195        }
     1196        if (fDebugIsOn)
     1197            Debug("Just flushed nightly fits files to the disk");
     1198    }
     1199
    11801200//    if (Time().h() == 12 && !fDailyFileDayChangedAlready)
    11811201    if (newDayNumber !=  fCurrentDay)
     
    19051925                return;
    19061926            }
    1907             sub.nightlyFile.Flush();
     1927 //           sub.nightlyFile.Flush();
    19081928         }
    19091929
Note: See TracChangeset for help on using the changeset viewer.