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
- CorePropertiesFilter.cs
- ValidatorCollection.cs
- TrustManagerPromptUI.cs
- RootBrowserWindowProxy.cs
- ComponentSerializationService.cs
- CopyOnWriteList.cs
- StructuredTypeInfo.cs
- TabControlAutomationPeer.cs
- HostProtectionException.cs
- DeferredElementTreeState.cs
- SamlSecurityToken.cs
- BooleanStorage.cs
- SynchronizationContext.cs
- ImagingCache.cs
- RSAPKCS1KeyExchangeDeformatter.cs
- DataGridViewDataErrorEventArgs.cs
- Internal.cs
- ExecutionProperties.cs
- HuffmanTree.cs
- StrokeNodeData.cs
- UnmanagedMemoryStream.cs
- RowCache.cs
- EncoderNLS.cs
- XmlObjectSerializer.cs
- GraphicsState.cs
- TakeQueryOptionExpression.cs
- ConnectionPoint.cs
- EventMappingSettingsCollection.cs
- Camera.cs
- WCFBuildProvider.cs
- StorageInfo.cs
- RenderingBiasValidation.cs
- SafeUserTokenHandle.cs
- ByteStack.cs
- MediaPlayerState.cs
- TextElementEnumerator.cs
- ProxyHwnd.cs
- DataGridViewSelectedCellsAccessibleObject.cs
- XPathMessageFilterElementComparer.cs
- FragmentQuery.cs
- PkcsMisc.cs
- AdornedElementPlaceholder.cs
- SmiEventSink_DeferedProcessing.cs
- PngBitmapEncoder.cs
- SequenceDesignerAccessibleObject.cs
- _NestedSingleAsyncResult.cs
- ResolveNameEventArgs.cs
- TextureBrush.cs
- UnhandledExceptionEventArgs.cs
- XamlPathDataSerializer.cs
- TransformerTypeCollection.cs
- LassoHelper.cs
- CodeDOMUtility.cs
- Padding.cs
- ParserHooks.cs
- HashMembershipCondition.cs
- BasicExpressionVisitor.cs
- TypeConverterMarkupExtension.cs
- _HTTPDateParse.cs
- BindToObject.cs
- MSAANativeProvider.cs
- XmlDataDocument.cs
- SchemaImporterExtensionsSection.cs
- TextBoxAutoCompleteSourceConverter.cs
- ToolStripGripRenderEventArgs.cs
- pingexception.cs
- VirtualPathProvider.cs
- SAPIEngineTypes.cs
- Profiler.cs
- PropertyCondition.cs
- XsdDateTime.cs
- XPathMultyIterator.cs
- AnnotationAuthorChangedEventArgs.cs
- DataControlFieldCollection.cs
- TransformPattern.cs
- CssClassPropertyAttribute.cs
- complextypematerializer.cs
- OleDbCommand.cs
- FontFamilyValueSerializer.cs
- SmiMetaDataProperty.cs
- FaultBookmark.cs
- MediaTimeline.cs
- ValueUtilsSmi.cs
- EntityTypeEmitter.cs
- AsymmetricAlgorithm.cs
- XPathNode.cs
- QilLoop.cs
- ProxyDataContractResolver.cs
- InputReferenceExpression.cs
- DateTime.cs
- SqlSupersetValidator.cs
- MenuStrip.cs
- TrailingSpaceComparer.cs
- LineServicesRun.cs
- ZipIOBlockManager.cs
- SemaphoreFullException.cs
- ADRole.cs
- TextTrailingWordEllipsis.cs
- Merger.cs
- InvalidOleVariantTypeException.cs