Ejemplo n.º 1
0
        ThresholdConfiguration GetConfiguration()
        {
            double seconds;

            if (!double.TryParse(_durationTextBox.Text, out seconds) ||
                seconds <= 1.0 / TimeSpan.TicksPerSecond)
            {
                seconds = _configuration.Duration.TotalSeconds;
            }
            _configuration = new ThresholdConfiguration
            {
                Threshold = (float)_thresholdSlider.Value,
                Duration  = TimeSpan.FromSeconds(seconds),
            };
            return(_configuration);
        }
Ejemplo n.º 2
0
        public MainWindow()
        {
            InitializeComponent();

            _configuration = GetConfiguration();

            _server  = Server.Create("Default");
            Closing += (s, e) =>
            {
                _processor.Clear();
                _threshold.Clear();
                _server.Dispose();
            };
            _application = _server.CreateApplication("Performance Counters");

            var configurationSource = CreateConfigurationObservable();

            _processor.SetSource(Queries.ProcessorUtilizationPerCore(_application));
            _threshold.SetSource(Queries.ProcessorUtilizationSustainedThreshold(_application, configurationSource));
        }
Ejemplo n.º 3
0
        public MainWindow()
        {
            InitializeComponent();

            _configuration = GetConfiguration();

            _server = Server.Create("Default");
            Closing += (s, e) =>
            {
                _processor.Clear();
                _threshold.Clear();
                _server.Dispose();
            };
            _application = _server.CreateApplication("Performance Counters");

            var configurationSource = CreateConfigurationObservable();

            _processor.SetSource(Queries.ProcessorUtilizationPerCore(_application));
            _threshold.SetSource(Queries.ProcessorUtilizationSustainedThreshold(_application, configurationSource));
        }
Ejemplo n.º 4
0
 ThresholdConfiguration GetConfiguration()
 {
     double seconds;
     if (!double.TryParse(_durationTextBox.Text, out seconds) ||
         seconds <= 1.0 / TimeSpan.TicksPerSecond)
     {
         seconds = _configuration.Duration.TotalSeconds;
     }
     _configuration = new ThresholdConfiguration
     {
         Threshold = (float)_thresholdSlider.Value,
         Duration = TimeSpan.FromSeconds(seconds),
     };
     return _configuration;
 }