Esempio n. 1
0
        /// <summary>
        /// Signals the end of the transmission.
        /// </summary>
        public void End()
        {
            if (OutgoingBytes > IncomingBytes)
            {
                Speed.SetData(OutgoingBytes);
                Speed.End();

                MessageRate.SetData(OutgoingMessages);
                MessageRate.End();
            }
            else
            {
                Speed.SetData(IncomingBytes);
                Speed.End();

                MessageRate.SetData(IncomingMessages);
                MessageRate.End();
            }
        }
        /// <summary>
        /// Creates a prestage writer.
        /// </summary>
        /// <param name="settings">The settings to use for this prebuffer writer</param>
        /// <param name="onRollover">delegate to call when a file is done with this stage.</param>
        public PrebufferWriter(PrebufferWriterSettings settings, Action <PrebufferRolloverArgs <TKey, TValue> > onRollover)
            : base(MessageClass.Framework)
        {
            if (settings is null)
            {
                throw new ArgumentNullException("settings");
            }
            if (onRollover is null)
            {
                throw new ArgumentNullException("onRollover");
            }

            m_settings = settings.CloneReadonly();
            m_settings.Validate();

            m_performanceLog = Log.RegisterEvent(MessageLevel.Info, MessageFlags.PerformanceIssue, "Queue is full", 0, MessageRate.PerSecond(1), 1);
            m_currentlyRollingOverFullQueue = false;
            m_latestTransactionId.Value     = 0;
            m_syncRoot                         = new object();
            m_activeQueue                      = new SortedPointBuffer <TKey, TValue>(m_settings.MaximumPointCount, true);
            m_processingQueue                  = new SortedPointBuffer <TKey, TValue>(m_settings.MaximumPointCount, true);
            m_activeQueue.IsReadingMode        = false;
            m_processingQueue.IsReadingMode    = false;
            m_onRollover                       = onRollover;
            m_waitForEmptyActiveQueue          = new SafeManualResetEvent(false);
            m_rolloverTask                     = new ScheduledTask(ThreadingMode.DedicatedForeground, ThreadPriority.AboveNormal);
            m_rolloverTask.Running            += m_rolloverTask_Running;
            m_rolloverTask.UnhandledException += OnProcessException;
        }
Esempio n. 3
0
 /// <summary>
 /// Signals the start of the transmission.
 /// </summary>
 public void Begin()
 {
     MessageRate.Start();
     Speed.Start();
 }
Esempio n. 4
0
        static LoadingAdjustedTimestamp()
        {
            Reset();

            Log             = Logger.CreatePublisher(typeof(LoadingAdjustedTimestamp), MessageClass.Component);
            LogLoadingClock = Log.RegisterEvent(MessageLevel.Info, MessageFlags.SystemHealth, $"Loading Clock is behind", 0, MessageRate.EveryFewSeconds(1), 1);
            LogSmall        = Log.RegisterEvent(MessageLevel.Info, MessageFlags.SystemHealth, $"Short High Load Condition Detected", 0, MessageRate.EveryFewSeconds(10), 5);
            LogMedium       = Log.RegisterEvent(MessageLevel.Warning, MessageFlags.SystemHealth, $"Medium High Load Condition Detected", 0, MessageRate.EveryFewSeconds(10), 5);
            LogLarge        = Log.RegisterEvent(MessageLevel.Error, MessageFlags.SystemHealth, $"Long High Load Condition Detected", 0, MessageRate.EveryFewSeconds(10), 5);

            LogLoadingClock.ShouldRaiseMessageSupressionNotifications = false;
            LogSmall.ShouldRaiseMessageSupressionNotifications        = false;
            LogMedium.ShouldRaiseMessageSupressionNotifications       = false;
            LogLarge.ShouldRaiseMessageSupressionNotifications        = false;

            MonitorHighThread              = new Thread(MonitorHighPriority, short.MaxValue);
            MonitorHighThread.Priority     = ThreadPriority.Highest;
            MonitorHighThread.IsBackground = true;
            MonitorHighThread.Start();

            MonitorNormalThread              = new Thread(MonitorNormalPriority, short.MaxValue);
            MonitorNormalThread.Priority     = ThreadPriority.Normal;
            MonitorNormalThread.IsBackground = true;
            MonitorNormalThread.Start();

            MonitorLowThread              = new Thread(MonitorLowPriority, short.MaxValue);
            MonitorLowThread.Priority     = ThreadPriority.Lowest;
            MonitorLowThread.IsBackground = true;
            MonitorLowThread.Start();
        }