Esempio n. 1
0
        /// <summary>
        /// Initialise the bootstrapper
        /// </summary>
        /// <param name="filter">a series of filters</param>
        /// <param name="commandLine">command line options needed by other components</param>
        /// <param name="persistance">a persistence object</param>
        /// <param name="perfCounters"></param>
        public void Initialise(IFilter filter,
                               ICommandLine commandLine,
                               IPersistance persistance,
                               IPerfCounters perfCounters)
        {
            var builder = new ContainerBuilder();

            builder.RegisterInstance(_logger);
            builder.RegisterInstance(filter);
            builder.RegisterInstance(commandLine);
            builder.RegisterInstance(persistance);
            builder.RegisterInstance(perfCounters);

            builder.RegisterType <TrackedMethodStrategyManager>().As <ITrackedMethodStrategyManager>().SingleInstance();
            builder.RegisterType <InstrumentationModelBuilderFactory>().As <IInstrumentationModelBuilderFactory>();
            builder.RegisterType <CommunicationManager>().As <ICommunicationManager>();
            builder.RegisterType <ProfilerManager>().As <IProfilerManager>();
            builder.RegisterType <ProfilerCommunication>().As <IProfilerCommunication>();

            builder.RegisterType <MarshalWrapper>().As <IMarshalWrapper>();
            builder.RegisterType <MemoryManager>().As <IMemoryManager>().SingleInstance();
            builder.RegisterType <MessageHandler>().As <IMessageHandler>();

            _container = builder.Build();
        }
Esempio n. 2
0
        /// <summary>
        /// Enable performance counters.
        /// </summary>
        /// <param name="name">Instance name.</param>
        /// <param name="perf">Performance counters implementation (platform specific).</param>
        public void EnablePerfCounters(string name, IPerfCounters <ReceiverCounters> perf)
        {
            const string Category = "Microsoft Psi message delivery";

            if (this.counters != null)
            {
                throw new InvalidOperationException("Perf counters are already enabled for this receiver");
            }

#pragma warning disable SA1118 // Parameter must not span multiple lines
            perf.AddCounterDefinitions(
                Category,
                new Tuple <ReceiverCounters, string, string, PerfCounterType>[]
            {
                Tuple.Create(ReceiverCounters.Total, "Total messages / second", "Number of messages received per second", PerfCounterType.RateOfCountsPerSecond32),
                Tuple.Create(ReceiverCounters.Dropped, "Dropped messages / second", "Number of messages dropped per second", PerfCounterType.RateOfCountsPerSecond32),
                Tuple.Create(ReceiverCounters.Processed, "Messages / second", "Number of messages processed per second", PerfCounterType.RateOfCountsPerSecond32),
                Tuple.Create(ReceiverCounters.ProcessingTime, "Processing time (ns)", "The time it takes the component to process a message", PerfCounterType.NumberOfItems32),
                Tuple.Create(ReceiverCounters.PipelineExclusiveDelay, "Exclusive pipeline delay (ns)", "The delta between the originating time of the message and the time the message was received.", PerfCounterType.NumberOfItems32),
                Tuple.Create(ReceiverCounters.IngestTime, "Ingest time (ns)", "The delta between the time the message was posted and the time the message was received.", PerfCounterType.NumberOfItems32),
                Tuple.Create(ReceiverCounters.TimeInQueue, "Time in queue (ns)", "The time elapsed between posting of the message and beginning its processing", PerfCounterType.NumberOfItems32),
                Tuple.Create(ReceiverCounters.ProcessingDelay, "Total processing delay (ns)", "The time elapsed between posting of the message and completing its processing.", PerfCounterType.NumberOfItems32),
                Tuple.Create(ReceiverCounters.PipelineInclusiveDelay, "Inclusive pipeline delay (ns)", "The end-to-end delay, from originating time to the time when processing completed.", PerfCounterType.NumberOfItems32),
                Tuple.Create(ReceiverCounters.QueueSize, "Queue size", "The number of messages waiting in the delivery queue", PerfCounterType.NumberOfItems32),
                Tuple.Create(ReceiverCounters.MaxQueueSize, "Max queue size", "The maximum number of messages ever waiting at the same time in the delivery queue", PerfCounterType.NumberOfItems32),
                Tuple.Create(ReceiverCounters.ThrottlingRequests, "Throttling requests / second", "The number of throttling requests issued due to queue full, per second", PerfCounterType.RateOfCountsPerSecond32),
                Tuple.Create(ReceiverCounters.OutstandingUnrecycled, "Unrecycled messages", "The number of messages that are still in use by the component", PerfCounterType.NumberOfItems32),
                Tuple.Create(ReceiverCounters.AvailableRecycled, "Recycled messages", "The number of messages that are available for recycling", PerfCounterType.NumberOfItems32),
            });
#pragma warning restore SA1118 // Parameter must not span multiple lines

            this.counters = perf.Enable(Category, name);
            this.awaitingDelivery.EnablePerfCounters(this.counters);
        }
Esempio n. 3
0
        /// <summary>
        /// Enable performance counters.
        /// </summary>
        /// <param name="name">Instance name.</param>
        /// <param name="perf">Performance counters implementation (platform specific).</param>
        public void EnablePerfCounters(string name, IPerfCounters <SchedulerCounters> perf)
        {
            const string Category = "Microsoft Psi scheduler";

            if (this.counters != null)
            {
                throw new InvalidOperationException("Perf counters are already enabled for this scheduler");
            }

#pragma warning disable SA1118 // Parameter must not span multiple lines
            perf.AddCounterDefinitions(
                Category,
                new Tuple <SchedulerCounters, string, string, PerfCounterType>[]
            {
                Tuple.Create(SchedulerCounters.LocalToGlobalPromotions, "Local-to-global promotions", "The percentage of workitems promoted to the global queue", PerfCounterType.AverageCount64),
                Tuple.Create(SchedulerCounters.LocalQueueCount, "Local workitem count", "The number of messages in the thread-local queues", PerfCounterType.AverageBase),
                Tuple.Create(SchedulerCounters.WorkitemsPerSecond, "Workitems / second", "The number of workitems executed per second", PerfCounterType.RateOfCountsPerSecond32),
                Tuple.Create(SchedulerCounters.GlobalWorkitemsPerSecond, "Global workitems / second", "The number of workitems from the global queue executed per second", PerfCounterType.RateOfCountsPerSecond32),
                Tuple.Create(SchedulerCounters.LocalWorkitemsPerSecond, "Local workitems / second", "The number of workitems from the thread-local queues executed per second", PerfCounterType.RateOfCountsPerSecond32),
                Tuple.Create(SchedulerCounters.ImmediateWorkitemsPerSecond, "Immediate workitems / second", "The number of workitems executed synchronously without enqueuing, per second", PerfCounterType.RateOfCountsPerSecond32),
                Tuple.Create(SchedulerCounters.ActiveThreads, "Active threads", "The count of active threads", PerfCounterType.NumberOfItems32),
            });
#pragma warning restore SA1118 // Parameter must not span multiple lines

            this.counters = perf.Enable(Category, name);
        }
Esempio n. 4
0
 /// <summary>
 /// Attaches the perf counters.
 /// </summary>
 /// <param name="counters">The counters.</param>
 public static void AttachPerfCounters(IPerfCounters counters)
 {
     if (_perfCounters == null)
     {
         _perfCounters = counters;
     }
 }
Esempio n. 5
0
        /// <summary>
        /// Enable performance counters.
        /// </summary>
        /// <param name="name">Instance name.</param>
        /// <param name="perf">Performance counters implementation (platform specific).</param>
        public void EnablePerfCounters(string name, IPerfCounters <PriorityQueueCounters> perf)
        {
            const string Category = "Microsoft Psi scheduler queue";

            if (this.counters != null)
            {
                throw new InvalidOperationException("Perf counters are already enabled for this scheduler");
            }

#pragma warning disable SA1118 // Parameter must not span multiple lines
            perf.AddCounterDefinitions(
                Category,
                new Tuple <PriorityQueueCounters, string, string, PerfCounterType>[]
            {
                Tuple.Create(PriorityQueueCounters.WorkitemCount, "Workitem queue count", "The number of work items in the global queue", PerfCounterType.NumberOfItems32),
                Tuple.Create(PriorityQueueCounters.EnqueuingTime, "Enqueuing time", "The time to enqueue a work item", PerfCounterType.NumberOfItems32),
                Tuple.Create(PriorityQueueCounters.DequeueingTime, "Dequeuing time", "The time to dequeuing a work item", PerfCounterType.NumberOfItems32),
                Tuple.Create(PriorityQueueCounters.EnqueueingRetries, "Enqueuing retry average", "The number of retries per work item enqueue operation.", PerfCounterType.AverageCount64),
                Tuple.Create(PriorityQueueCounters.EnqueueingCount, "Enqueue count", "The base counter for computing the work item enqueuing retry count.", PerfCounterType.AverageBase),
                Tuple.Create(PriorityQueueCounters.DequeuingRetries, "Dequeuing retry average", "The number of retries per work item dequeue operation.", PerfCounterType.AverageCount64),
                Tuple.Create(PriorityQueueCounters.DequeueingCount, "Dequeue count", "The base counter for computing the work item enqueuing retry count.", PerfCounterType.AverageBase)
            });
#pragma warning restore SA1118 // Parameter must not span multiple lines

            this.counters = perf.Enable(Category, name);
        }
Esempio n. 6
0
 /// <summary>
 /// Create an instance of the profiler manager
 /// </summary>
 /// <param name="communicationManager"></param>
 /// <param name="persistance"></param>
 /// <param name="memoryManager"></param>
 /// <param name="commandLine"></param>
 /// <param name="perfCounters"></param>
 public ProfilerManager(ICommunicationManager communicationManager, IPersistance persistance,
                        IMemoryManager memoryManager, ICommandLine commandLine, IPerfCounters perfCounters)
 {
     _communicationManager = communicationManager;
     _persistance          = persistance;
     _memoryManager        = memoryManager;
     _commandLine          = commandLine;
     _perfCounters         = perfCounters;
 }
Esempio n. 7
0
 /// <summary>
 /// Create an instance of the profiler manager
 /// </summary>
 /// <param name="communicationManager"></param>
 /// <param name="persistance"></param>
 /// <param name="memoryManager"></param>
 /// <param name="commandLine"></param>
 /// <param name="perfCounters"></param>
 public ProfilerManager(ICommunicationManager communicationManager, IPersistance persistance, 
     IMemoryManager memoryManager, ICommandLine commandLine, IPerfCounters perfCounters)
 {
     _communicationManager = communicationManager;
     _persistance = persistance;
     _memoryManager = memoryManager;
     _commandLine = commandLine;
     _perfCounters = perfCounters;
 }
Esempio n. 8
0
 public QueueWriter(IBusDataAccess dataAccess,
                    IPerfCounters counters,
                    ISerializer serializer,
                    ISystemClock clock)
 {
     _dataAccess = dataAccess;
     _counters   = counters;
     _serializer = serializer;
     _clock      = clock;
 }
Esempio n. 9
0
        public void Setup()
        {
            if (!IdentityHelper.IsRunningAsWindowsAdmin())
            {
                Assert.Inconclusive("Skipping PerfCountersTests because administrator privileges are missing.");
            }

            _counters = new PerfCounters();
            Assert.IsTrue(PerformanceCounterCategory.CounterExists(MemoryQueue, CategoryName));
            Assert.IsTrue(PerformanceCounterCategory.CounterExists(QueueThroughput, CategoryName));
        }
Esempio n. 10
0
 public SubscribedPublisher(IBusDataAccess dataAccess,
                            ISubscribedLifespan subscriptionConfiguration,
                            ISerializer serializer,
                            IPerfCounters counters,
                            ISystemClock clock)
 {
     _dataAccess         = dataAccess;
     _subscribedLifespan = subscriptionConfiguration;
     _serializer         = serializer;
     _counters           = counters;
     _clock = clock;
 }
Esempio n. 11
0
 public SubscribedWork(
     ISubscribedReader reader,
     IPerfCounters counters,
     ILog <SubscribedWork> log,
     IBusDataAccess dataAccess,
     IFindSubscribedHandlers findSubscriptionHandler)
 {
     _reader     = reader;
     _counters   = counters;
     _log        = log;
     _dataAccess = dataAccess;
     _findSubscriptionHandlers = findSubscriptionHandler;
 }
Esempio n. 12
0
 public SubscribedReader(IBusDataAccess dataAccess,
                         ISerializer serializer,
                         ILog <SubscribedReader> log,
                         IPerfCounters counters,
                         ISystemClock clock)
 {
     _dataAccess = dataAccess;
     _serializer = serializer;
     _log        = log;
     _counters   = counters;
     _clock      = clock;
     MaxRetries  = 5;
 }
Esempio n. 13
0
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="dataAccess">The Data access.</param>
 /// <param name="log"></param>
 public QueueReader(IBusDataAccess dataAccess,
                    ILog <QueueReader> log,
                    IPerfCounters counters,
                    ISerializer serializer,
                    ISystemClock clock)
 {
     _log        = log;
     _dataAccess = dataAccess;
     _counters   = counters;
     _serializer = serializer;
     MaxRetries  = 5;
     _clock      = clock;
 }
Esempio n. 14
0
 /// <summary>
 /// Sets up service.
 /// </summary>
 private void SetUpService()
 {
     _configurationReader = TypeContainer.Resolve <IConfigurationReader>();
     _defaultParser       = TypeContainer.Resolve <IParser>();
     _defaultBuilder      = TypeContainer.Resolve <IBuilder>();
     _dataService         = TypeContainer.Resolve <IDataService>();
     _messenger           = TypeContainer.Resolve <IMessenger>();
     _perfCounters        = TypeContainer.Resolve <IPerfCounters>();
     ExecutionResult.AttachPerfCounters(_perfCounters);
     ExecutionResult.AttachLogger(_logger);
     HostManager                 = TypeContainer.Resolve <IServiceHostManager>();
     _messenger.Notify          += MessengerNotification;
     _configFileMonitor.Changed += (s, e) => ReloadAndApplyConfigChanges();
     Configure();
 }
Esempio n. 15
0
 public QueueWork(
     ILog <QueueWork> log,
     IPerfCounters counters,
     IFindQueueHandlers findHandlers,
     IQueueReader queueReader,
     IBusDataAccess dataAccess,
     ISagaMessageMapManager sagaMessageMapManager)
 {
     _log                   = log;
     _counters              = counters;
     _findHandlers          = findHandlers;
     _queueReader           = queueReader;
     _dataAccess            = dataAccess;
     _sagaMessageMapManager = sagaMessageMapManager;
 }
Esempio n. 16
0
        /// <summary>
        /// Initializes a new instance of the <see cref="JniBridgeManager" /> class.
        /// </summary>
        /// <param name="logger">The logger.</param>
        /// <param name="configuration">The configuration.</param>
        /// <param name="utilities">The utilities.</param>
        /// <param name="dataservice">The dataservice.</param>
        /// <param name="counters">The counters.</param>
        public JniBridgeManager(ILogger logger, IConfigurationReader configuration, IUtilities utilities, IDataService dataservice, IPerfCounters counters) : this()
        {
            _logger    = logger;
            _utilities = utilities;
            var hModule = IntPtr.Zero;

            _dataservice   = dataservice;
            _configuration = configuration;
            _perfCounters  = counters;

            // Let's check for required SYMLINKS & Environment variables (Java)
            if (_utilities.RunJavaEnvChecks().IsSuccess)
            {
                // Let's load JVM (as specified in configuration)
                if ((hModule = Win32Helper.LoadLibrary(((CustomConfigReader)configuration.Configuration).JniBridgeOptions.selectedJvm)) != IntPtr.Zero)
                {
                    jvmHandles.Add("hModuleJvm", hModule);
                }
            }
        }
Esempio n. 17
0
        /// <summary>
        /// Enable performance counters.
        /// </summary>
        /// <param name="name">Instance name.</param>
        /// <param name="perf">Performance counters implementation (platform specific).</param>
        public void EnablePerfCounters(string name, IPerfCounters <EmitterCounters> perf)
        {
            const string Category = "Microsoft Psi message submission";

            if (this.counters != null)
            {
                throw new InvalidOperationException("Perf counters are already enabled for emitter " + this.Name);
            }

#pragma warning disable SA1118 // Parameter must not span multiple lines
            perf.AddCounterDefinitions(
                Category,
                new Tuple <EmitterCounters, string, string, PerfCounterType>[]
            {
                Tuple.Create(EmitterCounters.MessageCount, "Total messages / second", "Number of messages received per second", PerfCounterType.RateOfCountsPerSecond32),
                Tuple.Create(EmitterCounters.MessageLatency, "Message latency (microseconds)", "The end-to-end latency, from originating time to the time when processing completed.", PerfCounterType.NumberOfItems32),
            });
#pragma warning restore SA1118 // Parameter must not span multiple lines

            this.counters = perf.Enable(Category, name);
        }
Esempio n. 18
0
 internal AspNetWebSocketManager(IPerfCounters perfCounters)
 {
     _perfCounters = perfCounters;
 }
Esempio n. 19
0
 public Send(IPerfCounters counter)
 {
     _counter = counter;
 }
Esempio n. 20
0
 public void Setup()
 {
     _counters = new PerfCounters();
     Assert.IsTrue(PerformanceCounterCategory.CounterExists(MemoryQueue, CategoryName));
     Assert.IsTrue(PerformanceCounterCategory.CounterExists(QueueThroughput, CategoryName));
 }
 internal WebSocketPipe(IUnmanagedWebSocketContext context, IPerfCounters perfCounters)
 {
     _context      = context;
     _perfCounters = perfCounters;
 }
 internal WebSocketPipe(IUnmanagedWebSocketContext context, IPerfCounters perfCounters) {
     _context = context;
     _perfCounters = perfCounters;
 }
Esempio n. 23
0
 public Send(IBusControl bus, IPerfCounters counter)
 {
     this.bus     = bus;
     this.counter = counter;
 }
Esempio n. 24
0
 public void Setup()
 {
     _counters = new PerfCounters();
     Assert.IsTrue(PerformanceCounterCategory.CounterExists(MemoryQueue, CategoryName));
     Assert.IsTrue(PerformanceCounterCategory.CounterExists(QueueThroughput, CategoryName));
 }
 internal AspNetWebSocketManager(IPerfCounters perfCounters) {
     _perfCounters = perfCounters;
 }
Esempio n. 26
0
 /// <summary>
 /// Initializes a new instance of the <see cref="DefaultBuilder" /> class.
 /// </summary>
 /// <param name="logger">The logger.</param>
 /// <param name="messenger">The messenger.</param>
 /// <param name="counters">The counters.</param>
 public DefaultBuilder(ILogger logger, IMessenger messenger, IPerfCounters counters)
 {
     _logger       = logger;
     _messenger    = messenger;
     _perfCounters = counters;
 }