PerformanceCounterTraceRecord.cs source code in C# .NET

Source code for the .NET framework in C#

                        

Code:

/ WCF / WCF / 3.5.30729.1 / untmp / Orcas / SP / ndp / cdf / src / WCF / ServiceModel / System / ServiceModel / Diagnostics / PerformanceCounterTraceRecord.cs / 1 / PerformanceCounterTraceRecord.cs

                            //------------------------------------------------------------ 
// Copyright (c) Microsoft Corporation.  All rights reserved.
//-----------------------------------------------------------

namespace System.ServiceModel.Diagnostics 
{
    using System; 
    using System.Xml; 
    using System.Text;
 

    class PerformanceCounterTraceRecord : TraceRecord
    {
        string categoryName; 
        string perfCounterName;
        string instanceName; 
 
        internal PerformanceCounterTraceRecord(string perfCounterName) : this(null, perfCounterName, null)
        { 
        }

        internal PerformanceCounterTraceRecord(string categoryName, string perfCounterName) : this(categoryName, perfCounterName, null)
        { 
        }
 
        internal PerformanceCounterTraceRecord(string categoryName, string perfCounterName, string instanceName) 
        {
            this.categoryName = categoryName; 
            this.perfCounterName = perfCounterName;
            this.instanceName = instanceName;
        }
 
        internal override string EventId {get {return TraceRecord.EventIdBase + "PerformanceCounter" + TraceRecord.NamespaceSuffix; }}
 
        internal override void WriteTo(XmlWriter writer) 
        {
            if (!String.IsNullOrEmpty(this.categoryName)) 
            {
                writer.WriteElementString("PerformanceCategoryName", this.categoryName);
            }
 
            writer.WriteElementString("PerformanceCounterName", this.perfCounterName);
 
 
            if (!String.IsNullOrEmpty(this.instanceName))
            { 
                writer.WriteElementString("InstanceName", this.instanceName);
            }
        }
    } 
}

// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
// Copyright (c) Microsoft Corporation. All rights reserved.


                        

Link Menu

Network programming in C#, Network Programming in VB.NET, Network Programming in .NET
This book is available now!
Buy at Amazon US or
Buy at Amazon UK