Here are they are:

Index:
U:/workspace/JMeter_2.2/src/core/org/apache/jmeter/engine/StandardJMeterEngine.java
===================================================================
---
U:/workspace/JMeter_2.2/src/core/org/apache/jmeter/engine/StandardJMeterEngine.java
      (revision 481097)
+++
U:/workspace/JMeter_2.2/src/core/org/apache/jmeter/engine/StandardJMeterEngine.java
      (working copy)
@@ -34,9 +34,11 @@
 import org.apache.jmeter.testelement.TestElement;
 import org.apache.jmeter.testelement.TestListener;
 import org.apache.jmeter.testelement.TestPlan;
+import org.apache.jmeter.threads.JMeterContext;
 import org.apache.jmeter.threads.JMeterContextService;
 import org.apache.jmeter.threads.JMeterThread;
 import org.apache.jmeter.threads.JMeterThreadMonitor;
+import org.apache.jmeter.threads.JMeterVariables;
 import org.apache.jmeter.threads.ListenerNotifier;
 import org.apache.jmeter.threads.TestCompiler;
 import org.apache.jmeter.threads.ThreadGroup;
@@ -142,12 +144,16 @@
      }

      // End of code to allow engine to be controlled remotely
+
+    // Map to keep track of how many dynamic threads were started from a
given thread
+    private static HashMap dynamicThreads;

      public StandardJMeterEngine() {
            allThreads = new HashMap();
            engine = this;
            allThreadNames = new HashMap();
            allThreadsSave = allThreads;
+        dynamicThreads = new HashMap();
      }

      public StandardJMeterEngine(String host) {
@@ -351,6 +357,7 @@

            schcdule_run = true;
            JMeterContextService.getContext().setSamplingStarted(true);
+
            int groupCount = 0;
         JMeterContextService.clearTotalThreads();
            while (iter.hasNext()) {
@@ -410,6 +417,53 @@
                  }
            }
      }
+
+    public static void createDynamicJMeterThread( JMeterThread
cloneThread,
+        JMeterVariables variables ) {
+        // if the engine is not running, we can't add a thread, so return
+        StandardJMeterEngine engine = cloneThread.getEngine();
+        if ( !engine.running )
+            return;
+
+        final JMeterThread jmeterThread = new JMeterThread(
+            engine.cloneTree( (ListedHashTree) cloneThread.getTestTree()
),
+            engine,
+            engine.notifier );
+        ThreadGroup cloneGroup = cloneThread.getThreadGroup();
+        jmeterThread.setThreadGroup( cloneGroup );
+        // add thread specific variables to context
+        JMeterContext context = JMeterContextService.getContext();
+//        context.setVariables( variables );
+        context.getVariables().putAll( variables );
+        jmeterThread.setInitialContext( context );
+        jmeterThread.setScheduled( false );
+
+        // append "dyn-i" to existing threadName so we can tell where the
+        // new thread was forked from
+        Integer dynNum = (Integer) dynamicThreads.get(
+            cloneThread.getThreadName() );
+        if ( dynNum == null ) //first dynamic thread spawned from this
thread
+            dynNum = new Integer( 1 );
+        else {
+            dynNum = new Integer( dynNum.intValue() +  1 ); // increment
+        }
+        dynamicThreads.put( cloneThread.getThreadName(), dynNum );
+        jmeterThread.setThreadNum( dynNum.intValue() );
+        jmeterThread.setThreadName( cloneThread.getThreadName() + " dyn-"
+            + dynNum.intValue() );
+
+        jmeterThread.setEngine( engine );
+        jmeterThread.setOnErrorStopTest( cloneGroup.getOnErrorStopTest()
);
+        jmeterThread.setOnErrorStopThread(
cloneGroup.getOnErrorStopThread() );
+
+        Thread newThread = new Thread( jmeterThread );
+        newThread.setName( jmeterThread.getThreadName() );
+        engine.allThreads.put( jmeterThread, newThread );
+        JMeterContextService.addTotalThreads( 1 );
+
+        // should not be scheduled, we want this thread to start
immediately
+        newThread.start();
+    }

      /**
       * This will schedule the time for the JMeterThread.

Index:
U:/workspace/JMeter_2.2/src/core/org/apache/jmeter/threads/JMeterContextService.java
===================================================================
---
U:/workspace/JMeter_2.2/src/core/org/apache/jmeter/threads/JMeterContextService.java
      (revision 481097)
+++
U:/workspace/JMeter_2.2/src/core/org/apache/jmeter/threads/JMeterContextService.java
      (working copy)
@@ -70,6 +70,7 @@
      static public void endTest() {//TODO should this be synchronized?
            testStart = 0;
            numberOfThreads = 0;
+        totalThreads = 0;
      }

      static public long getTestStartTime() {// NOT USED

Index:
U:/workspace/JMeter_2.2/src/core/org/apache/jmeter/threads/JMeterThread.java
===================================================================
---
U:/workspace/JMeter_2.2/src/core/org/apache/jmeter/threads/JMeterThread.java
      (revision 481097)
+++
U:/workspace/JMeter_2.2/src/core/org/apache/jmeter/threads/JMeterThread.java
      (working copy)
@@ -116,6 +116,10 @@
            notifier = note;
            running = true;
      }
+
+    public HashTree getTestTree() {
+        return testTree;
+    }

      public void setInitialContext(JMeterContext context) {
            threadVars.putAll(context.getVariables());
@@ -519,6 +523,11 @@
      public void setEngine(StandardJMeterEngine engine) {
            this.engine = engine;
      }
+
+    //hack to access StandardJMeterEngine from beanshell
+    public StandardJMeterEngine getEngine() {
+        return engine;
+    }

      /**
       * Should Test stop on sampler error?

Skyler Bingham
[EMAIL PROTECTED]
(602) 957-1650 x1139


                                                                       
             "jsm83"                                                   
             <[EMAIL PROTECTED]                                     
             br>                                                        To
                                       "jmeter-user"                   
             02/22/2007 03:13          <[email protected]>
             PM                                                         cc
                                                                       
                                                                   Subject
             Please respond to         Re: JMeter Adaptive Test Issue  
               "JMeter Users                                           
                   List"                                               
             <[EMAIL PROTECTED]                                         
              rta.apache.org>                                      
                                                                       
                                                                       




Skyler.
I could you send me the patches again? I received only a .txt attached to
the message an those links at the bottom of the message don't work.

Thanks.
De:[EMAIL PROTECTED]

Para:"JMeter Users List" [email protected]

Cópia:

Data:Thu, 22 Feb 2007 10:36:32 -0700

Assunto:Re: JMeter Adaptive Test Issue

>
>
>
>
>
> Attached are the patches for the three files (sorry they are individual
> patches, but I made a bunch of other changes that you probably don't
want).
> I would change the way the new threads are named. Currently, dyn-n is
> appended to the name of the thread from which the
> createDynamicJMeterThread() method was called so that I could keep track
of
> which thread a new thread was spawned from. I would change this code to
> increment the ThreadGroup number and Thread number because when you have
> many recursive calls (like I do in my tests) the thread names can get a
bit
> unwieldy. Naming the new dynamic threads with ThreadGroup [ThreadGroup
> number + 1]-n would allow you keep track of where new threads are
launching
> from while maintaining a consistent naming convention.
>
> Here is an example of how to use this in a beanshell
> sampler/(pre|post)processor:
>
> // get JMeterThread from context
> thread = ctx.getThread();
> engine = thread.getEngine();
>
> _vars = new JMeterVariables();
> // add some thread specific variables here
> _vars.put( "USER", username );
> _vars.put( "PASS", password );
>
> //launch thread
> engine.createDynamicJMeterThread( thread, _vars );
>
> Let me know if you have any questions.
> (See attached file: dynamic_threads_thread.patch)(See attached file:
> dynamic_threads_contextservice.patch)(See attached file:
> dynamic_threads_engine.patch)
> Skyler Bingham
> [EMAIL PROTECTED]
> (602) 957-1650 x1139
>
>
>
> "jsm83"
>
> br> To
> "jmeter-user"
> 02/22/2007 01:45
> PM cc
>
> Subject
> Please respond to Re: JMeter Adaptive Test Issue
> "JMeter Users
> List"
>
> rta.apache.org>
>
>
>
>
>
>
> Yes. I would like you to sendt it.
>
>
> Thankx
>
> ---------- Cabeçalho original -----------
>
> De: [EMAIL PROTECTED]
> Para: "JMeter Users List" [email protected]
> Cópia:
> Data: Thu, 22 Feb 2007 09:39:02 -0700
> Assunto: Re: JMeter Adaptive Test Issue
>
> >
> >
> >
> >
> > I was unable to find a way to do what you are attempting with JMeter,
so
> I
> > modified the JMeter 2.2 code to allow me to dynamically create new
> threads
> > at runtime. This is done by calling a new method on the
> > StandardJMeterEngine class using beanshell. This patch has not been
> added
> > to the JMeter build, but I can send it to you if you are interested.
> >
> > sebb, do you think this functionality would be useful to add to JMeter?
> If
> > so, I can clean up the patch and submit it.
> >
> > Skyler Bingham
> > [EMAIL PROTECTED]
> > (602) 957-1650 x1139
> >
> >
> >
>
> > "jsm83"
>
> >
>
> > br>
> To
> > "jmeter-user"
>
> > 02/22/2007 01:28
>
> > PM
> cc
> >
>
> >
> Subject
> > Please respond to JMeter Adaptive Test Issue
>
> > "JMeter Users
>
> > List"
>
> >
>
> > rta.apache.org>
>
> >
>
> >
>
> >
> >
> >
> >
> > Hi.
> > I need to make an adaptive test on a server.
> > The test starts with a simple HTTP request. Depending on the sample
time
> of
> > this request i want to increase the
> > load of the test.
> > For example:
> > I start with 10 thread users. If the sample time is low i want it to
> > increase to 30 threads users at runtime.
> >
> > How could i do that? Should i make a new Threadgroup start at runtime?
> How?
> >
> >
> > Thanks.
> >
> > Juliano
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> >
> >
> > This e-mail and files transmitted with it are confidential, and are
> > intended solely for the use of the individual or entity to whom this
> e-mail
> > is addressed. If you are not the intended recipient, or the employee or
> > agent responsible to deliver it to the intended recipient, you are
hereby
> > notified that any dissemination, distribution or copying of this
> > communication is strictly prohibited. If you are not one of the named
> > recipient(s) or otherwise have reason to believe that you received this
> > message in error, please immediately notify
[EMAIL PROTECTED]
> > by e-mail, and destroy the original message. Thank You.
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> >
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
>
> This e-mail and files transmitted with it are confidential, and are
> intended solely for the use of the individual or entity to whom this
e-mail
> is addressed. If you are not the intended recipient, or the employee or
> agent responsible to deliver it to the intended recipient, you are hereby
> notified that any dissemination, distribution or copying of this
> communication is strictly prohibited. If you are not one of the named
> recipient(s) or otherwise have reason to believe that you received this
> message in error, please immediately notify [EMAIL PROTECTED]
> by e-mail, and destroy the original message. Thank You.
>


This e-mail and files transmitted with it are confidential, and are
intended solely for the use of the individual or entity to whom this e-mail
is addressed.  If you are not the intended recipient, or the employee or
agent responsible to deliver it to the intended recipient, you are hereby
notified that any dissemination, distribution or copying of this
communication is strictly prohibited.  If you are not one of the named
recipient(s) or otherwise have reason to believe that you received this
message in error, please immediately notify [EMAIL PROTECTED]
 by e-mail, and destroy the original message.  Thank You.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to