示例#1
0
        unsafe void AddDataset(byte *ptr, TargetProcessPointer nativeStartPosition, long offset, long length, bool isFirst, TargetProcessPointer nativeRootFuncInfoPosition)
        {
            using (DataSet dataSet = new DataSet(this, ptr + offset, length, nativeStartPosition, nativeRootFuncInfoPosition, isFirst, is64Bit)) {
                lock (this.dataWriter) {
                    this.dataWriter.WriteDataSet(dataSet);

                    if (usePerformanceCounters)
                    {
                        if (performanceCounterInstanceName == null)
                        {
                            performanceCounterInstanceName = PerformanceCounterDescriptor.GetProcessInstanceName(profilee.Id);
                        }

                        if (performanceCounterInstanceName == null)
                        {
                            usePerformanceCounters = false;
                            LogString("Warning: One or more performance counters could not be accessed. " +
                                      "Please ensure that the perfmon service is enabled and running. " +
                                      "If the problem still persists try rebuilding the performance counters " +
                                      "by executing \"lodctr /R\" from a command line with administrative rights.");
                        }
                    }

                    foreach (var counter in performanceCounters)
                    {
                        counter.Collect(performanceCounterInstanceName);
                    }
                }
            }
        }
示例#2
0
        private static CounterDescriptor CreateAllMethodRequestsDescriptor()
        {
            var pc = new PerformanceCounter("Web Service", "Total Method Requests/sec", "_Total", true);

            pc.NextValue();

            var pcd = new PerformanceCounterDescriptor
            {
                Name          = "Total",
                SystemCounter = pc,
                Unit          = "Count/Second",
                MetricName    = "Method Requests"
            };

            pcd.Dimensions.Add("SiteName", "Total");

            return(pcd);
        }
示例#3
0
        unsafe void AddDataset(byte *ptr, TargetProcessPointer nativeStartPosition, long offset, long length, bool isFirst, TargetProcessPointer nativeRootFuncInfoPosition)
        {
            using (DataSet dataSet = new DataSet(this, ptr + offset, length, nativeStartPosition, nativeRootFuncInfoPosition, isFirst, is64Bit)) {
                lock (this.dataWriter) {
                    this.dataWriter.WriteDataSet(dataSet);

                    if (performanceCounterInstanceName == null)
                    {
                        performanceCounterInstanceName = PerformanceCounterDescriptor.GetProcessInstanceName(profilee.Id);
                    }

                    if (performanceCounterInstanceName == null)
                    {
                        LogString("instance not found!");
                    }

                    foreach (var counter in performanceCounters)
                    {
                        counter.Collect(performanceCounterInstanceName);
                    }
                }
            }
        }