示例#1
0
        /// <summary>
        /// Extension method for adding the Performance watcher to the the WardenConfiguration with the default name of Performance Watcher.
        /// </summary>
        /// <param name="builder">Instance of the Warden configuration builder.</param>
        /// <param name="configuration">Configuration of PerformanceWatcher.</param>
        /// <param name="hooks">Optional lambda expression for configuring the watcher hooks.</param>
        /// <returns>Instance of fluent builder for the WardenConfiguration.</returns>
        public static WardenConfiguration.Builder AddPerformanceWatcher(
            this WardenConfiguration.Builder builder,
            PerformanceWatcherConfiguration configuration,
            Action <WatcherHooksConfiguration.Builder> hooks = null)
        {
            builder.AddWatcher(PerformanceWatcher.Create(configuration), hooks);

            return(builder);
        }
示例#2
0
        /// <summary>
        /// Extension method for adding the Performance watcher to the the WardenConfiguration with the default name of Performance Watcher.
        /// </summary>
        /// <param name="builder">Instance of the Warden configuration builder.</param>
        /// <param name="configuration">Configuration of PerformanceWatcher.</param>
        /// <param name="hooks">Optional lambda expression for configuring the watcher hooks.</param>
        /// <param name="interval">Optional interval (5 seconds by default) after which the next check will be invoked.</param>
        /// <param name="group">Optional name of the group that PerformanceWatcher belongs to.</param>
        /// <returns>Instance of fluent builder for the WardenConfiguration.</returns>
        public static WardenConfiguration.Builder AddPerformanceWatcher(
            this WardenConfiguration.Builder builder,
            PerformanceWatcherConfiguration configuration,
            Action <WatcherHooksConfiguration.Builder> hooks = null,
            TimeSpan?interval = null,
            string group      = null)
        {
            builder.AddWatcher(PerformanceWatcher.Create(configuration, group), hooks, interval);

            return(builder);
        }
示例#3
0
        protected PerformanceWatcher(string name, PerformanceWatcherConfiguration configuration)
        {
            if (string.IsNullOrEmpty(name))
            {
                throw new ArgumentException("Watcher name can not be empty.");
            }

            if (configuration == null)
            {
                throw new ArgumentNullException(nameof(configuration),
                                                "Performance Watcher configuration has not been provided.");
            }

            Name           = name;
            _configuration = configuration;
        }
示例#4
0
 protected Configurator(PerformanceWatcherConfiguration configuration) : base(configuration)
 {
 }
示例#5
0
 protected Configurator(TimeSpan?delay = null)
 {
     Configuration = new PerformanceWatcherConfiguration(delay);
 }
示例#6
0
 public Default(PerformanceWatcherConfiguration configuration) : base(configuration)
 {
     SetInstance(this);
 }
示例#7
0
 /// <summary>
 /// Factory method for creating a new instance of PerformanceWatcher.
 /// </summary>
 /// <param name="name">Name of the PerformanceWatcher.</param>
 /// <param name="configuration">Configuration of PerformanceWatcher.</param>
 /// <param name="group">Optional name of the group that PerformanceWatcher belongs to.</param>
 /// <returns>Instance of PerformanceWatcher.</returns>
 public static PerformanceWatcher Create(string name, PerformanceWatcherConfiguration configuration,
                                         string group = null)
 => new PerformanceWatcher(name, configuration, group);
示例#8
0
 /// <summary>
 /// Factory method for creating a new instance of PerformanceWatcher with default name of Performance Watcher.
 /// </summary>
 /// <param name="configuration">Configuration of PerformanceWatcher.</param>
 /// <param name="group">Optional name of the group that PerformanceWatcher belongs to.</param>
 /// <returns>Instance of PerformanceWatcher.</returns>
 public static PerformanceWatcher Create(PerformanceWatcherConfiguration configuration,
                                         string group = null)
 => Create(DefaultName, configuration, group);
示例#9
0
 protected Configurator(TimeSpan?delay = null, string machineName = null)
 {
     Configuration = new PerformanceWatcherConfiguration(delay, machineName);
 }
示例#10
0
 /// <summary>
 /// Factory method for creating a new instance of PerformanceWatcher.
 /// </summary>
 /// <param name="name">Name of the PerformanceWatcher.</param>
 /// <param name="configuration">Configuration of PerformanceWatcher.</param>
 /// <returns>Instance of PerformanceWatcher.</returns>
 public static PerformanceWatcher Create(string name, PerformanceWatcherConfiguration configuration)
 => new PerformanceWatcher(name, configuration);
示例#11
0
 /// <summary>
 /// Factory method for creating a new instance of PerformanceWatcher with default name of Performance Watcher.
 /// </summary>
 /// <param name="configuration">Configuration of PerformanceWatcher.</param>
 /// <returns>Instance of PerformanceWatcher.</returns>
 public static PerformanceWatcher Create(PerformanceWatcherConfiguration configuration)
 => Create(DefaultName, configuration);