/mobile Handheld Friendly website

 performance measurements

Each table row shows performance measurements for this Ada 2005 GNAT program with a particular command-line input value N.

 N  CPU secs Elapsed secs Memory KB Code B ≈ CPU Load
500,0005.603.889,836560  60% 8% 6% 55%
5,000,00054.6037.509,840560  56% 7% 6% 56%
50,000,000538.63371.939,840560  22% 38% 38% 21%

Read the ↓ make, command line, and program output logs to see how this program was run.

Read thread-ring benchmark to see what this program should do.


GNAT 4.6

gcc version 4.8.1 (Ubuntu/Linaro 4.8.1-10ubuntu8)

 thread-ring Ada 2005 GNAT #2 program source code

-- The Computer Language Benchmarks Game
-- http://benchmarksgame.alioth.debian.org/
-- Contributed by Jacob Sparre Andersen (with help from Alex Mason)
-- Compile with:
--    gnatmake -gnat05 -gnatE -gnato -gnatv -gnati1 -gnatf -m -O3 -funroll-loops -funwind-tables -gnatn -fomit-frame-pointer -march=native thread_ring

with Ada.Text_IO;
with Ada.Command_line;

procedure ThreadRing is
   Ring_Size : constant := 503;
   type Ring_Index is mod Ring_Size;

   package Ring_Text_IO is new Ada.Text_IO.Modular_IO (Ring_Index);

   protected type Store is
      entry Put  (Item : in     Integer);
      entry Take (Item :    out Integer);
      Value : Integer;
      Full  : Boolean := False;
   end Store;

   protected body Store is
      entry Put (Item : in     Integer) when not Full is
         Value := Item;
         Full := True;
      end Put;

      entry Take (Item :    out Integer) when Full is
         Item := Value;
         Full := False;
      end Take;
   end Store;

   type Store_Ring is array (Ring_Index) of Store;
   Stores : Store_Ring;

   task type Node is
      entry Initialize (Identifier  : in     Ring_Index);
   end Node;

   task body Node is
      ID    : Ring_Index;
      Token : Integer;
      accept Initialize (Identifier  : in     Ring_Index) do
         ID := Identifier;
      end Initialize;

         Stores (ID).Take (Token);

         if Token = 0 then
            Ring_Text_IO.Put (ID, Width => 0);
         end if;

         Stores (ID + 1).Put (Token - 1);

         exit when Token < 0;
      end loop;
   end Node;

   type Node_Ring is array (Ring_Index) of Node;
   Nodes : Node_Ring;
   for ID in Nodes'Range loop
      Nodes (ID).Initialize (Identifier => ID);
   end loop;

   Stores (1).Put (Integer'Value (Ada.Command_Line.Argument (1)));
end ThreadRing;

 make, command-line, and program output logs

Sat, 19 Oct 2013 19:28:04 GMT

/usr/bin/gnatchop -r -w threadring.gnat-2.gnat
splitting threadring.gnat-2.gnat into:
/usr/bin/gnatmake -O3 -fomit-frame-pointer -march=native -msse3 -mfpmath=sse -gnatNp -f threadring.adb -o threadring.gnat-2.gnat_run 
gcc-4.6 -c -O3 -fomit-frame-pointer -march=native -msse3 -mfpmath=sse -gnatNp threadring.adb
gnatbind -x threadring.ali
gnatlink threadring.ali -O3 -fomit-frame-pointer -march=native -msse3 -mfpmath=sse -o threadring.gnat-2.gnat_run
0.46s to complete and log all make actions

./threadring.gnat-2.gnat_run 50000000


Revised BSD license

  Home   Conclusions   License   Play