Code:
/ 4.0 / 4.0 / untmp / DEVDIV_TFS / Dev10 / Releases / RTMRel / wpf / src / Shared / MS / Utility / PerfService.cs / 1305600 / PerfService.cs
//---------------------------------------------------------------------------- //// Copyright (C) Microsoft Corporation. All rights reserved. // // // Description: Implements the Service class for perf diagnostics //--------------------------------------------------------------------------- using System; using System.Text; using System.Windows; using System.Collections.Generic; using Microsoft.Win32; using MS.Internal.PresentationCore; using MS.Internal; using MS.Utility; using MS.Win32.PresentationCore; using System.Reflection; namespace MS.Utility { [FriendAccessAllowed] static internal class PerfService { // Box the long to avoid JIT private static DictionaryperfElementIds = new Dictionary (); /// /// Perfservice uses this property to uniquely identfy each element in the tree. /// this ID gets traced with ETW traces and gets mapped to the element in the tool /// value is valid only if the service is running /// internal static long GetPerfElementID2(object element, string extraData) { object eltId = null; int hash = element.GetHashCode(); lock (perfElementIds) { if (!perfElementIds.TryGetValue(hash, out eltId)) { eltId = SafeNativeMethods.GetNextPerfElementId(); perfElementIds.Add(hash, eltId); // If this is the first time we see this object emit some useful info about it. if (EventTrace.IsEnabled(EventTrace.Keyword.KeywordGeneral, EventTrace.Level.Verbose)) { Type type = element.GetType(); Assembly asm = type.Assembly; EventTrace.EventProvider.TraceEvent(EventTrace.Event.PerfElementIDAssignment, EventTrace.Keyword.KeywordGeneral, EventTrace.Level.Verbose, (long)eltId, type.FullName, extraData, GetPerfElementID2(asm, asm.FullName)); } } } return (long)eltId; } internal static long GetPerfElementID(object element) { return GetPerfElementID2(element, string.Empty); } } } // 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
- ToolBar.cs
- WebPartConnectionsConfigureVerb.cs
- ConnectionStringSettings.cs
- SourceChangedEventArgs.cs
- SerTrace.cs
- WhitespaceRule.cs
- FixedSOMImage.cs
- BamlStream.cs
- TCPClient.cs
- EntityChangedParams.cs
- DefaultSection.cs
- ListViewItem.cs
- FileStream.cs
- FormsAuthenticationModule.cs
- CannotUnloadAppDomainException.cs
- wgx_sdk_version.cs
- TextOptions.cs
- RankException.cs
- TreeNodeClickEventArgs.cs
- OneOfTypeConst.cs
- ListBindingConverter.cs
- PermissionRequestEvidence.cs
- CodeSubDirectoriesCollection.cs
- AccessText.cs
- XmlChildEnumerator.cs
- HitTestParameters.cs
- Metadata.cs
- x509utils.cs
- MD5Cng.cs
- hwndwrapper.cs
- TabItemWrapperAutomationPeer.cs
- RawStylusInputReport.cs
- ADRoleFactory.cs
- StylusPlugin.cs
- ModifierKeysValueSerializer.cs
- SpeakInfo.cs
- DynamicValueConverter.cs
- MemberJoinTreeNode.cs
- TiffBitmapEncoder.cs
- X509CertificateChain.cs
- PieceDirectory.cs
- KeyFrames.cs
- PersonalizationDictionary.cs
- SqlWebEventProvider.cs
- HtmlEmptyTagControlBuilder.cs
- SoapObjectReader.cs
- TextTreeInsertUndoUnit.cs
- PolyBezierSegment.cs
- Int64Converter.cs
- NativeMethods.cs
- WebPartDisplayModeCollection.cs
- NegotiateStream.cs
- ServicePoint.cs
- FormViewPageEventArgs.cs
- ContextMenuAutomationPeer.cs
- Condition.cs
- ProtocolReflector.cs
- Propagator.JoinPropagator.SubstitutingCloneVisitor.cs
- GlyphRunDrawing.cs
- QueryCacheEntry.cs
- InkCanvasSelectionAdorner.cs
- EntityDataSourceUtil.cs
- DispatcherTimer.cs
- CacheHelper.cs
- TrustLevel.cs
- XpsS0ValidatingLoader.cs
- CacheDict.cs
- UpdateTracker.cs
- RuntimeHelpers.cs
- DisplayNameAttribute.cs
- SizeF.cs
- MissingSatelliteAssemblyException.cs
- TypeDescriptor.cs
- ListManagerBindingsCollection.cs
- ClientTarget.cs
- StringFormat.cs
- SqlUtils.cs
- XMLUtil.cs
- ControlParameter.cs
- BamlMapTable.cs
- DataGridViewCellMouseEventArgs.cs
- BaseHashHelper.cs
- Utils.cs
- QilInvokeEarlyBound.cs
- QueryOptionExpression.cs
- ImmComposition.cs
- ListDataHelper.cs
- SafeReversePInvokeHandle.cs
- hresults.cs
- WinFormsSecurity.cs
- WebScriptServiceHostFactory.cs
- ObjectDataSource.cs
- SafeCertificateContext.cs
- DbMetaDataFactory.cs
- FormViewDeleteEventArgs.cs
- CodeCompiler.cs
- DescriptionAttribute.cs
- BooleanExpr.cs
- SyndicationElementExtensionCollection.cs
- StylusSystemGestureEventArgs.cs