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
- WinFormsComponentEditor.cs
- WebPartConnectionsConnectVerb.cs
- XmlHierarchicalEnumerable.cs
- SafeBitVector32.cs
- UriTemplateTable.cs
- UIElement3D.cs
- CodeTypeDelegate.cs
- XmlSchemaAttribute.cs
- FormClosedEvent.cs
- BlurBitmapEffect.cs
- COM2FontConverter.cs
- Expression.cs
- SystemWebExtensionsSectionGroup.cs
- OpCopier.cs
- _SecureChannel.cs
- ExpressionLink.cs
- CqlBlock.cs
- ShimAsPublicXamlType.cs
- MoveSizeWinEventHandler.cs
- TimeSpanMinutesOrInfiniteConverter.cs
- XmlStreamStore.cs
- RepeaterDataBoundAdapter.cs
- RtfControls.cs
- PersonalizationState.cs
- XmlSerializationWriter.cs
- InlineObject.cs
- WebZone.cs
- TrustLevelCollection.cs
- MessageHeaderException.cs
- FrugalList.cs
- DetailsViewInsertEventArgs.cs
- ListItemConverter.cs
- DataServiceException.cs
- TypeDependencyAttribute.cs
- XmlSchemaSimpleTypeList.cs
- ImageList.cs
- SpecularMaterial.cs
- QueuePathEditor.cs
- KoreanLunisolarCalendar.cs
- Annotation.cs
- ExpandButtonVisibilityConverter.cs
- XamlSerializationHelper.cs
- NameValuePair.cs
- QilReference.cs
- SqlError.cs
- Overlapped.cs
- DocumentGrid.cs
- Latin1Encoding.cs
- TextServicesDisplayAttribute.cs
- CodePageEncoding.cs
- QuaternionConverter.cs
- PaperSource.cs
- FlowDocument.cs
- SendingRequestEventArgs.cs
- OleDbStruct.cs
- OdbcParameter.cs
- NameObjectCollectionBase.cs
- MessageQueueCriteria.cs
- Setter.cs
- CodeBlockBuilder.cs
- SecurityContextSecurityTokenAuthenticator.cs
- Parameter.cs
- IntegerValidator.cs
- WebPartConnectionsEventArgs.cs
- SingleAnimation.cs
- SqlDataSourceSelectingEventArgs.cs
- CommentEmitter.cs
- LocationSectionRecord.cs
- LinqExpressionNormalizer.cs
- GuidTagList.cs
- IsolatedStorageFilePermission.cs
- ContactManager.cs
- ComponentDispatcher.cs
- SizeConverter.cs
- NavigationWindowAutomationPeer.cs
- PointCollection.cs
- FileDialogCustomPlace.cs
- GridViewColumn.cs
- SpeechRecognitionEngine.cs
- RenderContext.cs
- TextBoxAutoCompleteSourceConverter.cs
- KeyedCollection.cs
- Tablet.cs
- DbDeleteCommandTree.cs
- DefaultValueAttribute.cs
- DbInsertCommandTree.cs
- ExtensibleClassFactory.cs
- SrgsSemanticInterpretationTag.cs
- RectAnimationUsingKeyFrames.cs
- MessageBodyDescription.cs
- SystemIPv6InterfaceProperties.cs
- ObjectRef.cs
- SymDocumentType.cs
- StreamWriter.cs
- SqlRemoveConstantOrderBy.cs
- VSDExceptions.cs
- PrintController.cs
- DBCommand.cs
- WeakReferenceList.cs
- IPEndPoint.cs