/// <devdoc>
        ///     Reads all the counter and instance data of this performance category.  Note that reading the entire category
        ///     at once can be as efficient as reading a single counter because of the way the system provides the data.
        /// </devdoc>
        public InstanceDataCollectionCollection ReadCategory()
        {
            if (this.categoryName == null)
            {
                throw new InvalidOperationException(SR.GetString(SR.CategoryNameNotSet));
            }

            CategorySample categorySample = PerformanceCounterLib.GetCategorySample(this.machineName, this.categoryName);

            return(categorySample.ReadCategory());
        }
Exemple #2
0
        /// <summary>
        ///     Reads all the counter and instance data of this performance category.  Note that reading the entire category
        ///     at once can be as efficient as reading a single counter because of the way the system provides the data.
        /// </summary>
        public InstanceDataCollectionCollection ReadCategory()
        {
            if (_categoryName == null)
            {
                throw new InvalidOperationException(SR.CategoryNameNotSet);
            }

            using (CategorySample categorySample = PerformanceCounterLib.GetCategorySample(_machineName, _categoryName))
            {
                return(categorySample.ReadCategory());
            }
        }