public void CreateCounters() { PerfCounterFactory.AddPerfCounter(new PerfCounter(PerformanceObjectName, TotalOfRequestStr, "请求总数", PerformanceCounterType.NumberOfItems64)); PerfCounterFactory.AddPerfCounter(new PerfCounter(PerformanceObjectName, RateOfRequestStr, "每秒请求的数量", PerformanceCounterType.RateOfCountsPerSecond64)); PerfCounterFactory.AddPerfCounter(new PerfCounter(PerformanceObjectName, CountOfCurrentRequestStr, "当前并发请求量", PerformanceCounterType.RateOfCountsPerSecond64)); }
public override void Run(RuntimeContext context, IChannel channel) { IPerfCounter mainPoolCounter = PerfCounterFactory.Create(PerfCounterImplType.AutoPilot, "iperf_ex", "tds1", PerfCounterType.Number); IPerfCounter extraCouter = PerfCounterFactory.Create(PerfCounterImplType.Automatic, "iperf_ex", "tds2", PerfCounterType.Number); ProAndConsModel server = new ProAndConsModel(); Thread serverThread = new Thread(() => server.run(2, 2)); serverThread.Start(); while (true) { String workingDir = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); InstrumentationHelper.Info("location", workingDir); mainPoolCounter.Set(server.getPoolValue()); extraCouter.Set(server.getThreadNum()); Thread.Sleep(500); } }
private IPerfCounter __CreateCounter(string counterName) { return(PerfCounterFactory.Create(PerfCounterImplType.AutoPilot, sectionName, counterName, PerfCounterType.Number)); }
public void CountersCreated() { TotalOfRequest = PerfCounterFactory.Find(PerformanceObjectName, TotalOfRequestStr); RateOfRequest = PerfCounterFactory.Find(PerformanceObjectName, RateOfRequestStr); CountOfCurrentRequest = PerfCounterFactory.Find(PerformanceObjectName, CountOfCurrentRequestStr); }