Exemple #1
0
        /// <summary>
        /// Get the type, name, units of measure, and a description of an existing counter.
        /// </summary>
        /// <param name="counterDescription">The counter description.</param>
        /// <returns>Description of the counter</returns>
        public CounterMetadata GetCounterMetadata(CounterDescription counterDescription)
        {
            unsafe
            {
                var         data = new CounterMetadata();
                CounterType type;
                int         hardwareCounterCount;
                int         nameLength        = 0;
                int         unitsLength       = 0;
                int         descriptionLength = 0;

                // Get Length for strings
                CheckCounter(counterDescription, out type, out hardwareCounterCount, IntPtr.Zero, new IntPtr(&nameLength), IntPtr.Zero, new IntPtr(&unitsLength),
                             IntPtr.Zero, new IntPtr(&descriptionLength));

                sbyte *name        = stackalloc sbyte[nameLength];
                sbyte *units       = stackalloc sbyte[unitsLength];
                sbyte *description = stackalloc sbyte[descriptionLength];

                // Get strings
                CheckCounter(counterDescription, out type, out hardwareCounterCount, new IntPtr(name), new IntPtr(&nameLength), new IntPtr(units), new IntPtr(&unitsLength),
                             new IntPtr(description), new IntPtr(&descriptionLength));

                data.Type = type;
                data.HardwareCounterCount = hardwareCounterCount;
                data.Name        = Marshal.PtrToStringAnsi((IntPtr)name, nameLength);
                data.Units       = Marshal.PtrToStringAnsi((IntPtr)units, unitsLength);
                data.Description = Marshal.PtrToStringAnsi((IntPtr)description, descriptionLength);

                return(data);
            }
        }
Exemple #2
0
        /// <summary>
        /// Get the type, name, units of measure, and a description of an existing counter.
        /// </summary>
        /// <param name="counterDescription">The counter description.</param>
        /// <returns>Description of the counter</returns>
        public CounterMetadata GetCounterMetadata(CounterDescription counterDescription)
        {
            unsafe
            {
                var         data = new CounterMetadata();
                CounterType type;
                int         hardwareCounterCount;
                int         nameLength        = 0;
                int         unitsLength       = 0;
                int         descriptionLength = 0;

                // Get Length for strings
                CheckCounter(counterDescription, out type, out hardwareCounterCount, IntPtr.Zero, new IntPtr(&nameLength), IntPtr.Zero, new IntPtr(&unitsLength),
                             IntPtr.Zero, new IntPtr(&descriptionLength));

                char *name        = stackalloc char[nameLength];
                char *units       = stackalloc char[unitsLength];
                char *description = stackalloc char[descriptionLength];

                // Get strings
                CheckCounter(counterDescription, out type, out hardwareCounterCount, new IntPtr(name), new IntPtr(&nameLength), new IntPtr(units), new IntPtr(&unitsLength),
                             new IntPtr(description), new IntPtr(&descriptionLength));

                data.Type = type;
                data.HardwareCounterCount = hardwareCounterCount;
                data.Name        = new string(name, 0, nameLength);
                data.Units       = new string(units, 0, unitsLength);
                data.Description = new string(description, 0, descriptionLength);

                return(data);
            }
        }
        public ProcessCountersGroup(DateTime start, DateTime finish, CounterGroup counters, int index)
        {
            Start  = start;
            Finish = finish;

            Children = new List <Timeline.IItem>();

            CounterDescription   desc = counters.Descriptions[index];
            ProcessChartLineItem item = new ProcessChartLineItem()
            {
                Name = desc.Name, Start = start, Finish = finish
            };

            for (int x = 0; x < counters.Samples.Count; ++x)
            {
                item.Points.Add(new KeyValuePair <DateTime, double>(counters.Samples[x].Timestamp, counters.Samples[x].Values[index]));
            }

            Children.Add(item);

            Height = Children.Max(c => c.Height);
        }
Exemple #4
0
 /// <summary>
 ///   Constructs a new <see cref = "T:SharpDX.Direct3D10.Counter" /> based on the specified description.
 /// </summary>
 /// <param name = "device">The device with which to associate the state object.</param>
 /// <param name = "description">The counter description.</param>
 /// <returns>The newly created object.</returns>
 public Counter(Device device, CounterDescription description)
     : base(IntPtr.Zero)
 {
     device.CreateCounter(description, this);
 }
Exemple #5
0
 /// <summary>
 ///   Constructs a new <see cref = "T:SharpDX.Direct3D11.Counter" /> based on the specified description.
 /// </summary>
 /// <param name = "device">The device with which to associate the state object.</param>
 /// <param name = "description">The counter description.</param>
 /// <returns>The newly created object.</returns>
 public Counter(Device device, CounterDescription description)
     : base(IntPtr.Zero)
 {
     device.CreateCounter(description, this);
 }