Exemplo n.º 1
0
        /// <summary>
        ///
        /// </summary>
        private void SaveProcess()
        {
            while (!mIsExit)
            {
                resetEvent.WaitOne();
                resetEvent.Reset();
                if (mIsExit)
                {
                    break;
                }

                Stopwatch sw = new Stopwatch();
                sw.Start();
                if (mNeedSaveMemory1 != null)
                {
                    mNeedSaveMemory1.MakeMemoryBusy();
                    RecordToFile();
                    mNeedSaveMemory1.MakeMemoryNoBusy();
                }
                CheckRemoveOldFiles();
                sw.Stop();
                LoggerService.Service.Info("LogManager", "记录" + mNeedSaveMemory1.Name + "到日志文件 耗时" + sw.ElapsedMilliseconds + " ");
            }
            closedEvent.Set();
        }
Exemplo n.º 2
0
        /// <summary>
        ///
        /// </summary>
        public void Start()
        {
            mIsClosed = false;

            if (LogManager != null)
            {
                LogManager.InitHeadData(this.mHisTags);
                LogManager.Start();
            }

            foreach (var vv in mRecordTimerProcesser)
            {
                vv.Start();
            }

            foreach (var vv in mValueChangedProcesser)
            {
                vv.Start();
            }

            LoggerService.Service.Info("Record", "历史变量个数: " + this.mHisTags.Count);

            mCachMemory1.MakeMemoryNoBusy();
            mCachMemory2.MakeMemoryNoBusy();
            mMergeMemory.MakeMemoryNoBusy();

            mLastProcessTime              = DateTime.Now;
            HisRunTag.StartTime           = mLastProcessTime;
            CurrentMemory                 = mCachMemory1;
            CurrentMemory.CurrentDatetime = mLastProcessTime;
            SnapeAllTag();
            RecordAllFirstValue();

            mRecordTimer          = new System.Timers.Timer(MemoryTimeTick);
            mRecordTimer.Elapsed += MRecordTimer_Elapsed;
            mRecordTimer.Start();

            mMergeThread = new Thread(MergerMemoryProcess);
            mMergeThread.IsBackground = true;
            mMergeThread.Start();
        }