Beispiel #1
0
 /// <summary>
 /// Increases the specified statistic by one.
 /// </summary>
 /// <param name="PluginName">The name of your plugin.</param>
 /// <param name="Statistic">The statistic to increase.</param>
 public static void AddCountToStatistic(string PluginName, string Statistic)
 {
     if (!ProtectedStatistics.Contains(Statistic.ToLower()))
     {
         Game.LogTrivial("LSPDFR+ API: Plugin is increasing statistic: " + Statistic);
         StatisticsCounter.AddCountToStatistic(Statistic, PluginName);
     }
 }
Beispiel #2
0
        private void statisticsBtn_Click(object sender, EventArgs e)
        {
            var statsCounter = new StatisticsCounter();
            var stats        = statsCounter.Count(getRecords(), getRecordsDateFrom(), getRecordsDateTo());
            var dialogue     = new StatisticsForm(stats);

            dialogue.ShowDialog();
        }
Beispiel #3
0
        public static IList <Ticket> CreateCollection(RunningTotalBroadcast runningTotal)
        {
            StatisticsCounter cls    = new StatisticsCounter(runningTotal);
            IList <Ticket>    parent = new ClosureAddProxy <Ticket>(new List <Ticket>(),
                                                                    new DelegateClosure <Ticket>(cls.ClosureAddMethod));

            return(new ClosureRemoveProxy <Ticket>(parent,
                                                   new DelegateClosure <Ticket>(cls.ClosureRemoveMethod)));
        }
Beispiel #4
0
        public CommandProcessor(IRequestProcessor processor, StatisticsCounter collector)
        {
            _processor     = processor;
            _commandsQueue = new ConcurrentQueue <ProcCommand>();

            _worker = new Thread(Run);
            _worker.IsBackground = true;
            _worker.Priority     = ThreadPriority.AboveNormal;
        }
Beispiel #5
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="topicName"></param>
 /// <param name="cacheImpl"></param>
 /// <param name="perfStatsCollector"></param>
 /// <param name="parent"></param>
 internal Topic(string topicName, CacheImplBase cacheImpl, StatisticsCounter perfStatsCollector, MessageManager parent)
 {
     _topicName          = topicName;
     _subscriptions      = new Dictionary <SubscriptionIdentifier, TopicSubscription>();
     _cacheImpl          = cacheImpl;
     _perfStatsCollector = perfStatsCollector;
     _parent             = parent;
     _publisherId        = new Shorter().GuidString;
     _readerWriterLock   = new ReaderWriterLock();
 }
Beispiel #6
0
        public CommandProcessorPool(int processors, IRequestProcessor reqProcessor, StatisticsCounter collector)
        {
            _maxProcessors = processors;
            _workers       = new CommandProcessor[processors];

            for (int i = 0; i < processors; i++)
            {
                _workers[i] = new CommandProcessor(reqProcessor, collector);
            }
        }
Beispiel #7
0
 public TagCloudContainer(ITextReader[] textReaders, InputPreprocessor preprocessor,
                          StatisticsCounter statCounter, WordLayouter layouter,
                          WordPainter painter, WordDrawer drawer)
 {
     this.textReaders  = textReaders;
     this.preprocessor = preprocessor;
     this.statCounter  = statCounter;
     this.layouter     = layouter;
     this.painter      = painter;
     this.drawer       = drawer;
 }
Beispiel #8
0
        private void Initialize(Broker container, OnCommandRecieved commandRecieved, OnServerLost serverLost, Logs logs, StatisticsCounter perfStatsCollector, ResponseIntegrator rspIntegraotr, string bindIP, string cacheName)
        {
            _commandRecieved            = null;
            _isConnected                = true;
            _primaryClient              = null;
            _secondaryClient            = null;
            _ipAddress                  = string.Empty;
            _intendedRecipientIPAddress = string.Empty;
            _port                    = 0;
            _connectionMutex         = new object();
            s_receiveBufferSize      = 2048000;
            _processID               = AppUtil.CurrentProcess.Id;
            _primaryReceiveThread    = null;
            _secondaryReceiveThread  = null;
            _notificationsRegistered = false;
            _isReconnecting          = false;
            _forcedDisconnect        = false;
            _nagglingEnabled         = false;
            _nagglingSize            = 5 * 100 * 1024; //500k
            _supportDualSocket       = false;
            _syncLock                = new object();
            _perfStatsColl           = null;
            _socketSelectionMutex    = new object();
            _usePrimary              = true;
            _optimized               = false;
            _isIdle                  = false;
            _container               = container;
            _commandRecieved         = commandRecieved;
            _serverLost              = serverLost;
            _logger                  = logs;
            _responseIntegrator      = rspIntegraotr;
            _cacheId                 = cacheName;
            _perfStatsColl           = perfStatsCollector;



            SetBindIP(bindIP);
            if (System.Configuration.ConfigurationSettings.AppSettings["EnableNaggling"] != null)
            {
                _nagglingEnabled = Convert.ToBoolean(System.Configuration.ConfigurationSettings.AppSettings["EnableNaggling"]);
            }

            //read the naggling size from app.config and covert it to bytes.
            if (System.Configuration.ConfigurationSettings.AppSettings["NagglingSize"] != null)
            {
                _nagglingSize = 1024 * Convert.ToInt64(System.Configuration.ConfigurationSettings.AppSettings["NagglingSize"]);
            }

            if (System.Configuration.ConfigurationSettings.AppSettings["EnableDualSockets"] != null)
            {
                _supportDualSocket = Convert.ToBoolean(System.Configuration.ConfigurationSettings.AppSettings["EnableDualSockets"]);
            }
        }
        public void TagCloudVisualizer_CreatesFileAfterWork()
        {
            var appSettings = new AppSettings(new ImageSettings(), new PictureBoxImageHolder(),
                                              new Palette(), new Restrictions());

            var textReader = A.Fake <ITextReader>();

            A.CallTo(() => textReader.Formats)
            .Returns(new HashSet <string>()
            {
                "txt"
            });
            A.CallTo(() => textReader.GetAllWords(null))
            .WithAnyArguments()
            .Returns(new[] { "meat", "chicken" });

            var inputPreprocessor = new InputPreprocessor(new[] { new ToLowercasePreprocessor() }, appSettings);

            var statCounter = new StatisticsCounter(new [] { new WordCountCollector() });

            ICloudLayouter GetCloudLayouter() => new CircularCloudLayouter(new Point(0, 0));

            var wordSizeChooser = new WordCountSizeChooser();

            var layouter = new WordLayouter(new CloudLayouterConfiguration(GetCloudLayouter), wordSizeChooser);

            var painter = new DefaultWordPainter(appSettings.Palette);

            var drawer = new DefaultWordDrawer(appSettings);

            var tagCloudContainer = new TagCloudContainer(new[] { textReader }, inputPreprocessor,
                                                          statCounter, layouter, painter, drawer);

            var filepath = GetTempFilePathWithExtension(".png");

            var saveFileAction = new SaveFileStub(appSettings, filepath);

            var graphicalVisualizer = new GraphicalVisualizer(new [] { saveFileAction }, appSettings, tagCloudContainer);

            appSettings.CurrentInterface = graphicalVisualizer;
            appSettings.CurrentFile      = "test.txt";

            saveFileAction.Perform();
            File.Exists(filepath).Should().BeTrue();
            File.Delete(filepath);
        }
Beispiel #10
0
        /// <summary>
        /// Starts the socket server.It registers some types with compact Framework,
        /// enables simple logs as well as DetailedLogs, then it checks Ncache licence information.
        /// starts connection manager and perfmon counters.
        /// </summary>
        /// <param name="bindIP" ></param>
        ///
        public void Start(IPAddress bindIP, LoggerNames loggerName, string perfStatColInstanceName, CommandManagerType cmdMgrType, ConnectionManagerType conMgrType)
        {
            if (loggerName == null)
            {
                _loggerName = LoggerNames.SocketServerLogs;
            }
            else
            {
                _loggerName = loggerName;
            }
            InitializeLogging();


            if (ServiceConfiguration.PublishCountersToCacheHost)
            {
                _perfStatsColl = new CustomStatsCollector(cacheName, _serverPort);
            }
            else
            {
                _perfStatsColl = new PerfStatsCollector(cacheName, _serverPort);
            }


            _conManager = new ConnectionManager(_perfStatsColl);

            _conManager.Start(bindIP, _serverPort, _sendBuffer, _recieveBuffer, _logger, cmdMgrType, conMgrType);

            if (ConnectionManagerType.HostClient == conMgrType)
            {
                _hostClientConnectionManager = _conManager;
            }

            //We initialize PerfstatsCollector only for SocketServer's instance for client.

            //Management socket server has just DUMMY stats collector.
            if (conMgrType == ConnectionManagerType.HostClient)
            {
                _perfStatsColl.InitializePerfCounters();
            }
        }
Beispiel #11
0
 internal MessagingService(EventManager eventManager, StatisticsCounter perfStatsCollector, Cache cache)
 {
     PubSubManager = new MessageManager(eventManager, perfStatsCollector);
     PubSubManager.Initialize();
     CacheContainer = cache;
 }
Beispiel #12
0
 // For Counters
 public virtual void IncrementCounter(StatisticsCounter collector, long value)
 {
 }
 public ServiceCommandManager(StatisticsCounter perfStatsCollector)
     : base(perfStatsCollector)
 {
 }
Beispiel #14
0
 internal MessageManager(EventManager eventManager, StatisticsCounter perfStatsCollector)
 {
     _topicsDic          = new ConcurrentDictionary <TopicIdentity, Topic>();
     _eventManager       = eventManager;
     _perfStatsCollector = perfStatsCollector;
 }
Beispiel #15
0
 public DistributedQueue(StatisticsCounter statsCollector)
 {
     _perfStatsCollector = statsCollector;
 }
Beispiel #16
0
        /// <summary>
        /// it transfers the existing connection to a new connection without changing the object container
        /// </summary>
        /// <param name="container"></param>
        /// <param name="commandRecieved"></param>
        /// <param name="serverLost"></param>
        /// <param name="logs"></param>
        /// <param name="perfStatsCollector"></param>
        /// <param name="rspIntegraotr"></param>
        /// <param name="bindIP"></param>
        /// <param name="cacheName"></param>
        /// <param name="ipAddress"></param>
        /// <param name="cachePort"></param>
        /// <returns></returns>
        public bool SwitchTo(Broker container, OnCommandRecieved commandRecieved, OnServerLost serverLost, Logs logs, StatisticsCounter perfStatsCollector, ResponseIntegrator rspIntegraotr, string bindIP, string cacheName, IPAddress ipAddress, int cachePort)
        {
            int oldPort = Port;

            Initialize(container, commandRecieved, serverLost, logs, perfStatsCollector, rspIntegraotr, bindIP, cacheName);
            if (this.Connect(Address, cachePort))
            {
                _hostPort           = cachePort;
                this.Port           = oldPort;
                this._serverAddress = new Address(ipAddress, oldPort);
                return(true);
            }

            this.Port           = oldPort;
            this._serverAddress = new Address(ipAddress, oldPort);

            return(false);
        }
Beispiel #17
0
 internal Connection(Broker container, OnCommandRecieved commandRecieved, OnServerLost serverLost, Logs logs, StatisticsCounter perfStatsCollector, ResponseIntegrator rspIntegraotr, string bindIP, string cacheName)
 {
     _connectionStatusLatch = new Latch(ConnectionStatus.Disconnected);
     Initialize(container, commandRecieved, serverLost, logs, perfStatsCollector, rspIntegraotr, bindIP, cacheName);
 }
Beispiel #18
0
 public RequestLogManager(StatisticsCounter statsCollector)
 {
     _statsCollector = statsCollector;
 }