Code:
/ WCF / WCF / 3.5.30729.1 / untmp / Orcas / SP / ndp / cdf / src / WCF / ServiceModel / System / ServiceModel / Diagnostics / DefaultPerformanceCounters.cs / 1 / DefaultPerformanceCounters.cs
//------------------------------------------------------------ // Copyright (c) Microsoft Corporation. All rights reserved. //----------------------------------------------------------- namespace System.ServiceModel.Diagnostics { using System.Collections.Generic; using System.ServiceModel.Channels; using System.ServiceModel; using System.ComponentModel; using System.Diagnostics; using System.IO; using System.ServiceModel.Administration; using System.ServiceModel.Diagnostics; using System.Globalization; using System.Runtime.InteropServices; internal class DefaultPerformanceCounters : PerformanceCountersBase { string instanceName; PerformanceCounter[] counters; enum PerfCounters : int { Instances = 0, TotalCounters = Instances + 1 } string[] perfCounterNames = { PerformanceCounterStrings.SERVICEMODELSERVICE.SInstances, }; const int maxCounterLength = 64; const int hashLength = 2; [Flags] enum truncOptions : uint { NoBits = 0, service32 = 0x01, uri31 = 0x04 } internal override PerformanceCounter[] Counters { get { return this.counters; } set { this.counters = value; } } internal override string InstanceName { get { return this.instanceName; } } internal override string[] CounterNames { get { return this.perfCounterNames; } } internal override int PerfCounterStart { get { return (int)PerfCounters.Instances; } } internal override int PerfCounterEnd { get { return (int)PerfCounters.TotalCounters; } } static internal string CreateFriendlyInstanceName(ServiceHostBase serviceHost) { // It is a shared instance across all services which have the default counter enabled return "_WCF_Admin"; } internal DefaultPerformanceCounters(ServiceHostBase serviceHost) { this.instanceName = DefaultPerformanceCounters.CreateFriendlyInstanceName(serviceHost); this.counters = new PerformanceCounter[(int)PerfCounters.TotalCounters]; for (int i = 0; i < (int)PerfCounters.TotalCounters; i++) { PerformanceCounter counter = PerformanceCounters.GetDefaultPerformanceCounter(this.perfCounterNames[i], this.instanceName); if (counter != null) { try { counter.RawValue = 0; this.counters[i] = counter; } #pragma warning suppress 56500 // covered by FxCOP catch (Exception e) { if (ExceptionUtility.IsFatal(e)) throw; if (DiagnosticUtility.ShouldTraceError) TraceUtility.TraceEvent(TraceEventType.Error, TraceCode.PerformanceCountersFailedForService, null, e); break; } } else { break; } } } internal bool Initialized { get { return this.counters != null; } } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- LineMetrics.cs
- Compiler.cs
- ReadonlyMessageFilter.cs
- PropertyEmitterBase.cs
- EntityFunctions.cs
- SystemKeyConverter.cs
- SrgsSubset.cs
- Converter.cs
- ProjectionCamera.cs
- WSSecurityPolicy.cs
- DataSourceProvider.cs
- ObjectItemCollectionAssemblyCacheEntry.cs
- Span.cs
- WebServiceHostFactory.cs
- RegisteredScript.cs
- ButtonPopupAdapter.cs
- StringFunctions.cs
- MessageEncodingBindingElementImporter.cs
- HttpCacheVaryByContentEncodings.cs
- PhysicalFontFamily.cs
- PeerInvitationResponse.cs
- ImageBrush.cs
- SqlColumnizer.cs
- StringUtil.cs
- BamlRecordReader.cs
- SoapSchemaExporter.cs
- PlaceHolder.cs
- HtmlLink.cs
- EncryptedReference.cs
- DbConnectionOptions.cs
- Mappings.cs
- ColorConvertedBitmap.cs
- ConfigXmlSignificantWhitespace.cs
- DataGridTextBox.cs
- ArrayElementGridEntry.cs
- EventsTab.cs
- DefaultObjectSerializer.cs
- Transform3D.cs
- Set.cs
- ObjectQueryState.cs
- ObjectQuery.cs
- TabletCollection.cs
- ListViewDeleteEventArgs.cs
- KeyValuePair.cs
- URLEditor.cs
- CodeTypeParameterCollection.cs
- CategoriesDocumentFormatter.cs
- ConditionValidator.cs
- CalendarBlackoutDatesCollection.cs
- sortedlist.cs
- SqlConnectionStringBuilder.cs
- DbModificationClause.cs
- XXXInfos.cs
- CollectionsUtil.cs
- SqlDataSourceRefreshSchemaForm.cs
- ImageAutomationPeer.cs
- DrawingContext.cs
- DbConnectionOptions.cs
- QilName.cs
- Soap12FormatExtensions.cs
- AbsoluteQuery.cs
- RC2CryptoServiceProvider.cs
- CodeTypeDelegate.cs
- DecoderExceptionFallback.cs
- SecondaryViewProvider.cs
- VoiceChangeEventArgs.cs
- AutomationAttributeInfo.cs
- TabControl.cs
- UserPreferenceChangedEventArgs.cs
- CodeDomDecompiler.cs
- DesignTimeXamlWriter.cs
- IDQuery.cs
- Calendar.cs
- Baml2006ReaderContext.cs
- MapPathBasedVirtualPathProvider.cs
- SiteOfOriginPart.cs
- ResourceDisplayNameAttribute.cs
- Int32Storage.cs
- DesignerActionHeaderItem.cs
- RegexInterpreter.cs
- XmlSchemaAll.cs
- URIFormatException.cs
- TreeNode.cs
- EventMappingSettingsCollection.cs
- VirtualPathProvider.cs
- KeyEventArgs.cs
- ArrangedElementCollection.cs
- DataGridSortCommandEventArgs.cs
- MethodToken.cs
- RelatedImageListAttribute.cs
- ProjectionPathBuilder.cs
- VisualStyleTypesAndProperties.cs
- ExtendedProperty.cs
- DesignSurfaceEvent.cs
- ByteAnimationBase.cs
- WebPartConnectionsCancelVerb.cs
- MatrixValueSerializer.cs
- ResourceReferenceExpression.cs
- Vars.cs
- AnnotationHighlightLayer.cs