<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Recent changes to Task Statistics Tutorial</title><link>https://sourceforge.net/p/thimble/wiki/Task%2520Statistics%2520Tutorial/</link><description>Recent changes to Task Statistics Tutorial</description><atom:link href="https://sourceforge.net/p/thimble/wiki/Task%20Statistics%20Tutorial/feed" rel="self"/><language>en</language><lastBuildDate>Sun, 09 Dec 2012 16:33:51 -0000</lastBuildDate><atom:link href="https://sourceforge.net/p/thimble/wiki/Task%20Statistics%20Tutorial/feed" rel="self" type="application/rss+xml"/><item><title>WikiPage Task Statistics Tutorial modified by Ramon Servadei</title><link>https://sourceforge.net/p/thimble/wiki/Task%2520Statistics%2520Tutorial/</link><description>&lt;pre&gt;--- v4
+++ v5
@@ -17,7 +17,7 @@
             {
                 System.out.println(executor.getSequentialTaskStatistics());
                 System.out.println(executor.getCoalescingTaskStatistics());
-                System.out.println(executor.getStatistics());
+                System.out.println(executor.getExecutorStatistics());
                 System.out.println("--------------------------------------------------------");
             }
         }, 0, 50, TimeUnit.MILLISECONDS);
&lt;/pre&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Ramon Servadei</dc:creator><pubDate>Sun, 09 Dec 2012 16:33:51 -0000</pubDate><guid>https://sourceforge.net6662174dd82efdcded163fae5a4cd5cdcd84145a</guid></item><item><title>WikiPage Task Statistics Tutorial modified by Ramon Servadei</title><link>https://sourceforge.net/p/thimble/wiki/Task%2520Statistics%2520Tutorial/</link><description>&lt;pre&gt;--- v3
+++ v4
@@ -18,6 +18,7 @@
                 System.out.println(executor.getSequentialTaskStatistics());
                 System.out.println(executor.getCoalescingTaskStatistics());
                 System.out.println(executor.getStatistics());
+                System.out.println("--------------------------------------------------------");
             }
         }, 0, 50, TimeUnit.MILLISECONDS);
 
@@ -93,7 +94,7 @@
         }
         latch.await();
         statsService.shutdown();
-
+        Thread.sleep(1000);
         System.out.println(executor.getSequentialTaskStatistics());
         System.out.println(executor.getCoalescingTaskStatistics());
         System.out.println(executor.getStatistics());
@@ -104,17 +105,21 @@
 The output shows the toString version of the TaskStatistics objects...
 
 ~~~~~
+{}
 {coalescing context 1=TaskStatistics [context=coalescing context 1, intervalSubmitted=1, intervalExecuted=0, totalSubmitted=1, totalExecuted=0]}
-TaskStatistics [context=ThimbleExecutor, intervalSubmitted=1, intervalExecuted=0, totalSubmitted=1, totalExecuted=0]
-{sequential context 2=TaskStatistics [context=sequential context 2, intervalSubmitted=2408, intervalExecuted=1921, totalSubmitted=2408, totalExecuted=1921], sequential context 1=TaskStatistics [context=sequential context 1, intervalSubmitted=2409, intervalExecuted=2092, totalSubmitted=2409, totalExecuted=2092]}
-{coalescing context 2=TaskStatistics [context=coalescing context 2, intervalSubmitted=2435, intervalExecuted=179, totalSubmitted=2435, totalExecuted=179], coalescing context 1=TaskStatistics [context=coalescing context 1, intervalSubmitted=2434, intervalExecuted=294, totalSubmitted=2435, totalExecuted=294]}
-TaskStatistics [context=ThimbleExecutor, intervalSubmitted=12318, intervalExecuted=6882, totalSubmitted=12319, totalExecuted=6882]
-{sequential context 2=TaskStatistics [context=sequential context 2, intervalSubmitted=3680, intervalExecuted=4167, totalSubmitted=6088, totalExecuted=6088], sequential context 1=TaskStatistics [context=sequential context 1, intervalSubmitted=3679, intervalExecuted=3996, totalSubmitted=6088, totalExecuted=6088]}
-{coalescing context 2=TaskStatistics [context=coalescing context 2, intervalSubmitted=3668, intervalExecuted=1212, totalSubmitted=6103, totalExecuted=1391], coalescing context 1=TaskStatistics [context=coalescing context 1, intervalSubmitted=3668, intervalExecuted=926, totalSubmitted=6103, totalExecuted=1220]}
-TaskStatistics [context=ThimbleExecutor, intervalSubmitted=18259, intervalExecuted=14036, totalSubmitted=30578, totalExecuted=20918]
-{sequential context 2=TaskStatistics [context=sequential context 2, intervalSubmitted=3912, intervalExecuted=3912, totalSubmitted=10000, totalExecuted=10000], sequential context 1=TaskStatistics [context=sequential context 1, intervalSubmitted=3912, intervalExecuted=3912, totalSubmitted=10000, totalExecuted=10000]}
-{coalescing context 2=TaskStatistics [context=coalescing context 2, intervalSubmitted=3897, intervalExecuted=1936, totalSubmitted=10000, totalExecuted=3327], coalescing context 1=TaskStatistics [context=coalescing context 1, intervalSubmitted=3897, intervalExecuted=1893, totalSubmitted=10000, totalExecuted=3113]}
-TaskStatistics [context=ThimbleExecutor, intervalSubmitted=19421, intervalExecuted=15500, totalSubmitted=49999, totalExecuted=36418]
+TaskStatistics [context=ThimbleExecutor, intervalSubmitted=1, intervalExecuted=1, totalSubmitted=1, totalExecuted=1]
+--------------------------------------------------------
+{sequential context 2=TaskStatistics [context=sequential context 2, intervalSubmitted=3408, intervalExecuted=1628, totalSubmitted=3408, totalExecuted=1628], sequential context 1=TaskStatistics [context=sequential context 1, intervalSubmitted=3409, intervalExecuted=1658, totalSubmitted=3409, totalExecuted=1658]}
+{coalescing context 2=TaskStatistics [context=coalescing context 2, intervalSubmitted=3427, intervalExecuted=681, totalSubmitted=3427, totalExecuted=681], coalescing context 1=TaskStatistics [context=coalescing context 1, intervalSubmitted=3427, intervalExecuted=679, totalSubmitted=3428, totalExecuted=679]}
+TaskStatistics [context=ThimbleExecutor, intervalSubmitted=17189, intervalExecuted=8084, totalSubmitted=17190, totalExecuted=8085]
+--------------------------------------------------------
+{sequential context 2=TaskStatistics [context=sequential context 2, intervalSubmitted=4446, intervalExecuted=5516, totalSubmitted=7854, totalExecuted=7144], sequential context 1=TaskStatistics [context=sequential context 1, intervalSubmitted=4446, intervalExecuted=5605, totalSubmitted=7855, totalExecuted=7263]}
+{coalescing context 2=TaskStatistics [context=coalescing context 2, intervalSubmitted=4477, intervalExecuted=1513, totalSubmitted=7904, totalExecuted=2194], coalescing context 1=TaskStatistics [context=coalescing context 1, intervalSubmitted=4476, intervalExecuted=1483, totalSubmitted=7904, totalExecuted=2162]}
+TaskStatistics [context=ThimbleExecutor, intervalSubmitted=24590, intervalExecuted=19477, totalSubmitted=41780, totalExecuted=27562]
+--------------------------------------------------------
+{sequential context 2=TaskStatistics [context=sequential context 2, intervalSubmitted=2146, intervalExecuted=2856, totalSubmitted=10000, totalExecuted=10000], sequential context 1=TaskStatistics [context=sequential context 1, intervalSubmitted=2145, intervalExecuted=2737, totalSubmitted=10000, totalExecuted=10000]}
+{coalescing context 2=TaskStatistics [context=coalescing context 2, intervalSubmitted=2096, intervalExecuted=605, totalSubmitted=10000, totalExecuted=2799], coalescing context 1=TaskStatistics [context=coalescing context 1, intervalSubmitted=2096, intervalExecuted=677, totalSubmitted=10000, totalExecuted=2839]}
+TaskStatistics [context=ThimbleExecutor, intervalSubmitted=8220, intervalExecuted=8006, totalSubmitted=50000, totalExecuted=35568]
 ~~~~~
 
 Looking at the final statistics in the output, we get the total statistics as follows:
@@ -123,8 +128,8 @@
 --------|-----------------|---------------
 sequential context 1 | 10000 | 10000
 sequential context 2 | 10000 | 10000
-coalescing context 1 | 10000 | 3113
-coalescing context 2 | 10000 | 3327
-total for executor | 49999 | 36418
+coalescing context 1 | 10000 | 2839
+coalescing context 2 | 10000 | 2799
+total for executor | 50000| 35568
 
 *Note* that the individual statistics can be obtained using getXXX methods on the TaskStatistics object (see code javadocs). This can be used to produce CSV style data that can be plotted using spreadsheet software to produce a graph of the executor performance.
&lt;/pre&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Ramon Servadei</dc:creator><pubDate>Sun, 09 Dec 2012 16:32:43 -0000</pubDate><guid>https://sourceforge.nete36994a743e8a35780b0a4effa975caa89b51eef</guid></item><item><title>WikiPage Task Statistics Tutorial modified by Ramon Servadei</title><link>https://sourceforge.net/p/thimble/wiki/Task%2520Statistics%2520Tutorial/</link><description>&lt;pre&gt;--- v2
+++ v3
@@ -101,7 +101,7 @@
 }
 ~~~~~
 
-The output
+The output shows the toString version of the TaskStatistics objects...
 
 ~~~~~
 {coalescing context 1=TaskStatistics [context=coalescing context 1, intervalSubmitted=1, intervalExecuted=0, totalSubmitted=1, totalExecuted=0]}
@@ -116,3 +116,15 @@
 {coalescing context 2=TaskStatistics [context=coalescing context 2, intervalSubmitted=3897, intervalExecuted=1936, totalSubmitted=10000, totalExecuted=3327], coalescing context 1=TaskStatistics [context=coalescing context 1, intervalSubmitted=3897, intervalExecuted=1893, totalSubmitted=10000, totalExecuted=3113]}
 TaskStatistics [context=ThimbleExecutor, intervalSubmitted=19421, intervalExecuted=15500, totalSubmitted=49999, totalExecuted=36418]
 ~~~~~
+
+Looking at the final statistics in the output, we get the total statistics as follows:
+
+context | total submitted | total executed
+--------|-----------------|---------------
+sequential context 1 | 10000 | 10000
+sequential context 2 | 10000 | 10000
+coalescing context 1 | 10000 | 3113
+coalescing context 2 | 10000 | 3327
+total for executor | 49999 | 36418
+
+*Note* that the individual statistics can be obtained using getXXX methods on the TaskStatistics object (see code javadocs). This can be used to produce CSV style data that can be plotted using spreadsheet software to produce a graph of the executor performance.
&lt;/pre&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Ramon Servadei</dc:creator><pubDate>Sun, 09 Dec 2012 16:25:46 -0000</pubDate><guid>https://sourceforge.net730a0f9380df0f414595189ee3fb9bc9ee57c84f</guid></item><item><title>WikiPage Task Statistics Tutorial modified by Ramon Servadei</title><link>https://sourceforge.net/p/thimble/wiki/Task%2520Statistics%2520Tutorial/</link><description>&lt;pre&gt;&lt;/pre&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Ramon Servadei</dc:creator><pubDate>Sun, 09 Dec 2012 16:12:14 -0000</pubDate><guid>https://sourceforge.netede2aa35d16c8390eb6759cb8da1fb4dc44b4001</guid></item><item><title>WikiPage Statistics Tutorial modified by Ramon Servadei</title><link>https://sourceforge.net/p/thimble/wiki/Statistics%2520Tutorial/</link><description>A ThimbleExecutor can provide statistics covering the number of tasks submitted and executed in an interval. An interval is defined by successive calls to the 'get statistics' methods. It is up to application calling code to define the period for calling the statistics. The code below demonstrates how to gather statistics. In the demonstration 10,000 sequential and coalescing tasks for 2 contexts are run

~~~~~
:::java
public class StatisticsDemo
{
    public static void main(String[] args) throws Exception
    {
        final ThimbleExecutor executor = new ThimbleExecutor(4);

        // use a scheduled executor to periodically gather the statistics
        ScheduledExecutorService statsService = Executors.newSingleThreadScheduledExecutor();
        statsService.scheduleAtFixedRate(new Runnable()
        {
            @Override
            public void run()
            {
                System.out.println(executor.getSequentialTaskStatistics());
                System.out.println(executor.getCoalescingTaskStatistics());
                System.out.println(executor.getStatistics());
            }
        }, 0, 50, TimeUnit.MILLISECONDS);

        final int count = 10000;
        final CountDownLatch latch = new CountDownLatch(count * 3);
        for (int i = 0; i &lt; count; i++)
        {
            executor.execute(new ICoalescingRunnable()
            {
                @Override
                public void run()
                {
                    latch.countDown();
                }

                @Override
                public Object context()
                {
                    return "coalescing context 1";
                }
            });
            executor.execute(new ISequentialRunnable()
            {
                @Override
                public void run()
                {
                    latch.countDown();
                }

                @Override
                public Object context()
                {
                    return "sequential context 1";
                }
            });
            executor.execute(new Runnable()
            {
                
                @Override
                public void run()
                {
                    latch.countDown();
                }
            });
            executor.execute(new ICoalescingRunnable()
            {
                @Override
                public void run()
                {
                    latch.countDown();
                }

                @Override
                public Object context()
                {
                    return "coalescing context 2";
                }
            });
            executor.execute(new ISequentialRunnable()
            {
                @Override
                public void run()
                {
                    latch.countDown();
                }

                @Override
                public Object context()
                {
                    return "sequential context 2";
                }
            });
        }
        latch.await();
        statsService.shutdown();

        System.out.println(executor.getSequentialTaskStatistics());
        System.out.println(executor.getCoalescingTaskStatistics());
        System.out.println(executor.getStatistics());
    }
}
~~~~~

The output

~~~~~
{coalescing context 1=TaskStatistics [context=coalescing context 1, intervalSubmitted=1, intervalExecuted=0, totalSubmitted=1, totalExecuted=0]}
TaskStatistics [context=ThimbleExecutor, intervalSubmitted=1, intervalExecuted=0, totalSubmitted=1, totalExecuted=0]
{sequential context 2=TaskStatistics [context=sequential context 2, intervalSubmitted=2408, intervalExecuted=1921, totalSubmitted=2408, totalExecuted=1921], sequential context 1=TaskStatistics [context=sequential context 1, intervalSubmitted=2409, intervalExecuted=2092, totalSubmitted=2409, totalExecuted=2092]}
{coalescing context 2=TaskStatistics [context=coalescing context 2, intervalSubmitted=2435, intervalExecuted=179, totalSubmitted=2435, totalExecuted=179], coalescing context 1=TaskStatistics [context=coalescing context 1, intervalSubmitted=2434, intervalExecuted=294, totalSubmitted=2435, totalExecuted=294]}
TaskStatistics [context=ThimbleExecutor, intervalSubmitted=12318, intervalExecuted=6882, totalSubmitted=12319, totalExecuted=6882]
{sequential context 2=TaskStatistics [context=sequential context 2, intervalSubmitted=3680, intervalExecuted=4167, totalSubmitted=6088, totalExecuted=6088], sequential context 1=TaskStatistics [context=sequential context 1, intervalSubmitted=3679, intervalExecuted=3996, totalSubmitted=6088, totalExecuted=6088]}
{coalescing context 2=TaskStatistics [context=coalescing context 2, intervalSubmitted=3668, intervalExecuted=1212, totalSubmitted=6103, totalExecuted=1391], coalescing context 1=TaskStatistics [context=coalescing context 1, intervalSubmitted=3668, intervalExecuted=926, totalSubmitted=6103, totalExecuted=1220]}
TaskStatistics [context=ThimbleExecutor, intervalSubmitted=18259, intervalExecuted=14036, totalSubmitted=30578, totalExecuted=20918]
{sequential context 2=TaskStatistics [context=sequential context 2, intervalSubmitted=3912, intervalExecuted=3912, totalSubmitted=10000, totalExecuted=10000], sequential context 1=TaskStatistics [context=sequential context 1, intervalSubmitted=3912, intervalExecuted=3912, totalSubmitted=10000, totalExecuted=10000]}
{coalescing context 2=TaskStatistics [context=coalescing context 2, intervalSubmitted=3897, intervalExecuted=1936, totalSubmitted=10000, totalExecuted=3327], coalescing context 1=TaskStatistics [context=coalescing context 1, intervalSubmitted=3897, intervalExecuted=1893, totalSubmitted=10000, totalExecuted=3113]}
TaskStatistics [context=ThimbleExecutor, intervalSubmitted=19421, intervalExecuted=15500, totalSubmitted=49999, totalExecuted=36418]
~~~~~</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Ramon Servadei</dc:creator><pubDate>Sun, 09 Dec 2012 16:11:38 -0000</pubDate><guid>https://sourceforge.net65c3c5f8ea506a4c9b88c690fd8136cb62df6474</guid></item></channel></rss>