Ejemplo n.º 1
0
 /// <summary>
 /// Initializes the Instrumentation component
 /// </summary>
 /// <param name="performanceMonitorConfig">Component that contains the list of performance counters and default performance counter</param>
 public Instrumentation(IDictionary<string, ICounter> performanceMonitorConfig, ICounter defaultCounter)
 {
     this.counterCollection = performanceMonitorConfig;
     this.defaultCounter = defaultCounter;
     this.Register(this.counterCollection.Values);
     this.Register(this.defaultCounter);
 }
Ejemplo n.º 2
0
		protected NodeBase(ICluster owner, IPEndPoint endpoint, IFailurePolicy failurePolicy, ISocket socket)
		{
			this.owner = owner;
			this.endpoint = endpoint;
			this.socket = socket;
			this.failurePolicy = failurePolicy;
			this.name = endpoint.ToString();

			failLock = new Object();
			writeQueue = new ConcurrentQueue<Data>();
			readQueue = new Queue<Data>();

			mustReconnect = true;
			IsAlive = true;

			counterEnqueuePerSec = Metrics.Meter("node write enqueue/sec", endpoint.ToString(), Interval.Seconds);
			counterDequeuePerSec = Metrics.Meter("node write dequeue/sec", endpoint.ToString(), Interval.Seconds);
			counterOpReadPerSec = Metrics.Meter("node op read/sec", endpoint.ToString(), Interval.Seconds);
			counterWriteQueue = Metrics.Counter("write queue length", endpoint.ToString());
			counterReadQueue = Metrics.Counter("read queue length", endpoint.ToString());

			counterWritePerSec = Metrics.Meter("node write/sec", endpoint.ToString(), Interval.Seconds);
			counterErrorPerSec = Metrics.Meter("node in error/sec", endpoint.ToString(), Interval.Seconds);
			counterItemCount = Metrics.Counter("commands", endpoint.ToString());
			gaugeSendSpeed = Metrics.Gauge("send speed", endpoint.ToString());
		}
 /// <summary>
 /// Initializes a new instance of the <see cref="RollbackMessageDecorator" /> class.
 /// </summary>
 /// <param name="metrics">The metrics factory.</param>
 /// <param name="handler">The handler.</param>
 /// <param name="connectionInformation">The connection information.</param>
 public RollbackMessageDecorator(IMetrics metrics,
     IRollbackMessage handler,
     IConnectionInformation connectionInformation)
 {
     var name = handler.GetType().Name;
     _rollbackCounter = metrics.Counter($"{connectionInformation.QueueName}.{name}.RollbackCounter", Units.Items);
     _handler = handler;
 }
 public PerformanceCounterInfo(string name, PerformanceCounter performanceCounters, ICounter counter)
 {
     _name = name;
     _performanceCounters = performanceCounters;
     _alias = counter.Alias;
     _fieldName = counter.FieldName;
     _tags = (counter.Tags ?? new List<ITag>()).ToList();
     _max = counter.Max;
 }
 public PerformanceCounterInfo(PerformanceCounter performanceCounter, ICounter counter)
     : this(null, performanceCounter, counter)
 {
     _name = counter.Name;
     if (_name == "*" && performanceCounter != null)
     {
         _name = performanceCounter.InstanceName;
     }
 }
        /// <summary>
        /// Initializes a new instance of the <see cref="IClearExpiredMessages" /> class.
        /// </summary>
        /// <param name="metrics">The metrics factory.</param>
        /// <param name="handler">The handler.</param>
        /// <param name="connectionInformation">The connection information.</param>
        public ClearExpiredMessagesDecorator(IMetrics metrics,
                                             IClearExpiredMessages handler,
                                             IConnectionInformation connectionInformation)
        {
            var name = "ClearExpiredMessages";

            _timer   = metrics.Timer($"{connectionInformation.QueueName}.{name}.ClearMessages.ResetTimer", Units.Calls);
            _counter = metrics.Counter($"{connectionInformation.QueueName}.{name}.ClearMessages.ResetCounter", Units.Items);
            _handler = handler;
        }
Ejemplo n.º 7
0
 public QuestTarget(ICounter counter, int questid, QuestPeriod period, int max, int sharedwith = 0, string description = "")
 {
     Counter = counter;
     counter.Increased += Increase;
     QuestId = questid;
     Period = period;
     Progress = new LimitedValue(0, max);
     Description = description;
     sharedwithid = sharedwith;
 }
        public CounterDataCount(ICounter counter)
        {
            var category = PerformanceCounterCategory.GetCategories().First(cat => cat.CategoryName == counter.CategoryName);

            Counter = category.GetCounters().FirstOrDefault(c => c.CounterName == counter.Name);
            if (Counter != null)
            {
                Counter.ReadOnly = false;
            }
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="QueueCreationDecorator" /> class.
        /// </summary>
        /// <param name="metrics">The metrics factory.</param>
        /// <param name="handler">The handler.</param>
        /// <param name="connectionInformation">The connection information.</param>
        public ResetHeartBeatDecorator(IMetrics metrics,
                                       IResetHeartBeat handler,
                                       IConnectionInformation connectionInformation)
        {
            var name = "ResetHeartBeat";

            _timer   = metrics.Timer($"{connectionInformation.QueueName}.{name}.ResetTimer", Units.Calls);
            _counter = metrics.Counter($"{connectionInformation.QueueName}.{name}.ResetCounter", Units.Items);
            _handler = handler;
        }
        public virtual double WeightFeatureProduct(ICounter <string> features)
        {
            double product = 0;

            foreach (KeyValuePair <string, double> feature in features.EntrySet())
            {
                product += feature.Value * weights.GetCount(feature.Key);
            }
            return(product);
        }
Ejemplo n.º 11
0
 public QuestTarget(ICounter counter, int questid, QuestPeriod period, int max, int sharedwith = 0, string description = "")
 {
     Counter            = counter;
     counter.Increased += Increase;
     QuestId            = questid;
     Period             = period;
     Progress           = new LimitedValue(0, max);
     Description        = description;
     sharedwithid       = sharedwith;
 }
Ejemplo n.º 12
0
        public async Task <IActionResult> About()
        {
            ICounter counter = ServiceProxy.Create <ICounter>(new Uri("fabric:/Application1/StatefulSvc"), new ServicePartitionKey(0));

            long count = await counter.GetCountAsync();

            ViewData["Message"] = count.ToString();

            return(View());
        }
        private static ICounter <string> GetConjunction(ICounter <string> original, string suffix)
        {
            ICounter <string> conjuction = new ClassicCounter <string>();

            foreach (KeyValuePair <string, double> e in original.EntrySet())
            {
                conjuction.IncrementCount(e.Key + suffix, e.Value);
            }
            return(conjuction);
        }
 public virtual void AddAll(ITwoDimensionalCounterInterface <K1, K2> c)
 {
     foreach (K1 key in c.FirstKeySet())
     {
         ICounter <K2>       inner   = c.GetCounter(key);
         ClassicCounter <K2> myInner = GetCounter(key);
         Counters.AddInPlace(myInner, inner);
         total += inner.TotalCount();
     }
 }
 /// <summary>
 /// Initializes a counter publisher.
 /// </summary>
 /// <param name="counterSamplePublisher">The counter publisher.</param>
 /// <param name="counterSet">An object providing counter instance members.</param>
 /// <param name="memberList">The member list.</param>
 /// <param name="counterSetName">Name of the counter set.</param>
 private static void InitializeCounterPublisher(CounterSamplePublisher counterSamplePublisher, object counterSet, IEnumerable<MemberInfo> memberList, string counterSetName)
 {
     foreach (var member in memberList)
     {
         PublishCounterAttribute attribute = GetCounterAttribute(member);
         if (attribute != null)
         {
             if (!IsCounterType(member))
             {
                 if (log.IsWarnEnabled)
                 {
                     log.WarnFormat("PublishCounterAttribute applied to member '{0}' which is not a ICounter type.", member.Name);
                 }
             }
             else
             {
                 ICounter counter = (ICounter)GetMemberValue(counterSet, member);
                 if (counter == null)
                 {
                     if (log.IsWarnEnabled)
                     {
                         log.WarnFormat("Counter for member {0} has not been initialized.", member.Name);
                     }
                 }
                 else if (counter.CounterType != CounterType.Undefined)
                 {
                     string name = GetCounterName(member, attribute, counterSetName);
                     counterSamplePublisher.AddCounter(counter, name);
                     if (log.IsDebugEnabled)
                     {
                         log.DebugFormat("Added counter '{0}' to counter publisher.", name);
                     }
                 }
             }
         }
         else
         {
             CounterSetAttribute attribute2 = GetCounterSetAttribute(member);
             if (attribute2 != null)
             {
                 if (GetMemberValue(counterSet, member) == null)
                 {
                     if (log.IsWarnEnabled)
                     {
                         log.WarnFormat("CounterSet for member {0} has not been initialized.", member.Name);
                     }
                 }
                 else
                 {
                     InitializeCounterPublisher(counterSamplePublisher, counterSet, GetCounterSetName(member, attribute2, counterSetName));
                 }
             }
         }
     }
 }
Ejemplo n.º 16
0
        // static class
        /// <exception cref="System.IO.IOException"/>
        public static void Main(string[] args)
        {
            bool outputLowercase = true;

            foreach (string arg in args)
            {
                if (Sharpen.Runtime.EqualsIgnoreCase(arg, "-noLowercase"))
                {
                    outputLowercase = false;
                    continue;
                }
                // everything else is considered a filename
                BufferedReader @in = new BufferedReader(new FileReader(arg));
                for (string line; (line = @in.ReadLine()) != null;)
                {
                    string[] toks = line.Split(" ");
                    foreach (string tok in toks)
                    {
                        string            lctok   = tok.ToLower();
                        ICounter <string> counter = map[lctok];
                        if (counter == null)
                        {
                            counter    = new ClassicCounter <string>();
                            map[lctok] = counter;
                        }
                        counter.IncrementCount(tok);
                    }
                }
            }
            foreach (string k in map.Keys)
            {
                ICounter <string> counter = map[k];
                string            maxstr  = string.Empty;
                int maxcount = -1;
                foreach (string str in counter.KeySet())
                {
                    int count = (int)counter.GetCount(str);
                    if (count > maxcount)
                    {
                        maxstr   = str;
                        maxcount = count;
                    }
                }
                highest[k] = maxstr;
            }
            foreach (string k_1 in highest.Keys)
            {
                string cased = highest[k_1];
                if (!outputLowercase && k_1.Equals(cased))
                {
                    continue;
                }
                System.Console.Out.Printf("%s\t%s\n", k_1, cased);
            }
        }
Ejemplo n.º 17
0
        public CounterExtensionsShould()
        {
            _value        = 100d;
            _counterLabel = new CounterLabel("abc");
            _counterLabel.IncrementTo(_value);

            _counter = new Counter <CounterExtensionsShould>(Fixture.Create <string>(), null, new[]
            {
                _counterLabel
            });
        }
 public AssetFetcher(OMV.GridClient grid)
 {
     m_client = grid;
     // m_client.Assets.OnAssetReceived += new OMV.AssetManager.AssetReceivedCallback(Assets_OnAssetReceived);
     m_requests            = new Dictionary <string, TRequest>();
     m_outstandingRequests = new List <TRequest>();
     m_stats               = new StatisticManager("AssetFetcher");
     m_totalRequests       = m_stats.GetCounter("TotalRequests");
     m_duplicateRequests   = m_stats.GetCounter("DuplicateRequests");
     m_requestsForExisting = m_stats.GetCounter("RequestsForExistingAsset");
 }
Ejemplo n.º 19
0
        public Parser(ICounter counter, IParser parser, ILogger logger)
        {
            // save the logger
            _logger = logger ?? throw new ArgumentNullException(nameof(logger));

            // save the files/folders parser
            _parser = parser ?? throw new ArgumentNullException(nameof(parser));

            // our performance counter.
            _counter = counter ?? throw new ArgumentNullException(nameof(counter));
        }
Ejemplo n.º 20
0
 public AssetFetcher(OMV.GridClient grid)
 {
     m_client = grid;
     // m_client.Assets.OnAssetReceived += new OMV.AssetManager.AssetReceivedCallback(Assets_OnAssetReceived);
     m_requests = new Dictionary<string, TRequest>();
     m_outstandingRequests = new List<TRequest>();
     m_stats = new StatisticManager("AssetFetcher");
     m_totalRequests = m_stats.GetCounter("TotalRequests");
     m_duplicateRequests = m_stats.GetCounter("DuplicateRequests");
     m_requestsForExisting = m_stats.GetCounter("RequestsForExistingAsset");
 }
Ejemplo n.º 21
0
        public void AddOrReplace(ICounter counter)
        {
            var counters = GetAllCounters().ToList();

            if (counters.Contains(counter))
            {
                counters.Remove(counter);
            }
            counters.Add(counter);
            WriteToFile(counters);
        }
Ejemplo n.º 22
0
        /// <seealso cref="Classify(Edu.Stanford.Nlp.Util.ICoreMap)"/>
        public virtual SentimentClass Classify(string text)
        {
            Annotation ann = new Annotation(text);

            pipeline.Get().Annotate(ann);
            ICoreMap          sentence = ann.Get(typeof(CoreAnnotations.SentencesAnnotation))[0];
            ICounter <string> features = Featurize(sentence);
            RVFDatum <SentimentClass, string> datum = new RVFDatum <SentimentClass, string>(features);

            return(impl.ClassOf(datum));
        }
Ejemplo n.º 23
0
        /// <inheritdoc />
        public ICounter CreateCounter(string name, string help, bool delayPublish, string[] labels)
        {
            var counters = new ICounter[_providers.Count];

            for (var index = 0; index < counters.Length; index++)
            {
                counters[index] = _providers.ElementAt(index).Value.CreateCounter(name, help, delayPublish, labels);
            }

            return(counters.Length == 1 ? counters[0] : new Counter(counters, name, help, labels));
        }
Ejemplo n.º 24
0
 private CandidatePhrase(string phrase, string lemma, ICounter <string> features)
 {
     if (phrase.IsEmpty())
     {
         Sharpen.Runtime.PrintStackTrace(new Exception("Creating empty candidatePhrase"), System.Console.Out);
     }
     this.phrase      = phrase;
     this.phraseLemma = lemma;
     this.features    = features;
     this.hashCode    = phrase.GetHashCode();
 }
Ejemplo n.º 25
0
        public virtual double ProbabilityOfTrue(ICounter <string> features)
        {
            DecisionTreeNode cur = root;

            while (!cur.IsLeaf())
            {
                double value = features.GetCount(featureIndex.Get(cur.idx));
                cur = (value < cur.split) ? cur.children[0] : cur.children[1];
            }
            return(cur.split);
        }
Ejemplo n.º 26
0
 public CounterPageViewModel(ICounter counter)
 {
     _counter = counter;
     _counter.PropertyChanged += (sender, args) =>
     {
         if (args.PropertyName == "Value")
         {
             Value = _counter.Value;
         }
     };
 }
Ejemplo n.º 27
0
        /// <summary>
        /// Initializes a new instance of the <see cref="WorkGroupWithItem"/> class.
        /// </summary>
        /// <param name="sourceGroup">The source group.</param>
        /// <param name="threadGroup">The thread group.</param>
        /// <param name="metricCounter">A counter for tracking how many items are being processed</param>
        public WorkGroupWithItem(IWorkGroup sourceGroup, BulkheadPolicy threadGroup, ICounter metricCounter)
        {
            Guard.NotNull(() => sourceGroup, sourceGroup);
            Guard.NotNull(() => threadGroup, threadGroup);
            Guard.NotNull(() => metricCounter, metricCounter);

            GroupInfo     = sourceGroup;
            Group         = threadGroup;
            MaxWorkItems  = GroupInfo.ConcurrencyLevel + GroupInfo.MaxQueueSize;
            MetricCounter = metricCounter;
        }
            public State(ClustererDataLoader.ClustererDoc doc)
            {
                currentDocId      = doc.id;
                this.doc          = doc;
                this.hashedScores = new Dictionary <Clusterer.MergeKey, bool>();
                this.hashedCosts  = new Dictionary <long, double>();
                this.clusters     = new List <Clusterer.Cluster>();
                this.hash         = 0;
                mentionToCluster  = new Dictionary <int, Clusterer.Cluster>();
                foreach (int m in doc.mentions)
                {
                    Clusterer.Cluster c = new Clusterer.Cluster(m);
                    clusters.Add(c);
                    mentionToCluster[m] = c;
                    hash ^= c.hash * 7;
                }
                IList <Pair <int, int> >    allPairs = new List <Pair <int, int> >(doc.classificationScores.KeySet());
                ICounter <Pair <int, int> > scores   = UseRanking ? doc.rankingScores : doc.classificationScores;

                allPairs.Sort(null);
                int i = 0;

                for (i = 0; i < allPairs.Count; i++)
                {
                    double score = scores.GetCount(allPairs[i]);
                    if (score < MinPairwiseScore && i > MinPairs)
                    {
                        break;
                    }
                    if (i >= EarlyStopThreshold && i / score > EarlyStopVal)
                    {
                        break;
                    }
                }
                mentionPairs = allPairs.SubList(0, i);
                ICounter <int> seenAnaphors    = new ClassicCounter <int>();
                ICounter <int> seenAntecedents = new ClassicCounter <int>();

                globalFeatures = new List <Clusterer.GlobalFeatures>();
                for (int j = 0; j < allPairs.Count; j++)
                {
                    Pair <int, int>          mentionPair = allPairs[j];
                    Clusterer.GlobalFeatures gf          = new Clusterer.GlobalFeatures();
                    gf.currentIndex = j;
                    gf.anaphorSeen  = seenAnaphors.ContainsKey(mentionPair.second);
                    gf.size         = mentionPairs.Count;
                    gf.docSize      = doc.mentions.Count / 300.0;
                    globalFeatures.Add(gf);
                    seenAnaphors.IncrementCount(mentionPair.second);
                    seenAntecedents.IncrementCount(mentionPair.first);
                }
                currentIndex = 0;
                SetClusters();
            }
Ejemplo n.º 29
0
        public void AssertCanRegisterInstanceGlobal()
        {
            string serviceName = "Counter";

            Container.RegisterGlobalInstance <ICounter>(new Counter(serviceName));
            ICounter counter = Container.ResolveGlobalInstance <ICounter>();

            Assert.AreEqual($"{serviceName}: 0", counter.GetStatus());

            Container.RemoveGlobalInstanceMapping <ICounter>();
        }
Ejemplo n.º 30
0
 public DummyMetrics(IMetrics metrics)
 {
     _runs = metrics.Counter()
             .Name("myservice_dummy_runs")
             .Help("Number of times the dummy worker ran")
             .Register();
     _runDurations = metrics.Histogram()
                     .Name("myservice_dummy_duration_seconds")
                     .Help("Average duration of a dummy worker run")
                     .Register();
 }
        public void CounterValueIsIncreased()
        {
            var tags = new Dictionary <string, string> {
                { "foo", "bar" }
            };

            NoopMetricsFactory metricsFactory = NoopMetricsFactory.Instance;
            ICounter           counter        = metricsFactory.CreateCounter("thecounter", tags);

            counter.Inc(1);
        }
Ejemplo n.º 32
0
 public ContactMetrics(IMetrics metrics)
 {
     _writeDurations = metrics.Histogram()
                       .Name("myservice_contact_write_duration_seconds")
                       .Help("Average duration of persistence write operations for contacts")
                       .Register();
     _pokes = metrics.Counter()
              .Name("myservice_contact_pokes_total")
              .Help("Number of times contacts were poked")
              .Register();
 }
Ejemplo n.º 33
0
        /// <summary>打开客户端</summary>
        public virtual Boolean Open()
        {
            if (Active)
            {
                return(true);
            }
            lock (Root)
            {
                if (Active)
                {
                    return(true);
                }

                var ss = Servers;
                if (ss == null || ss.Length == 0)
                {
                    throw new ArgumentNullException(nameof(Servers), "未指定服务端地址");
                }

                if (Encoder == null)
                {
                    Encoder = new JsonEncoder();
                }
                //if (Encoder == null) Encoder = new BinaryEncoder();
                //if (Handler == null) Handler = new ApiHandler { Host = this };

                // 集群
                Cluster = InitCluster();
                WriteLog("集群:{0}", Cluster);

                Encoder.Log = EncoderLog;

                // 控制性能统计信息
                var ms = StatPeriod * 1000;
                if (ms > 0)
                {
                    if (StatSend == null)
                    {
                        StatSend = new PerfCounter();
                    }
                    if (StatReceive == null)
                    {
                        StatReceive = new PerfCounter();
                    }

                    _Timer = new TimerX(DoWork, null, ms, ms)
                    {
                        Async = true
                    };
                }

                return(Active = true);
            }
        }
 /// <summary>
 /// Initializes a new instance of the type
 /// </summary>
 /// <param name="containerName">The name of the container to use in logging operations</param>
 /// <param name="diagnosticsConfiguration">A diagnostics instance to use when instantiating the container</param>
 /// <param name="probeConfiguration">The availability and liveness probe configuration</param>
 /// <param name="startPosition">The event position to start processing if no checkpoint is found for the partition</param>
 protected LegacyProcessorBase(string containerName, DiagnosticsConfiguration diagnosticsConfiguration, IProbeConfiguration probeConfiguration, EventPosition startPosition) : base(containerName, probeConfiguration, diagnosticsConfiguration)
 {
     _loggerFactory                   = diagnosticsConfiguration.LoggerFactory;
     _startPosition                   = startPosition;
     _iterationCounter                = diagnosticsConfiguration.MetricFactory.CreateCounter("pro_iteration_counter", "Counts the number of iterations the demo container has performed.", false, new string[0]);
     _scaleEventCounter               = diagnosticsConfiguration.MetricFactory.CreateCounter("pro_scale_event_counter", "Counts the number of times a scale event has occurred.", false, new string[0]);
     _healthProbeCounter              = diagnosticsConfiguration.MetricFactory.CreateCounter("pro_health_counter", "Counts the number of times the liveness probe endpoint has been accessed since the start of the container.", false, new string[0]);
     _healthProbeFailureCounter       = diagnosticsConfiguration.MetricFactory.CreateCounter("pro_health_failure_counter", "Counts the number of times the liveness probe endpoint has been accessed and failed since the start of the container.", false, new string[0]);
     _availabilityProbeCounter        = diagnosticsConfiguration.MetricFactory.CreateCounter("pro_availability_counter", "Counts the number of times the readiness probe endpoint has been accessed since the start of the container.", false, new string[0]);
     _availabilityProbeFailureCounter = diagnosticsConfiguration.MetricFactory.CreateCounter("pro_availability_failure_counter", "Counts the number of times the readiness probe endpoint has been accessed and failed since the start of the container.", false, new string[0]);
 }
Ejemplo n.º 35
0
        /// <summary>
        /// Initializes a new instance of the <see cref="WorkGroupWithItem"/> class.
        /// </summary>
        /// <param name="sourceGroup">The source group.</param>
        /// <param name="threadGroup">The thread group.</param>
        /// <param name="metricCounter">A counter for tracking how many items are being processed</param>
        public WorkGroupWithItem(IWorkGroup sourceGroup, IWorkItemsGroup threadGroup, ICounter metricCounter)
        {
            Guard.NotNull(() => sourceGroup, sourceGroup);
            Guard.NotNull(() => threadGroup, threadGroup);
            Guard.NotNull(() => metricCounter, metricCounter);

            GroupInfo = sourceGroup;
            Group = threadGroup;
            MaxWorkItems = GroupInfo.ConcurrencyLevel + GroupInfo.MaxQueueSize;
            MetricCounter = metricCounter;
        }
        public TicketBoughtEventHandler(ILogger <TicketBoughtEventHandler> logger,
                                        ICounter <IReceivedEvents> receivedEventsCounter,
                                        ICounter <IUniqueReceivedEvents> uniqueReceivedEventsCounter,
                                        EventIdsRepository eventIdsRepository)
        {
            _logger = logger;

            _receivedEventsCounter       = receivedEventsCounter;
            _uniqueReceivedEventsCounter = uniqueReceivedEventsCounter;
            _eventIdsRepository          = eventIdsRepository;
        }
Ejemplo n.º 37
0
        /// <summary>结束计时</summary>
        /// <param name="counter"></param>
        /// <param name="startTicks"></param>
        public static void StopCount(this ICounter counter, Int64?startTicks)
        {
            if (counter == null || startTicks == null)
            {
                return;
            }

            var ticks = Stopwatch.GetTimestamp() - startTicks.Value;

            counter.Increment(1, (Int64)(ticks * tickFrequency / 10));
        }
 public ExtractedPhrase(int startIndex, int endIndex, SemgrexPattern pattern, string value, double weight, string articleId, int sentId, ICounter <string> features)
 {
     this.startIndex = startIndex;
     this.endIndex   = endIndex;
     this.pattern    = pattern;
     this.value      = value;
     this.confidence = weight;
     this.articleId  = articleId;
     this.sentId     = sentId;
     this.features   = features;
 }
        /// <summary>
        /// Initializes a new instance of the <see cref="DelayedProcessingActionDecorator" /> class.
        /// </summary>
        /// <param name="metrics">The metrics factory.</param>
        /// <param name="handler">The handler.</param>
        /// <param name="connectionInformation">The connection information.</param>
        public DelayedProcessingActionDecorator(IMetrics metrics,
            IDelayedProcessingAction handler,
            IConnectionInformation connectionInformation)
        {
            Guard.NotNull(() => metrics, metrics);
            Guard.NotNull(() => handler, handler);

            var name = handler.GetType().Name;
            _timer = metrics.Timer($"{connectionInformation.QueueName}.{name}.RunTimer", Units.Calls);
            _counter = metrics.Counter($"{connectionInformation.QueueName}.{name}.RunCounter", Units.Items);
            _handler = handler;
        }
Ejemplo n.º 40
0
        public bool Add(ICounter counter)
        {
            if (counter == null)
                throw new ArgumentNullException("counter");

            lock (countLock) {
                if (counters.ContainsKey(counter.Name))
                    return false;

                counters[counter.Name] = counter;
                return true;
            }
        }
Ejemplo n.º 41
0
        public ICounter Merge(ICounter counter)
        {
            if (counter == null)
            {
                throw new ArgumentNullException(nameof(counter));
            }

            for (var i = 0; i < _nodes; i++)
            {
                _payload.AddOrUpdate(i, key => counter[i], (key, value) => Math.Max(value, counter[i]));
            }

            return this;
        }
Ejemplo n.º 42
0
        public ICounter Merge(ICounter counter)
        {
            if (counter == null)
            {
                throw new ArgumentNullException(nameof(counter));
            }

            for (var i = 0; i < _nodes; i++)
            {
                _payload[i] = Math.Max(_payload[i], counter[i]);
            }

            return this;
        }
Ejemplo n.º 43
0
        /// <summary>
        /// Initializes a new instance of the <see cref="SmartThreadPoolTaskScheduler"/> class.
        /// </summary>
        /// <param name="configuration">The configuration.</param>
        /// <param name="waitForFreeThread">The wait for free thread.</param>
        /// <param name="metrics">the metrics factory</param>
        public SmartThreadPoolTaskScheduler(ITaskSchedulerConfiguration configuration, 
            IWaitForEventOrCancelThreadPool waitForFreeThread,
            IMetrics metrics)
        {
            Guard.NotNull(() => configuration, configuration);
            Guard.NotNull(() => waitForFreeThread, waitForFreeThread);
            Guard.NotNull(() => metrics, metrics);

            _configuration = configuration;
            _waitForFreeThread = waitForFreeThread;
            _metrics = metrics;
            _groups = new ConcurrentDictionary<IWorkGroup, WorkGroupWithItem>();
            _clients = new ConcurrentDictionary<int, int>();

            var name = GetType().Name;
            _taskCounter = metrics.Counter($"{name}.TaskCounter", Units.Items);
            _clientCounter = metrics.Counter($"{name}.ClientCounter", Units.Items);
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="LinqCompileCacheDecorator" /> class.
        /// </summary>
        /// <param name="handler">The handler.</param>
        /// <param name="cache">The cache.</param>
        /// <param name="cachePolicy">The cache policy.</param>
        /// <param name="metrics">The metrics.</param>
        /// <param name="connectionInformation">The connection information.</param>
        public LinqCompileCacheDecorator(
            ILinqCompiler handler,
            ObjectCache cache,
            ICachePolicy<ILinqCompiler> cachePolicy,
            IMetrics metrics,
             IConnectionInformation connectionInformation)
        {
            _handler = handler;
            _cache = cache;
            _itemPolicy = new CacheItemPolicy {SlidingExpiration = cachePolicy.SlidingExpiration};
            var name = handler.GetType().Name;

            _counterActionCacheHit = metrics.Counter($"{connectionInformation.QueueName}.{name}.LinqActionCacheHitCounter", Units.Items);
            _counterActionCacheMiss = metrics.Counter($"{connectionInformation.QueueName}.{name}.LinqActionCacheMissCounter", Units.Items);
            _counterActionCacheUnique = metrics.Counter($"{connectionInformation.QueueName}.{name}.LinqActionUniqueFlaggedCounter", Units.Items);

            _counterFunctionCacheHit = metrics.Counter($"{connectionInformation.QueueName}.{name}.LinqFunctionCacheHiCountert", Units.Items);
            _counterFunctionCacheMiss = metrics.Counter($"{connectionInformation.QueueName}.{name}.LinqFunctionCacheMissCounter", Units.Items);
            _counterFunctionCacheUnique = metrics.Counter($"{connectionInformation.QueueName}.{name}.LinqFunctionUniqueFlaggedCounter", Units.Items);

        }
Ejemplo n.º 45
0
 public PollingSender(ISender sender, ICounter counter)
 {
     Init(sender, counter);
 }
Ejemplo n.º 46
0
            private void Init(ISender sender, ICounter counter)
            {
                _log = String.Empty;
                _buffer = new byte[8];
                _sender = sender;
                _counter = counter;
                _TW = new TimerWrapper();
                _TW.__Tick += new EventHandler(_TT___Tick);
                _TW.__Stopped += new NoParams(_TT___Stopped);
                if (_sender == null)
                {
                    throw new Exception("Attempt to init a pollimg-sender thread with null sender device.");
                }

                if (_counter == null)
                {
                    throw new Exception("Attempt to init a pollimg-sender thread with null polling device.");
                }
            }
 public static SurrogateForICounter Convert(ICounter value)
 {
     if (value == null) return null;
     return new SurrogateForICounter { Target = ((CounterRef)value).Target };
 }
Ejemplo n.º 48
0
        private StatsTableData PopulateStatsTableDataEntry(ICounter statsCounter)
        {
            string statValue = statsCounter.IsValueDelta ? statsCounter.GetDeltaString() : statsCounter.GetValueString();
            if ("0".Equals(statValue))
            {
                // Skip writing empty records
                return null;
            }

            counter++;
            var entry = new StatsTableData { StatValue = statValue };
            
            // We store the statistics grouped by an hour in the same partition and sorted by reverse ticks within the partition.
            // Since by default Azure table stores Entities in ascending order based on the Row Key - if we just used the current ticks
            // it would return the oldest entry first.
            // If we store the rows in the reverse order (some max value - current ticks), it will return the latest most recent entry first.
            // More details here:
            // http://gauravmantri.com/2012/02/17/effective-way-of-fetching-diagnostics-data-from-windows-azure-diagnostics-table-hint-use-partitionkey/
            // https://alexandrebrisebois.wordpress.com/2014/06/16/using-time-based-partition-keys-in-azure-table-storage/
            // https://stackoverflow.com/questions/1004698/how-to-truncate-milliseconds-off-of-a-net-datetime
            
            // Our format:
            // PartitionKey:  DeploymentId$ReverseTimestampToTheNearestHour 
            // RowKey:  ReverseTimestampToTheNearestSecond$Name$counter 

            var now = DateTime.UtcNow;
            // number of ticks remaining until the year 9683
            var ticks = DateTime.MaxValue.Ticks - now.Ticks;

            // partition the table according to the deployment id and hour
            entry.PartitionKey = string.Join("$", deploymentId, string.Format("{0:d19}", ticks - ticks % TimeSpan.TicksPerHour));
            var counterStr = String.Format("{0:000000}", counter);
            
            // order the rows latest-first in the table 
            entry.RowKey = string.Join("$", string.Format("{0:d19}", ticks), name, counterStr);
            entry.DeploymentId = deploymentId;
            entry.Time = now.ToString(DATE_TIME_FORMAT, CultureInfo.InvariantCulture); ;
            entry.Address = address;
            entry.Name = name;
            entry.HostName = myHostName;
            entry.Statistic = statsCounter.Name;
            entry.IsDelta = statsCounter.IsValueDelta;
            return entry;
        }
Ejemplo n.º 49
0
 public void ReportCounter(string name, ICounter value, Unit unit)
 {
 }
Ejemplo n.º 50
0
	    /**
	     * Setter for the counter.
	     */
	    virtual public void SetCounter(ICounter counter) {
		    this.counter = counter;
	    }
 private IEnumerable<PerformanceCounterInfo> GetPerformanceCounterInfos(ICounter counter)
 {
     return this.GetPerformanceCounters(counter.CategoryName, counter.CounterName, counter.InstanceName, counter.MachineName)
         .Select(p => new PerformanceCounterInfo(p, counter))
         .ToList();
 }
Ejemplo n.º 52
0
        private static void SetupDummyCounters()
        {
            useDummyCounters = true;

            ConnectedClients = new DummyCounter(connectedClients);
            FlushEventRoundTripTime = new DummyCounter(flusheventRoundtripTime);
            FlushEventsReceived = new DummyCounter(flusheventsReceivedSec);
            FlushOperationsSent = new DummyCounter("Flush Operations Sent / sec");
            ReceivedOperationResponse = new DummyCounter(receivedOperationResponsesSec);
            ReliableEventsReceived = new DummyCounter(reliableEventsReceivedSec);
            ReliableEventRoundTripTime = new DummyCounter(reliableEventRoundtripTime);
            ReliableOperationsSent = new DummyCounter(reliableOperationsSentSec);
            RoundTripTime = new DummyCounter(roundtripTime);
            RoundTripTimeVariance = new DummyCounter(roundtripTimeVariance);
            UnreliableEventRoundTripTime = new DummyCounter(unreliableEventRoundtripTime);
            UnreliableEventsReceived = new DummyCounter(unreliableEventsReceivedSec);
            UnreliableOperationsSent = new DummyCounter(unreliableOperationsSentSec);

            // Base counters:
            FlusheventRoundtripTimeBase = new DummyCounter(flushEventRoundtripTimeBase);
            ReliableEventRoundtripTimeBase = new DummyCounter(reliableEventRoundtripTimeBase);
            RoundtripTimeBase = new DummyCounter(roundtripTimeBase);
            RoundtripTimeVarianceBase = new DummyCounter(roundtripTimeVarianceBase);
            UnreliableEventRoundtripTimeBase = new DummyCounter(unreliableEventRoundtripTimeBase);
        }
Ejemplo n.º 53
0
        private static void SetupPerformanceCounters()
        {
            if (!PerformanceCounterCategory.Exists(CategoryName))
            {
                Category = PerformanceCounterCategory.Create(
                    CategoryName,
                    string.Empty,
                    PerformanceCounterCategoryType.MultiInstance,
                    new CounterCreationDataCollection(
                        new[]
                            {
                                new CounterCreationData(connectedClients, string.Empty, PerformanceCounterType.NumberOfItems64),
                                new CounterCreationData(flusheventRoundtripTime, string.Empty, PerformanceCounterType.AverageCount64),
                                new CounterCreationData(flushEventRoundtripTimeBase, string.Empty, PerformanceCounterType.AverageBase),
                                new CounterCreationData(flusheventsReceivedSec, string.Empty, PerformanceCounterType.RateOfCountsPerSecond64),
                                new CounterCreationData(flushoperationsSentSec, string.Empty, PerformanceCounterType.RateOfCountsPerSecond64),
                                new CounterCreationData(receivedOperationResponsesSec, string.Empty, PerformanceCounterType.RateOfCountsPerSecond64),
                                new CounterCreationData(reliableEventRoundtripTime, string.Empty, PerformanceCounterType.AverageCount64),
                                new CounterCreationData(reliableEventRoundtripTimeBase, string.Empty, PerformanceCounterType.AverageBase),
                                new CounterCreationData(reliableEventsReceivedSec, string.Empty, PerformanceCounterType.RateOfCountsPerSecond64),
                                new CounterCreationData(reliableOperationsSentSec, string.Empty, PerformanceCounterType.RateOfCountsPerSecond64),
                                new CounterCreationData(roundtripTime, string.Empty, PerformanceCounterType.AverageCount64),
                                new CounterCreationData(roundtripTimeBase, string.Empty, PerformanceCounterType.AverageBase),
                                new CounterCreationData(roundtripTimeVariance, string.Empty, PerformanceCounterType.AverageCount64),
                                new CounterCreationData(roundtripTimeVarianceBase, string.Empty, PerformanceCounterType.AverageBase),
                                new CounterCreationData(unreliableEventRoundtripTime, string.Empty, PerformanceCounterType.AverageCount64),
                                new CounterCreationData(unreliableEventRoundtripTimeBase, string.Empty, PerformanceCounterType.AverageBase),
                                new CounterCreationData(unreliableEventsReceivedSec, string.Empty, PerformanceCounterType.RateOfCountsPerSecond64),
                                new CounterCreationData(unreliableOperationsSentSec, string.Empty, PerformanceCounterType.RateOfCountsPerSecond64)
                            }));
            }
            else
            {
                var list = PerformanceCounterCategory.GetCategories();
                foreach (var c in list) if (c.CategoryName == CategoryName) Category = c;
            }

            var procId = Process.GetCurrentProcess().Id.ToString();
            ConnectedClientsTotal = GetPerformanceCounter(connectedClients, "_Total", false);
            ConnectedClients = new WindowsPerformanceCounter(GetPerformanceCounter(connectedClients, procId, true));
            FlushEventRoundTripTime = new WindowsPerformanceCounter(GetPerformanceCounter(flusheventRoundtripTime, "_Total", false));
            //                    new WindowsPerformanceCounter(
            //                        new PerformanceCounter(CategoryName, flusheventRoundtripTime, AppDomain.CurrentDomain.FriendlyName, false));
            FlushEventsReceived = new WindowsPerformanceCounter(GetPerformanceCounter(flusheventsReceivedSec, "_Total", false));
            //                    new WindowsPerformanceCounter(
            //                        new PerformanceCounter(CategoryName, flusheventsReceivedSec, AppDomain.CurrentDomain.FriendlyName, false));
            FlushOperationsSent = new WindowsPerformanceCounter(GetPerformanceCounter(flushoperationsSentSec, "_Total", false));
            //                    new WindowsPerformanceCounter(
            //                        new PerformanceCounter(CategoryName, flushoperationsSentSec, AppDomain.CurrentDomain.FriendlyName, false));
            ReceivedOperationResponse = new WindowsPerformanceCounter(GetPerformanceCounter(receivedOperationResponsesSec, "_Total", false));
            //                    new WindowsPerformanceCounter(
            //                        new PerformanceCounter(CategoryName, receivedOperationResponsesSec, AppDomain.CurrentDomain.FriendlyName, false));
            ReliableEventsReceived = new WindowsPerformanceCounter(GetPerformanceCounter(reliableEventsReceivedSec, "_Total", false));
            //                    new WindowsPerformanceCounter(
            //                        new PerformanceCounter(CategoryName, reliableEventsReceivedSec, AppDomain.CurrentDomain.FriendlyName, false));
            ReliableEventRoundTripTime = new WindowsPerformanceCounter(GetPerformanceCounter(reliableEventRoundtripTime, "_Total", false));
            //                    new WindowsPerformanceCounter(
            //                        new PerformanceCounter(CategoryName, reliableEventRoundtripTime, AppDomain.CurrentDomain.FriendlyName, false));
            ReliableOperationsSent = new WindowsPerformanceCounter(GetPerformanceCounter(reliableOperationsSentSec, "_Total", false));
            //                    new WindowsPerformanceCounter(
            //                        new PerformanceCounter(CategoryName, reliableOperationsSentSec, AppDomain.CurrentDomain.FriendlyName, false));
            RoundTripTime = new WindowsPerformanceCounter(GetPerformanceCounter(roundtripTime, "_Total", false));
            //                    new WindowsPerformanceCounter(
            //                        new PerformanceCounter(CategoryName, roundtripTime, AppDomain.CurrentDomain.FriendlyName, false));
            RoundTripTimeVariance = new WindowsPerformanceCounter(GetPerformanceCounter(roundtripTimeVariance, "_Total", false));
            //                    new WindowsPerformanceCounter(
            //                        new PerformanceCounter(CategoryName, roundtripTimeVariance, AppDomain.CurrentDomain.FriendlyName, false));
            UnreliableEventRoundTripTime = new WindowsPerformanceCounter(GetPerformanceCounter(unreliableEventRoundtripTime, "_Total", false));
            //                    new WindowsPerformanceCounter(
            //                        new PerformanceCounter(CategoryName, unreliableEventRoundtripTime, AppDomain.CurrentDomain.FriendlyName, false));
            UnreliableEventsReceived = new WindowsPerformanceCounter(GetPerformanceCounter(unreliableEventsReceivedSec, "_Total", false));
            //                    new WindowsPerformanceCounter(
            //                        new PerformanceCounter(CategoryName, unreliableEventsReceivedSec, AppDomain.CurrentDomain.FriendlyName, false));
            UnreliableOperationsSent = new WindowsPerformanceCounter(GetPerformanceCounter(unreliableOperationsSentSec, "_Total", false));
            //                    new WindowsPerformanceCounter(
            //                        new PerformanceCounter(CategoryName, unreliableOperationsSentSec, AppDomain.CurrentDomain.FriendlyName, false));

            // base counters:
            FlusheventRoundtripTimeBase = new WindowsPerformanceCounter(GetPerformanceCounter(flushEventRoundtripTimeBase, "_Total", false));
            //                    new WindowsPerformanceCounter(
            //                        new PerformanceCounter(CategoryName, flushEventRoundtripTimeBase, AppDomain.CurrentDomain.FriendlyName, false));
            ReliableEventRoundtripTimeBase = new WindowsPerformanceCounter(GetPerformanceCounter(reliableEventRoundtripTimeBase, "_Total", false));
            //                new WindowsPerformanceCounter(
            //                        new PerformanceCounter(CategoryName, reliableEventRoundtripTimeBase, AppDomain.CurrentDomain.FriendlyName, false));
            RoundtripTimeBase = new WindowsPerformanceCounter(GetPerformanceCounter(roundtripTimeBase, "_Total", false));
            //                new WindowsPerformanceCounter(
            //                        new PerformanceCounter(CategoryName, roundtripTimeBase, AppDomain.CurrentDomain.FriendlyName, false));
            RoundtripTimeVarianceBase = new WindowsPerformanceCounter(GetPerformanceCounter(roundtripTimeVarianceBase, "_Total", false));
            //                new WindowsPerformanceCounter(
            //                        new PerformanceCounter(CategoryName, roundtripTimeVarianceBase, AppDomain.CurrentDomain.FriendlyName, false));
            UnreliableEventRoundtripTimeBase = new WindowsPerformanceCounter(GetPerformanceCounter(unreliableEventRoundtripTimeBase, "_Total", false));
            //                new WindowsPerformanceCounter(
            //                        new PerformanceCounter(CategoryName, unreliableEventRoundtripTimeBase, AppDomain.CurrentDomain.FriendlyName, false));

            TotalTimer = new Timer(new TimerCallback(UpdateTotalCounters), null, 1000, 0);
        }
Ejemplo n.º 54
0
 public void SetSelf(ICounter self)
 {
     this.self = self;
 }
Ejemplo n.º 55
0
        private SqlCommand ConvertToStatisticsRow(ICounter counter, SqlCommand command)
        {
            string statValue = counter.IsValueDelta ? counter.GetDeltaString() : counter.GetValueString();
            if ("0".Equals(statValue)) return null; // Skip writing empty records

            var name = (isSilo) ? siloName : clientId;
            var id = (isSilo) ? siloAddress.ToLongString() : string.Format("{0}:{1}", name, generation);
            ++idCounter;

            command.Parameters.Add(new SqlParameter { ParameterName = "@deploymentid", DbType = DbType.String, Value = deploymentId });
            command.Parameters.Add(new SqlParameter { ParameterName = "@date", DbType = DbType.Date, Value = DateTime.UtcNow });
            command.Parameters.Add(new SqlParameter { ParameterName = "@timestamp", DbType = DbType.DateTime, Value = DateTime.UtcNow });
            command.Parameters.Add(new SqlParameter { ParameterName = "@id", DbType = DbType.String, Value = id });
            command.Parameters.Add(new SqlParameter { ParameterName = "@counter", DbType = DbType.Int64, Value = idCounter });
            command.Parameters.Add(new SqlParameter { ParameterName = "@hostname", DbType = DbType.String, Value = myHostName });
            command.Parameters.Add(new SqlParameter { ParameterName = "@name", DbType = DbType.String, Value = name });
            command.Parameters.Add(new SqlParameter { ParameterName = "@isdelta", DbType = DbType.Boolean, Value = counter.IsValueDelta });
            command.Parameters.Add(new SqlParameter { ParameterName = "@statvalue", DbType = DbType.String, Value = statValue });
            command.Parameters.Add(new SqlParameter { ParameterName = "@statistic", DbType = DbType.String, Value = counter.Name });

            return command;
        }
Ejemplo n.º 56
0
        public override void OnLoad(string name, LookingGlassBase lgbase)
        {
            base.OnLoad(name, lgbase);
            ModuleParams.AddDefaultParameter(m_moduleName + ".Ogre.InputSystem.Name",
                    "OgreUI",
                    "Module to handle user IO on the rendering screen");

            ModuleParams.AddDefaultParameter(m_moduleName + ".Ogre.Name", "LookingGlass",
                    "Name of the Ogre resources to load");
            ModuleParams.AddDefaultParameter(m_moduleName + ".Ogre.SkyboxName", "LookingGlass/CloudyNoonSkyBox",
                    "Name of the skybox resource to use");
            ModuleParams.AddDefaultParameter(m_moduleName + ".Ogre.ShadowTechnique", "none",
                    "Shadow technique: none, texture-additive, texture-modulative, stencil-modulative, stencil-additive");
            ModuleParams.AddDefaultParameter(m_moduleName + ".Ogre.ShadowFarDistance", "400",
                    "Integer units of distance within which to do shadows (mul by magnification)");
            // cp.AddParameter(m_moduleName + ".Ogre.Renderer", "Direct3D9 Rendering Subsystem",
            //             "Name of the rendering subsystem to use");
            ModuleParams.AddDefaultParameter(m_moduleName + ".Ogre.Renderer", "OpenGL Rendering Subsystem",
                    "Name of the rendering subsystem to use");
            ModuleParams.AddDefaultParameter(m_moduleName + ".Ogre.VideoMode", "800 x 600@ 32-bit colour",
                    "Initial window size");
            ModuleParams.AddDefaultParameter(m_moduleName + ".Ogre.FramePerSecMax", "30",
                    "Maximum number of frames to display per second");
            ModuleParams.AddDefaultParameter(m_moduleName + ".ShouldRenderOnMainThread", "false",
                    "True if ogre rendering otherwise someone has to call RenderOneFrame");

            ModuleParams.AddDefaultParameter(m_moduleName + ".Ogre.PluginFilename", "plugins.cfg",
                    "File that lists Ogre plugins to load");
            ModuleParams.AddDefaultParameter(m_moduleName + ".Ogre.ResourcesFilename", "resources.cfg",
                    "File that lists the Ogre resources to load");
            ModuleParams.AddDefaultParameter(m_moduleName + ".Ogre.DefaultNumMipmaps", "2",
                    "Default number of mip maps created for a texture (usually 6)");
            ModuleParams.AddDefaultParameter(m_moduleName + ".Ogre.CacheDir", Utilities.GetDefaultApplicationStorageDir(null),
                    "Directory to store cached meshs, textures, etc");
            ModuleParams.AddDefaultParameter(m_moduleName + ".Ogre.PreLoadedDir",
                    System.IO.Path.Combine(System.AppDomain.CurrentDomain.BaseDirectory, "./LookingGlassResources/Preloaded/"),
                    "Directory to for preloaded textures, etc");
            ModuleParams.AddDefaultParameter(m_moduleName + ".Ogre.DefaultTerrainMaterial",
                    "LookingGlass/DefaultTerrainMaterial",
                    "Material applied to terrain");
            ModuleParams.AddDefaultParameter(m_moduleName + ".Ogre.Ocean.Processor",
                    "none",
                    "The processing routine to create the ocean. Either 'none' or 'hydrax'");
            ModuleParams.AddDefaultParameter(m_moduleName + ".Ogre.OceanMaterialName",
                    "LookingGlass/Ocean",
                    "The ogre name of the ocean texture");
            ModuleParams.AddDefaultParameter(m_moduleName + ".Ogre.DefaultMeshFilename",
                    System.IO.Path.Combine(System.AppDomain.CurrentDomain.BaseDirectory, "./LookingGlassResources/LoadingShape.mesh"),
                    "Filename of the default shape found in the cache dir");
            ModuleParams.AddDefaultParameter(m_moduleName + ".Ogre.DefaultTextureFilename",
                    System.IO.Path.Combine(System.AppDomain.CurrentDomain.BaseDirectory, "./LookingGlassResources/LoadingTexture.png"),
                    "Filename of the default texture found in the cache dir");
            ModuleParams.AddDefaultParameter(m_moduleName + ".Ogre.DefaultTextureResourceName",
                    "LoadingTexture.png",
                    "Resource name of  the default texture");
            ModuleParams.AddDefaultParameter(m_moduleName + ".Ogre.WhiteTextureResourceName",
                    "Preload/" + OMV.Primitive.TextureEntry.WHITE_TEXTURE.ToString().Substring(0,1)
                            + "/" + OMV.Primitive.TextureEntry.WHITE_TEXTURE.ToString(),
                    "Resource name of a white texture used as default base color");

            ModuleParams.AddDefaultParameter(m_moduleName + ".Ogre.LL.SceneMagnification", "1",
                    "Magnification of LL coordinates into Ogre space");
            ModuleParams.AddDefaultParameter(m_moduleName + ".Ogre.LL.RenderInfoMaterialCreate", "true",
                    "Create materials while gathering mesh generation info (earlier than mesh creation)");
            ModuleParams.AddDefaultParameter(m_moduleName + ".Ogre.LL.EarlyMaterialCreate", "false",
                    "Create materials while creating mesh rather than waiting");
            ModuleParams.AddDefaultParameter(m_moduleName + ".Ogre.LL.DefaultAvatarMesh",
                    // "Preload/00000000-0000-2222-3333-112200000003",
                    "", // read definition from LAD file
                    "Entity name of mesh to use for avatars");

            ModuleParams.AddDefaultParameter(m_moduleName + ".Ogre.BetweenFrame.WorkMilliSecondsMax", "300",
                    "Cost of queued C++ work items to do between each frame");
            ModuleParams.AddDefaultParameter(m_moduleName + ".Ogre.BetweenFrame.Costs.Total", "200",
                    "The total cost of C# operations to do between each frame");

            ModuleParams.AddDefaultParameter(m_moduleName + ".Ogre.SerializeMaterials", "false",
                    "Write out materials to files (replace with DB someday)");
            ModuleParams.AddDefaultParameter(m_moduleName + ".Ogre.SerializeMeshes", "true",
                    "Write out meshes to files");
            ModuleParams.AddDefaultParameter(m_moduleName + ".Ogre.ForceMeshRebuild", "false",
                    "True if to force the generation a mesh when first rendered (don't rely on cache)");
            ModuleParams.AddDefaultParameter(m_moduleName + ".Ogre.PrebuildMesh", "true",
                    "True if to make sure the mesh exists before creating the scene node");
            ModuleParams.AddDefaultParameter(m_moduleName + ".ShouldShareMeshes", "false",
                    "True if to share meshes with similar characteristics");
            ModuleParams.AddDefaultParameter(m_moduleName + ".Ogre.UseShaders", "true",
                    "Whether to use the new technique of using GPU shaders");
            ModuleParams.AddDefaultParameter(m_moduleName + ".Ogre.CollectOgreStats", "true",
                    "Whether to collect detailed Ogre stats and make available to web");
            ModuleParams.AddDefaultParameter(m_moduleName + ".Ogre.ShouldQueueMeshOperations", "true",
                    "True if to try and use threads and delayed mesh load and unload operations");

            ModuleParams.AddDefaultParameter(m_moduleName + ".Avatar.Mesh.InfoDir", "./LookingGlassResources/openmetaverse_data",
                    "Directory containing avatar description information");
            ModuleParams.AddDefaultParameter(m_moduleName + ".Avatar.Mesh.Description", "avatar_lad.xml",
                    "File containing detailed avatar mesh description");
            ModuleParams.AddDefaultParameter(m_moduleName + ".Avatar.Mesh.DescriptionDir", "./LookingGlassResources/character",
                    "Directory with detailed avatar mesh description info");

            ModuleParams.AddDefaultParameter(m_moduleName + ".Ogre.Sky", "Default",
                    "Name of the key system to use");
            ModuleParams.AddDefaultParameter(m_moduleName + ".Ogre.SkyX.LightingHDR", "true",
                    "Use high resolution lighting shaders");

            ModuleParams.AddDefaultParameter(m_moduleName + ".Ogre.Camera.NearClip", "2.0",
                    "Initial camera near clip distance");
            ModuleParams.AddDefaultParameter(m_moduleName + ".Ogre.Camera.FarClip", "30000.0",
                    "Initial camera far clip distance");
            ModuleParams.AddDefaultParameter(m_moduleName + ".Ogre.Ambient.Scene", "<0.4,0.4,0.4>",
                    "color value for scene initial ambient lighting");
            ModuleParams.AddDefaultParameter(m_moduleName + ".Ogre.Ambient.Material", "<0.4,0.4,0.4>",
                    "color value for material ambient lighting");
            ModuleParams.AddDefaultParameter(m_moduleName + ".Ogre.Sun.Color", "<1.0,1.0,1.0>",
                    "Color of light from the sun at noon");
            ModuleParams.AddDefaultParameter(m_moduleName + ".Ogre.Moon.Color", "<0.6,0.6,0.8>",
                    "Color of light from the moon");

            ModuleParams.AddDefaultParameter(m_moduleName + ".Ogre.Visibility.Processor", "FrustrumDistance",
                    "Name of the culling plugin to use ('FrustrumDistance', 'VariableFrustDist', 'none')");
            ModuleParams.AddDefaultParameter(m_moduleName + ".Ogre.Visibility.Cull.Frustrum", "false",
                    "whether to cull (unload) objects if not visible in camera frustrum");
            ModuleParams.AddDefaultParameter(m_moduleName + ".Ogre.Visibility.Cull.Distance", "false",
                    "whether to cull (unload) objects depending on distance from camera");
            ModuleParams.AddDefaultParameter(m_moduleName + ".Ogre.Visibility.Cull.Meshes", "true",
                    "unload culled object meshes");
            ModuleParams.AddDefaultParameter(m_moduleName + ".Ogre.Visibility.Cull.Textures", "true",
                    "unload culled textures");
            ModuleParams.AddDefaultParameter(m_moduleName + ".Ogre.Visibility.MaxDistance", "200",
                    "the maximum distance to see any entites (far clip)");
            ModuleParams.AddDefaultParameter(m_moduleName + ".Ogre.Visibility.MinDistance", "30",
                    "below this distance, everything is visible");
            ModuleParams.AddDefaultParameter(m_moduleName + ".Ogre.Visibility.OnlyLargeAfter", "120",
                    "After this distance, only large things are visible");
            ModuleParams.AddDefaultParameter(m_moduleName + ".Ogre.Visibility.Large", "8",
                    "How big is considered 'large' for 'OnlyLargeAfter' calculation");
            ModuleParams.AddDefaultParameter(m_moduleName + ".Ogre.Visibility.MeshesReloadedPerFrame", "80",
                    "When reloading newly visible meshes, how many to load per frame");

            // some counters and intervals to see how long things take
            m_stats = new StatisticManager(m_moduleName);
            m_statMaterialsRequested = m_stats.GetCounter("MaterialsRequested");
            m_statMeshesRequested = m_stats.GetCounter("MeshesRequested");
            m_statTexturesRequested = m_stats.GetCounter("TexturesRequested");
            m_statSharableTotal = m_stats.GetCounterValue("TotalMeshes", delegate() { return (long)prebuiltMeshes.Count; });
            m_statRequestedMeshes = m_stats.GetCounterValue("RequestedMeshes", delegate() { return (long)m_requestedMeshes.Count; });
            m_statRequestedMeshes = m_stats.GetCounterValue("PrebuiltMeshes", delegate() {
            return (long)RenderPrim.prebuiltMeshes.Count;
            });
            m_statShareInstances = m_stats.GetCounter("TotalSharedInstances");

            // renderer keeps rendering specific data in an entity's addition/subsystem slots
            AddSceneNodeName = EntityBase.AddAdditionSubsystem(RendererOgre.AddSceneNodeNameName);
            AddRegionSceneNode = EntityBase.AddAdditionSubsystem(RendererOgre.AddRegionSceneNodeName);
        }
Ejemplo n.º 57
0
 public Spiral(VectorInt center, ICounter diameter, ICounter angle)
 {
     this.center = center;
     this.diameter = diameter;
     this.angle = angle;
 }
Ejemplo n.º 58
0
 public Spiral(VectorInt Center)
 {
     center = Center;
     diameter = new Counter(0, 50, 0.3f);
     angle = new Counter(0, 360, 5);
 }
Ejemplo n.º 59
0
 public Game(ICounter counter)
 {
     _counter = counter;
     this.Scores = new List<Score> ();
 }
Ejemplo n.º 60
0
 public Processor(ICounter counter, IRepository repository)
 {
     _counter = counter;
     _repository = repository;
 }