private void MonitorMemory()
        {
            if (Debug.GC(true) > 60000)
            {
                return;
            }

            Rebug.Print("RAM critically low... pausing actions.  Freemem: " + Debug.GC(true) + "  TimeStamp: " + Clock.Instance.ElapsedMilliseconds);

            foreach (WorkItem action in _pauseableWorkItems)
            {
                action.Stop();
            }
            //var currentCount = _logger.PendingItems;
            while (_logger.PendingItems > 0)
            {
            }

            Rebug.Print("Resuming paused actions... Current FreeMem: " + Debug.GC(false) + "  TimeStamp: " + Clock.Instance.ElapsedMilliseconds);

            foreach (WorkItem action in _pauseableWorkItems)
            {
                action.Start();
            }
        }
Пример #2
0
        public AccelUpdater(int dataCount, float zLaunchThreshold = 2.5f)
        {
            _zLaunchThreshold = zLaunchThreshold;
            Rebug.Print("Initializing Accelerometer data updater");
            _dataCount = dataCount;
            _dataArray = new byte[dataCount + MetaDataCount + TimeDataCount]; //3 bytes for each time stamp, 2 for size, 1 for type, 1 for start
            _workItem  = new WorkItem(DumpAccelData, ref _dataArray, loggable: true, persistent: true, pauseable: true);

            //start data packet w/ correct info
            _dataArray[0] = (byte)PacketType.StartByte; // start bit = 0xff
            _dataArray[1] = (byte)PacketType.AccelDump;
        }
        public GeigerUpdater(int delay, int size)
        {
            _dataCount = size;

            _delay = delay;


            Rebug.Print("Adding interrupt action for shielded geiger counter.");
            ShieldedGeiger.OnInterrupt += Shielded_Counter;

            Rebug.Print("Adding interrupt action for unshielded geiger counter.");
            UnshieldedGeiger.OnInterrupt += Unshielded_Counter;


            _dataArray    = new byte[_dataCount + _metadataCount + _timedataCount];
            _dataArray[0] = (byte)PacketType.StartByte; // start bit = 0xff
            _dataArray[1] = (byte)PacketType.Geiger;

            _workItem = new WorkItem(GatherCounts, ref _dataArray, loggable: true, pauseable: true, persistent: true);
        }