Ejemplo n.º 1
0
        public Check(
            string shortName,
            string name,
            string description,
            string category,
            string container,
            Func<Check, bool> checkFunc,
            StatVerbosity verbosity) 
        {
            if (ChecksManager.SubCommands.Contains(category))
                throw new Exception(
                    string.Format("Alert cannot be in category '{0}' since this is reserved for a subcommand", category));

            foreach (char c in DisallowedShortNameCharacters)
            {
                if (shortName.IndexOf(c) != -1)
                    throw new Exception(string.Format("Alert name {0} cannot contain character {1}", shortName, c));
            }

            ShortName = shortName;
            Name = name;
            Description = description;
            Category = category;
            Container = container;
            CheckFunc = checkFunc;
            Verbosity = verbosity;
        }
Ejemplo n.º 2
0
        public Check(
            string shortName,
            string name,
            string description,
            string category,
            string container,
            Func <Check, bool> checkFunc,
            StatVerbosity verbosity)
        {
            if (ChecksManager.SubCommands.Contains(category))
            {
                throw new Exception(
                          string.Format("Alert cannot be in category '{0}' since this is reserved for a subcommand", category));
            }

            foreach (char c in DisallowedShortNameCharacters)
            {
                if (shortName.IndexOf(c) != -1)
                {
                    throw new Exception(string.Format("Alert name {0} cannot contain character {1}", shortName, c));
                }
            }

            ShortName   = shortName;
            Name        = name;
            Description = description;
            Category    = category;
            Container   = container;
            CheckFunc   = checkFunc;
            Verbosity   = verbosity;
        }
Ejemplo n.º 3
0
 public PercentageStat(
     string shortName,
     string name,
     string description,
     string category,
     string container,
     StatType type,
     Action<Stat> pullAction,
     StatVerbosity verbosity)
     : base(shortName, name, description, "%", category, container, type, pullAction, verbosity) {}
Ejemplo n.º 4
0
 public PercentageStat(
     string shortName,
     string name,
     string description,
     string category,
     string container,
     StatType type,
     Action <Stat> pullAction,
     StatVerbosity verbosity)
     : base(shortName, name, description, "%", category, container, type, pullAction, verbosity)
 {
 }
Ejemplo n.º 5
0
 public CounterStat(
                     string shortName,
                     string name,
                     string description,
                     string unitName,
                     string category,
                     string container,
                     StatVerbosity verbosity)
     : base(shortName, name, description, unitName, category, container, StatType.Push, null, verbosity)
 {
     m_histograms = new SortedDictionary<string, EventHistogram>();
 }
Ejemplo n.º 6
0
 public CounterStat(
     string shortName,
     string name,
     string description,
     string unitName,
     string category,
     string container,
     StatVerbosity verbosity)
     : base(shortName, name, description, unitName, category, container, StatType.Push, null, verbosity)
 {
     m_histograms = new SortedDictionary <string, EventHistogram>();
 }
Ejemplo n.º 7
0
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name='shortName'>Short name for the stat.  Must not contain spaces.  e.g. "LongFrames"</param>
        /// <param name='name'>Human readable name for the stat.  e.g. "Long frames"</param>
        /// <param name='description'>Description of stat</param>
        /// <param name='unitName'>
        /// Unit name for the stat.  Should be preceeded by a space if the unit name isn't normally appeneded immediately to the value.
        /// e.g. " frames"
        /// </param>
        /// <param name='category'>Category under which this stat should appear, e.g. "scene".  Do not capitalize.</param>
        /// <param name='container'>Entity to which this stat relates.  e.g. scene name if this is a per scene stat.</param>
        /// <param name='type'>Push or pull</param>
        /// <param name='pullAction'>Pull stats need an action to update the stat on request.  Push stats should set null here.</param>
        /// <param name='moi'>Measures of interest</param>
        /// <param name='verbosity'>Verbosity of stat.  Controls whether it will appear in short stat display or only full display.</param>
        public Stat(
            string shortName,
            string name,
            string description,
            string unitName,
            string category,
            string container,
            StatType type,
            MeasuresOfInterest moi,
            Action <Stat> pullAction,
            StatVerbosity verbosity)
        {
            if (StatsManager.SubCommands.Contains(category))
            {
                throw new Exception(
                          string.Format("Stat cannot be in category '{0}' since this is reserved for a subcommand", category));
            }

            foreach (char c in DisallowedShortNameCharacters)
            {
                if (shortName.IndexOf(c) != -1)
                {
                    shortName = shortName.Replace(c, '#');
                }
//                    throw new Exception(string.Format("Stat name {0} cannot contain character {1}", shortName, c));
            }

            ShortName   = shortName;
            Name        = name;
            Description = description;
            UnitName    = unitName;
            Category    = category;
            Container   = container;
            StatType    = type;

            if (StatType == StatType.Push && pullAction != null)
            {
                throw new Exception("A push stat cannot have a pull action");
            }
            else
            {
                PullAction = pullAction;
            }

            MeasuresOfInterest = moi;

            if ((moi & MeasuresOfInterest.AverageChangeOverTime) == MeasuresOfInterest.AverageChangeOverTime)
            {
                m_samples = new Queue <double>(m_maxSamples);
            }

            Verbosity = verbosity;
        }
Ejemplo n.º 8
0
 public Stat(
     string shortName,
     string name,
     string description,
     string unitName,
     string category,
     string container,
     StatType type,
     Action<Stat> pullAction,
     StatVerbosity verbosity)
     : this(shortName, 
             name, 
             description, 
             unitName, 
             category, 
             container, 
             type, 
             MeasuresOfInterest.None, 
             pullAction, 
             verbosity)
 {
 }
Ejemplo n.º 9
0
 public Stat(
     string shortName,
     string name,
     string description,
     string unitName,
     string category,
     string container,
     StatType type,
     Action <Stat> pullAction,
     StatVerbosity verbosity)
     : this(
         shortName,
         name,
         description,
         unitName,
         category,
         container,
         type,
         MeasuresOfInterest.None,
         pullAction,
         verbosity)
 {
 }
Ejemplo n.º 10
0
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name='shortName'>Short name for the stat.  Must not contain spaces.  e.g. "LongFrames"</param>
        /// <param name='name'>Human readable name for the stat.  e.g. "Long frames"</param>
        /// <param name='description'>Description of stat</param>
        /// <param name='unitName'>
        /// Unit name for the stat.  Should be preceeded by a space if the unit name isn't normally appeneded immediately to the value.
        /// e.g. " frames"
        /// </param>
        /// <param name='category'>Category under which this stat should appear, e.g. "scene".  Do not capitalize.</param>
        /// <param name='container'>Entity to which this stat relates.  e.g. scene name if this is a per scene stat.</param>
        /// <param name='type'>Push or pull</param>
        /// <param name='pullAction'>Pull stats need an action to update the stat on request.  Push stats should set null here.</param>
        /// <param name='moi'>Measures of interest</param>
        /// <param name='verbosity'>Verbosity of stat.  Controls whether it will appear in short stat display or only full display.</param>
        public Stat(
            string shortName,
            string name,
            string description,
            string unitName,
            string category,
            string container,
            StatType type,
            MeasuresOfInterest moi,
            Action<Stat> pullAction,
            StatVerbosity verbosity)
        {
            if (StatsManager.SubCommands.Contains(category))
                throw new Exception(
                    string.Format("Stat cannot be in category '{0}' since this is reserved for a subcommand", category));

            foreach (char c in DisallowedShortNameCharacters)
            {
                if (shortName.IndexOf(c) != -1)
                    throw new Exception(string.Format("Stat name {0} cannot contain character {1}", shortName, c));
            }

            ShortName = shortName;
            Name = name;
            Description = description;
            UnitName = unitName;
            Category = category;
            Container = container;
            StatType = type;

            if (StatType == StatType.Push && pullAction != null)
                throw new Exception("A push stat cannot have a pull action");
            else
                PullAction = pullAction;

            MeasuresOfInterest = moi;

            if ((moi & MeasuresOfInterest.AverageChangeOverTime) == MeasuresOfInterest.AverageChangeOverTime)
                m_samples = new Queue<double>(m_maxSamples);

            Verbosity = verbosity;
        }
Ejemplo n.º 11
0
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name='shortName'>Short name for the stat.  Must not contain spaces.  e.g. "LongFrames"</param>
        /// <param name='name'>Human readable name for the stat.  e.g. "Long frames"</param>
        /// <param name='description'>Description of stat</param>
        /// <param name='unitName'>
        /// Unit name for the stat.  Should be preceeded by a space if the unit name isn't normally appeneded immediately to the value.
        /// e.g. " frames"
        /// </param>
        /// <param name='category'>Category under which this stat should appear, e.g. "scene".  Do not capitalize.</param>
        /// <param name='container'>Entity to which this stat relates.  e.g. scene name if this is a per scene stat.</param>
        /// <param name='type'>Push or pull</param>
        /// <param name='pullAction'>Pull stats need an action to update the stat on request.  Push stats should set null here.</param>
        /// <param name='verbosity'>Verbosity of stat.  Controls whether it will appear in short stat display or only full display.</param>
        public Stat(
            string shortName,
            string name,
            string description,
            string unitName,
            string category,
            string container,
            StatType type,
            Action<Stat> pullAction,
            StatVerbosity verbosity)
        {
            if (StatsManager.SubCommands.Contains(category))
                throw new Exception(
                    string.Format("Stat cannot be in category '{0}' since this is reserved for a subcommand", category));

            ShortName = shortName;
            Name = name;
            Description = description;
            UnitName = unitName;
            Category = category;
            Container = container;
            StatType = type;

            if (StatType == StatType.Push && pullAction != null)
                throw new Exception("A push stat cannot have a pull action");
            else
                PullAction = pullAction;

            Verbosity = verbosity;
        }