Ejemplo n.º 1
0
 /**
  * Notify a list of listeners that a sample has occurred.
  *
  * @param res
  *            the sample event that has occurred. Must be non-null.
  * @param listeners
  *            a list of the listeners which should be notified. This list
  *            must not be null and must contain only SampleListener
  *            elements.
  */
 public void notifyListeners(ExecutionEvent res, List<ExecutionListener> listeners)
 {
     foreach (ExecutionListener sampleListener in listeners)
     {
         try
         {
             TestBeanHelper.prepare((TestElement) sampleListener);
             sampleListener.ExecutionOccurred(res);
         }
         catch (Exception e)
         {
             //log.error("Detected problem in Listener: ", e);
             //log.info("Continuing to process further listeners");
         }
     }
 }
Ejemplo n.º 2
0
 private void NotifyListeners(List<ExecutionListener> listeners, ExecuteResult result)
 {
     ExecutionEvent sampleEvent = new ExecutionEvent(result, threadGroup.GetName(), threadVars);
     notifier.notifyListeners(sampleEvent, listeners);
 }
Ejemplo n.º 3
0
        /**
         * Accumulates the sample in two SampleResult objects - one for running
         * totals, and the other for deltas.
         *
         * @see org.apache.jmeter.samplers.SampleListener#sampleOccurred(org.apache.jmeter.samplers.SampleEvent)
         */
        public void ExecutionOccurred(ExecutionEvent e)
        {
            ExecuteResult s = e.getResult();

            Int64 now = DateTime.Now.Ticks;// in seconds

            RunningSample myDelta = null;
            RunningSample myTotal = null;
            Boolean reportNow = false;

            /*
             * Have we reached the reporting boundary?
             * Need to allow for a margin of error, otherwise can miss the slot.
             * Also need to check we've not hit the window already
             */
            Monitor.Enter(myTotals);
            try
            {
                if (s != null)
                {
                    myTotals.delta.AddSample(s);
                }

                if ((now > myTotals.last + INTERVAL_WINDOW) && (now % INTERVAL <= INTERVAL_WINDOW))
                {
                    reportNow = true;

                    // copy the data to minimise the synch time
                    myDelta = new RunningSample(myTotals.delta);
                    myTotals.MoveDelta();
                    myTotal = new RunningSample(myTotals.total);

                    myTotals.last = now; // stop double-reporting
                }
            }
            finally
            {
                Monitor.Exit(myTotals);
            }

            if (reportNow)
            {
                String str;
                str = Format(myName, myDelta, "+");
                if (TOLOG)
                {
                    log.Info(str);
                }
                if (TOCONSOLE)
                {
                    System.Console.WriteLine(str);
                }

                // Only if we have updated them
                if (myTotal != null && myDelta != null &&myTotal.getNumSamples() != myDelta.getNumSamples())
                {
                    str = Format(myName, myTotal, "=");
                    if (TOLOG)
                    {
                        log.Info(str);
                    }
                    if (TOCONSOLE)
                    {
                        System.Console.WriteLine(str);
                    }
                }
            }
        }