Ejemplo n.º 1
0
        public TccCoordinator(string transName)
        {
            _transName   = transName;
            _activeTrans = new Dictionary <string, TccTransaction <TContext> >();
            _tracing     = TracingManager.GetTracing("TccTransaction." + _transName);
            _counter     = IICPerformanceCounterFactory.GetCounters <TccTransactionPerfCounter>(transName);

            _monitorThread = new Thread(MonitorProc);
            _monitorThread.IsBackground = false;
            _monitorThread.Name         = "TccCoordinator.MonitorProc<" + _transName + ">";
        }
Ejemplo n.º 2
0
        static void Main(string[] args)
        {
            var _perfCounters = IICPerformanceCounterFactory.GetCounters <DatabasePerfCounters>(".");

            while (true)
            {
                _perfCounters.CommandFailedTotal.Increment();
                _perfCounters.CommandExecutedTotal.Increment();
                System.Threading.Thread.Sleep(1000);
            }
        }
Ejemplo n.º 3
0
        public void Sample2()         // V4 新增模式
        {
            IICPerformanceCounterCategory           category = new IICPerformanceCounterCategory("Imps:SampleCategory", PerformanceCounterCategoryType.MultiInstance);
            Dictionary <int, IICPerformanceCounter> counters = new Dictionary <int, IICPerformanceCounter>();

            for (int i = 0; i < 5; i++)
            {
                counters.Add(i, category.CreateCounter("SampleCounter-" + i, PerformanceCounterType.RateOfCountsPerSecond32));
            }
            IICPerformanceCounterFactory.GetCounters(category);

            for (int i = 0; i < 5; i++)
            {
                counters[i].Increment();
            }
        }
Ejemplo n.º 4
0
        public void Sample1()         // 旧有模式
        {
            SamplePerformanceCounter samplePerf = IICPerformanceCounterFactory.GetCounters <SamplePerformanceCounter>();

            samplePerf.SampleCounter.Increment();
        }