internal Dictionary <long, CounterInstanceData> CreateActorMethodCounterInstanceData( List <KeyValuePair <long, MethodInfo> > methodInfoList, PerformanceCounterInstanceNameBuilder percCounterInstanceNameBuilder) { var actorMethodCounterInstanceData = new Dictionary <long, CounterInstanceData>(); // Compute the counter instance names for all the actor methods var counterInstanceNames = percCounterInstanceNameBuilder.GetMethodCounterInstanceNames(methodInfoList); FabricPerformanceCounterSet actorMethodCounterSet; if (!AvaiableFabricCounterSet.TryGetValue(ActorPerformanceCounters.ActorMethodCategoryName, out actorMethodCounterSet)) { ActorTrace.Source.WriteWarning( TraceType, "PerformanceCounterSet not generated yet for category {0}", ActorPerformanceCounters.ActorMethodCategoryName); return(null); } foreach (var kvp in counterInstanceNames) { var data = new CounterInstanceData { InstanceName = kvp.Value }; data.CounterWriters = this.CreateCounterWriters(data, actorMethodCounterSet); actorMethodCounterInstanceData[kvp.Key] = data; } return (actorMethodCounterInstanceData); }
private void InitializeActorMethodInfo(DiagnosticsEventManager diagnosticsEventManager) { this.actorMethodCounterInstanceData = new Dictionary <long, CounterInstanceData>(); var methodInfoList = new List <KeyValuePair <long, MethodInfo> >(); foreach (var actorInterfaceType in this.actorTypeInformation.InterfaceTypes) { int interfaceId; MethodDescription[] actorInterfaceMethodDescriptions; diagnosticsEventManager.ActorMethodFriendlyNameBuilder.GetActorInterfaceMethodDescriptions(actorInterfaceType, out interfaceId, out actorInterfaceMethodDescriptions); foreach (var actorInterfaceMethodDescription in actorInterfaceMethodDescriptions) { var kvp = new KeyValuePair <long, MethodInfo>( DiagnosticsEventManager.GetInterfaceMethodKey((uint)interfaceId, (uint)actorInterfaceMethodDescription.Id), actorInterfaceMethodDescription.MethodInfo); methodInfoList.Add(kvp); } } // Compute the counter instance names for all the actor methods var percCounterInstanceNameBuilder = new PerformanceCounterInstanceNameBuilder(this.partitionId, this.counterInstanceDifferentiator); var counterInstanceNames = percCounterInstanceNameBuilder.GetMethodCounterInstanceNames(methodInfoList); foreach (var kvp in counterInstanceNames) { this.actorMethodCounterInstanceData[kvp.Key] = new CounterInstanceData { InstanceName = kvp.Value }; } }