Code:
/ DotNET / DotNET / 8.0 / untmp / whidbey / REDBITS / ndp / fx / src / Services / Monitoring / system / Diagnosticts / CounterSample.cs / 1 / CounterSample.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- namespace System.Diagnostics { using System.Diagnostics; using System; ////// A struct holding the raw data for a performance counter. /// public struct CounterSample { private long rawValue; private long baseValue; private long timeStamp; private long counterFrequency; private PerformanceCounterType counterType; private long timeStamp100nSec; private long systemFrequency; private long counterTimeStamp; // Dummy holder for an empty sample ////// public static CounterSample Empty = new CounterSample(0, 0, 0, 0, 0, 0, PerformanceCounterType.NumberOfItems32); ///[To be supplied.] ////// public CounterSample(long rawValue, long baseValue, long counterFrequency, long systemFrequency, long timeStamp, long timeStamp100nSec, PerformanceCounterType counterType) { this.rawValue = rawValue; this.baseValue = baseValue; this.timeStamp = timeStamp; this.counterFrequency = counterFrequency; this.counterType = counterType; this.timeStamp100nSec = timeStamp100nSec; this.systemFrequency = systemFrequency; this.counterTimeStamp = 0; } ///[To be supplied.] ////// public CounterSample(long rawValue, long baseValue, long counterFrequency, long systemFrequency, long timeStamp, long timeStamp100nSec, PerformanceCounterType counterType, long counterTimeStamp) { this.rawValue = rawValue; this.baseValue = baseValue; this.timeStamp = timeStamp; this.counterFrequency = counterFrequency; this.counterType = counterType; this.timeStamp100nSec = timeStamp100nSec; this.systemFrequency = systemFrequency; this.counterTimeStamp = counterTimeStamp; } ///[To be supplied.] ////// Raw value of the counter. /// public long RawValue { get { return this.rawValue; } } internal ulong UnsignedRawValue { get { return (ulong)this.rawValue; } } ////// Optional base raw value for the counter (only used if multiple counter based). /// public long BaseValue { get { return this.baseValue; } } ////// Raw system frequency /// public long SystemFrequency { get { return this.systemFrequency; } } ////// Raw counter frequency /// public long CounterFrequency { get { return this.counterFrequency; } } ////// Raw counter frequency /// public long CounterTimeStamp { get { return this.counterTimeStamp; } } ////// Raw timestamp /// public long TimeStamp { get { return this.timeStamp; } } ////// Raw high fidelity timestamp /// public long TimeStamp100nSec { get { return this.timeStamp100nSec; } } ////// Counter type /// public PerformanceCounterType CounterType { get { return this.counterType; } } ////// Static functions to calculate the performance value off the sample /// public static float Calculate(CounterSample counterSample) { return CounterSampleCalculator.ComputeCounterValue(counterSample); } ////// Static functions to calculate the performance value off the samples /// public static float Calculate(CounterSample counterSample, CounterSample nextCounterSample) { return CounterSampleCalculator.ComputeCounterValue(counterSample, nextCounterSample); } public override bool Equals(Object o) { return ( o is CounterSample) && Equals((CounterSample)o); } public bool Equals(CounterSample sample) { return (rawValue == sample.rawValue) && (baseValue == sample.baseValue) && (timeStamp == sample.timeStamp) && (counterFrequency == sample.counterFrequency) && (counterType == sample.counterType) && (timeStamp100nSec == sample.timeStamp100nSec) && (systemFrequency == sample.systemFrequency) && (counterTimeStamp == sample.counterTimeStamp); } public override int GetHashCode() { return rawValue.GetHashCode(); } public static bool operator ==(CounterSample a, CounterSample b) { return a.Equals(b); } public static bool operator !=(CounterSample a, CounterSample b) { return !(a.Equals(b)); } } }
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- DocumentGridContextMenu.cs
- StylusPointProperty.cs
- AppDomainFactory.cs
- SqlConnectionPoolProviderInfo.cs
- HtmlTableRow.cs
- PropertyGridCommands.cs
- XmlFormatExtensionPrefixAttribute.cs
- ArgumentNullException.cs
- TypedAsyncResult.cs
- NotifyParentPropertyAttribute.cs
- DataControlButton.cs
- LocalizedNameDescriptionPair.cs
- VolatileResourceManager.cs
- ModuleBuilderData.cs
- ToolStripPanelSelectionGlyph.cs
- DebugControllerThread.cs
- TreeView.cs
- HttpGetProtocolImporter.cs
- ResolvedKeyFrameEntry.cs
- SingleSelectRootGridEntry.cs
- Matrix3D.cs
- PocoEntityKeyStrategy.cs
- OdbcPermission.cs
- DoubleMinMaxAggregationOperator.cs
- PerformanceCounterManager.cs
- Misc.cs
- MsmqOutputChannel.cs
- AsyncCompletedEventArgs.cs
- CalendarAutoFormat.cs
- SimpleMailWebEventProvider.cs
- RegisteredDisposeScript.cs
- securitycriticaldataClass.cs
- CommonGetThemePartSize.cs
- DocumentSequenceHighlightLayer.cs
- ConfigurationCollectionAttribute.cs
- BufferModeSettings.cs
- TaskFormBase.cs
- TouchPoint.cs
- NamedPipeConnectionPoolSettings.cs
- OracleBFile.cs
- CodeTypeReferenceCollection.cs
- StylusEventArgs.cs
- DuplexSecurityProtocolFactory.cs
- DirtyTextRange.cs
- ImmutableCommunicationTimeouts.cs
- AmbientProperties.cs
- xml.cs
- CustomPopupPlacement.cs
- DataTableNameHandler.cs
- ObjectCache.cs
- FileDialogCustomPlace.cs
- InsufficientMemoryException.cs
- SelectionItemProviderWrapper.cs
- CompositeActivityMarkupSerializer.cs
- ObjectStateFormatter.cs
- IsolatedStorageFileStream.cs
- ExpandedWrapper.cs
- BamlMapTable.cs
- ManifestResourceInfo.cs
- SyntaxCheck.cs
- XmlDataDocument.cs
- DataGridViewLinkCell.cs
- WebDescriptionAttribute.cs
- DelegateCompletionCallbackWrapper.cs
- TriggerActionCollection.cs
- InputScopeManager.cs
- WebPartZoneDesigner.cs
- HttpHandlerActionCollection.cs
- ApplicationManager.cs
- Int32CollectionConverter.cs
- EventLog.cs
- UserPrincipalNameElement.cs
- UpdateTracker.cs
- CodeObjectCreateExpression.cs
- CodeGeneratorOptions.cs
- XmlNamespaceMappingCollection.cs
- CodeAssignStatement.cs
- WmlLinkAdapter.cs
- MethodBuilder.cs
- FileDialog_Vista_Interop.cs
- XmlSerializableServices.cs
- UnsafeNativeMethods.cs
- PackagePartCollection.cs
- XamlBrushSerializer.cs
- SectionRecord.cs
- ContainerUIElement3D.cs
- ApplicationServiceHelper.cs
- PageCodeDomTreeGenerator.cs
- ListBoxChrome.cs
- BCLDebug.cs
- PreProcessor.cs
- TdsParserStaticMethods.cs
- MSAAEventDispatcher.cs
- HashMembershipCondition.cs
- EngineSite.cs
- ParserContext.cs
- MapPathBasedVirtualPathProvider.cs
- SimpleHandlerFactory.cs
- DesignerUtility.cs
- EDesignUtil.cs