Example #1
0
        void createType(StatisticsFactory statFactory, TestStatisticsType testType)
        {
            StatisticDescriptor[] statDescriptorArr = new StatisticDescriptor[6];

            statDescriptorArr[0] = statFactory.CreateIntCounter("IntCounter",
                                                                "Test Statistic Descriptor int_t Counter.", "TestUnit");

            statDescriptorArr[1] = statFactory.CreateIntGauge("IntGauge",
                                                              "Test Statistic Descriptor int_t Gauge.", "TestUnit");

            statDescriptorArr[2] = statFactory.CreateLongCounter("LongCounter",
                                                                 "Test Statistic Descriptor Long Counter.", "TestUnit");

            statDescriptorArr[3] = statFactory.CreateLongGauge("LongGauge",
                                                               "Test Statistic Descriptor Long Gauge.", "TestUnit");

            statDescriptorArr[4] = statFactory.CreateDoubleCounter("DoubleCounter",
                                                                   "Test Statistic Descriptor Double Counter.", "TestUnit");

            statDescriptorArr[5] = statFactory.CreateDoubleGauge("DoubleGauge",
                                                                 "Test Statistic Descriptor Double Gauge.", "TestUnit");

            StatisticsType statsType = statFactory.CreateType("TestStatsType",
                                                              "Statistics for Unit Test.", statDescriptorArr, 6);

            Assert.IsNotNull(statsType, "Error in creating Stats Type");

            testType.testStatsType       = statsType;
            testType.statIdIntCounter    = statsType.NameToId("IntCounter");
            testType.statIdIntGauge      = statsType.NameToId("IntGauge");
            testType.statIdLongCounter   = statsType.NameToId("LongCounter");
            testType.statIdLongGauge     = statsType.NameToId("LongGauge");
            testType.statIdDoubleCounter = statsType.NameToId("DoubleCounter");
            testType.statIdDoubleGauge   = statsType.NameToId("DoubleGauge");

            StatisticsType statsType1 = statFactory.CreateType("TestStatsType1",
                                                               "Statistics for Unit Test", statDescriptorArr, 6);

            testType.testStatsType = statsType1;

            /* Test Find */
            Assert.IsNotNull(statFactory.FindType("TestStatsType"), "stat not found");
            Assert.IsNotNull(statFactory.FindType("TestStatsType1"), "stat not found");
            Assert.IsNull(statFactory.FindType("TestStatsType2"), "stat not to be found");
        }
Example #2
0
        public void EndCreate(long start, int amount, bool isMainWorkload)
        {
            long elapsed = ReturnTime() - start;

            if (isMainWorkload)
            {
                testStat.IncInt(statsType.NameToId(PerfOps.PERF_OPS), amount);
                testStat.IncLong(statsType.NameToId(PerfOps.PERF_OP_TIME), elapsed);
            }
            testStat.IncInt(statsType.NameToId(PerfOps.PERF_CREATES), amount);
            testStat.IncLong(statsType.NameToId(PerfOps.PERF_CREATE_TIME), elapsed);
        }