Exemplo n.º 1
0
        protected virtual void Dispose(bool disposing)
        {
            FwkTest <TKey, TVal> currTest = FwkTest <TKey, TVal> .CurrentTest;

            currTest.FwkInfo("DupChecker: validating");
            validate();
        }
Exemplo n.º 2
0
        private void check(EntryEvent <TKey, TVal> ev)
        {
            FwkTest <TKey, TVal> currTest = FwkTest <TKey, TVal> .CurrentTest;

            // CacheableInt32 value = ev.NewValue as CacheableInt32;
            Int32 value = (Int32)(object)ev.NewValue;

            if (value <= m_prevValue) // duplicate
            {
                //currTest.FwkInfo("DurableListener : duplicate value: " + value.Value);
            }
            else if (value == m_prevValue + 1) // desired
            {
                m_ops++;
                m_prevValue++;
            }
            else // event missed
            {
                currTest.FwkInfo("Missed event, expected {0}, actual {1}", m_prevValue + 1, value);
                m_prevValue = value;
                m_ops++;
                if (m_result)
                {
                    m_result = false;
                    m_err    = String.Format("Missed event with value {0}", value);
                    currTest.FwkInfo("Missed event, expected {0}, actual {1}", m_prevValue + 1, value);
                }
            }
        }
Exemplo n.º 3
0
        private void recalculate(EntryEvent <TKey, TVal> ev)
        {
            if (m_ops == 0)
            {
                m_startTime = DateTime.Now;
            }

            m_ops++;

            if (m_ops % 1000 == 0)
            {
                FwkTest <TKey, TVal> currTest = FwkTest <TKey, TVal> .CurrentTest;
                currTest.FwkInfo("DurablePerfListener : m_ops = " + m_ops);
            }

            DateTime currTime    = DateTime.Now;
            TimeSpan elapsedTime = currTime - m_prevTime;

            long diffTime = elapsedTime.Milliseconds;

            if (diffTime < m_minTime)
            {
                m_minTime = diffTime;
            }

            m_prevTime = currTime;
        }
Exemplo n.º 4
0
        public DurablePerfListener()
        {
            FwkTest <TKey, TVal> currTest = FwkTest <TKey, TVal> .CurrentTest;

            currTest.FwkInfo("DurablePerfListener: created");
            m_minTime  = 99999999;
            m_prevTime = DateTime.Now;
        }
Exemplo n.º 5
0
        public void logPerformance()
        {
            TimeSpan             totalTime   = m_prevTime - m_startTime;
            double               averageRate = m_ops / totalTime.TotalSeconds;
            double               maxRate     = 1000.0 / m_minTime;
            FwkTest <TKey, TVal> currTest    = FwkTest <TKey, TVal> .CurrentTest;

            currTest.FwkInfo("DurablePerfListener: # events = {0}, max rate = {1} events per second.", m_ops, maxRate);
            currTest.FwkInfo("DurablePerfListener: average rate = {0} events per second, total time {1} seconds", averageRate, totalTime.TotalSeconds);
        }
Exemplo n.º 6
0
        private void dumpToBB()
        {
            FwkTest <TKey, TVal> currTest = FwkTest <TKey, TVal> .CurrentTest;

            currTest.FwkInfo("DurableListener: updating blackboard, ops = {0}, prev = {1}", m_ops, m_prevValue);

            // increment count
            string bbkey   = m_clientName + "_Count";
            Int32  current = 0;

            try
            {
                current = (Int32)Util.BBGet("DURABLEBB", bbkey);
            }
            catch (Apache.Geode.DUnitFramework.KeyNotFoundException)
            {
                currTest.FwkInfo("Key not found for DURABLEBB {0}", bbkey);
            }
            current += m_ops;
            Util.BBSet("DURABLEBB", bbkey, current);
            currTest.FwkInfo("Current count for " + bbkey + " is " + current);

            // set current index
            string clientIndexKey = m_clientName + "_IDX";

            Util.BBSet("DURABLEBB", clientIndexKey, m_prevValue);

            // store error message
            if (!m_result && m_err != null && m_err.Length > 0)
            {
                string clientErrorKey = m_clientName + "_ErrMsg";
                string clientErrorVal = null;
                try
                {
                    clientErrorVal = (string)Util.BBGet("DURABLEBB", clientErrorKey);
                }
                catch (Apache.Geode.DUnitFramework.KeyNotFoundException)
                {
                    currTest.FwkInfo("Key not found for DURABLEBB {0}", clientErrorKey);
                }
                if (clientErrorVal == null || clientErrorVal.Length <= 0)
                {
                    Util.BBSet("DURABLEBB", clientErrorKey, m_err);
                }
            }
        }
Exemplo n.º 7
0
        public DurableListener()
        {
            FwkTest <TKey, TVal> currTest = FwkTest <TKey, TVal> .CurrentTest;

            m_clientName = String.Format("ClientName_{0}", Util.ClientNum);
            string clientIndexKey = m_clientName + "_IDX";

            try
            {
                m_prevValue = (Int32)Util.BBGet("DURABLEBB", clientIndexKey);
            }
            catch (Apache.Geode.DUnitFramework.KeyNotFoundException)
            {
                m_prevValue = 0;
                currTest.FwkInfo("Key not found for DURABLEBB {0}", clientIndexKey);
            }
            currTest.FwkInfo("DurableListener created for client {0} with prev val {1}", m_clientName, m_prevValue);
        }
Exemplo n.º 8
0
        private void validate()
        {
            FwkTest <TKey, TVal> currTest = FwkTest <TKey, TVal> .CurrentTest;

            currTest.FwkInfo("DupChecker: got {0} keys.", m_map.Count);

            currTest.FwkAssert(m_map.Count == 1000, "DupChecker: Expected 1000 keys for the region, actual is {0}.", m_map.Count);

            currTest.FwkInfo("DupChecker: got {0} ops.", m_ops);

            currTest.FwkAssert(m_ops == 1000000, "DupChecker: Expected 1,000,000 events (1000 per key) for the region, actual is {0}.",
                               m_ops);

            foreach (object item in m_map.Values)
            {
                int checkval = (int)item;
                currTest.FwkAssert(checkval == 1000, "DupChecker: Expected 1000 as final value, actual is {0}.", checkval);
            }
        }
Exemplo n.º 9
0
        private void check(EntryEvent <TKey, TVal> ev)
        {
            m_ops++;

            TKey key   = ev.Key;
            TVal value = ev.NewValue;

            FwkTest <TKey, TVal> currTest = FwkTest <TKey, TVal> .CurrentTest;

            if (m_map.ContainsKey((TKey)key))
            {
                TVal old = m_map[(TKey)key];

                currTest.FwkAssert(value.Equals(old), "DupChecker: Duplicate detected. Existing value is {0}, New value is {1}",
                                   old, value);
            }

            m_map[(TKey)key] = value;
        }
Exemplo n.º 10
0
        protected virtual void Dispose(bool disposing)
        {
            string tag;

            try
            {
                FwkTaskData taskData = (FwkTaskData)Util.BBGet(
                    "LatencyBB", "LatencyTag");
                tag = taskData.GetLogString();
            }
            catch (Apache.Geode.DUnitFramework.KeyNotFoundException)
            {
                tag = null;
            }
            if (tag == null)
            {
                tag = "No tag found";
            }
            long avgLatency = 0;
            FwkTest <TKey, TVal> currTest = FwkTest <TKey, TVal> .CurrentTest;

            if (m_samples != 0)
            {
                avgLatency = m_totLatency / (long)m_samples;
                currTest.FwkInfo("LatencyCSV,MinMaxAvgSamples,{0},{1},{2},{3},{4}",
                                 tag, m_minLatency, m_maxLatency, avgLatency, m_samples);
                currTest.FwkInfo("LatencySuite: {0} results: {1} min, {2} max, {3} avg, {4} samples. {5}",
                                 tag, m_minLatency, m_maxLatency, avgLatency, m_samples, m_totLatency);
                currTest.FwkInfo("Latency listener counters for {0}  afterCreate: {1}, afterUpdate: {2}",
                                 tag, m_numAfterCreate, m_numAfterUpdate);
            }
            else
            {
                currTest.FwkInfo("LatencySuite: {0} results: NO DATA SAMPLES TO REPORT ON.", tag);
                currTest.FwkInfo("Latency listener counters for {0}  afterCreate: {1}, afterUpdate: {2}",
                                 tag, m_numAfterCreate, m_numAfterUpdate);
            }
        }
Exemplo n.º 11
0
        public DupChecker()
        {
            FwkTest <TKey, TVal> currTest = FwkTest <TKey, TVal> .CurrentTest;

            currTest.FwkInfo("DupChecker: created");
        }
Exemplo n.º 12
0
        public override void AfterRegionLive(RegionEvent <TKey, TVal> ev)
        {
            FwkTest <TKey, TVal> currTest = FwkTest <TKey, TVal> .CurrentTest;

            currTest.FwkInfo("DurableListener: AfterRegionLive invoked");
        }