Create() public static method

Creates a new Metric instance if value is valid, otherwise returns null. Invalid numeric values are negative and NaN/Infinite.
public static Create ( string name, double value, double decayFactor = null ) : Metric
name string
value double
decayFactor double
return Metric
 /// <summary>
 /// Gets the total amount of system memory. Creates a new instance each time.
 /// </summary>
 public Metric SystemMaxMemory()
 {
     return(Metric.Create(StandardMetrics.SystemMemoryMax,
                          IsRunningOnMono
             ? _monoSystemMaxMemory.RawValue
             : GetVbTotalPhysicalMemory()));
 }
Esempio n. 2
0
        /// <summary>
        /// Gets the total amount of system memory. Creates a new instance each time.
        /// </summary>
        public Metric SystemMaxMemory()
        {
            return(Metric.Create(StandardMetrics.SystemMemoryMax,
#if MONO
                                 _systemMaxMemory.RawValue
#else
                                 new Microsoft.VisualBasic.Devices.ComputerInfo().TotalPhysicalMemory
#endif
                                 ));
        }
 /// <summary>
 /// Gets the total amount of system memory. Creates a new instance each time.
 /// </summary>
 public Metric SystemMaxMemory()
 {
     return(Metric.Create(StandardMetrics.SystemMemoryMax,
                          new Microsoft.VisualBasic.Devices.ComputerInfo().TotalPhysicalMemory));
 }
 /// <summary>
 /// Gets the amount of system memory available. Creates a new instance each time.
 /// </summary>
 public Metric SystemMemoryAvailable()
 {
     return(Metric.Create(StandardMetrics.SystemMemoryAvailable, _systemAvailableMemory.NextValue(), DecayFactor));
 }
 /// <summary>
 /// Gets the amount of memory used by this particular CLR process. Creates a new instance each time.
 /// </summary>
 public Metric ClrProcessMemoryUsed()
 {
     return(Metric.Create(StandardMetrics.ClrProcessMemoryUsed, Process.GetCurrentProcess().WorkingSet64,
                          DecayFactor));
 }
 /// <summary>
 /// Returns the system load average. Creates a new instance each time.
 /// </summary>
 public Metric SystemLoadAverage()
 {
     return(Metric.Create(StandardMetrics.SystemLoadAverage, _systemLoadAverageCounter.NextValue()));
 }
 /// <summary>
 /// Returns the number of available processors. Creates a new instance each time.
 /// </summary>
 public Metric Processors()
 {
     return(Metric.Create(StandardMetrics.Processors, Environment.ProcessorCount, null));
 }