From 33489b81d93dd0361661d2b6ae826257124a34dc Mon Sep 17 00:00:00 2001 From: David Zaragoza Date: Sun, 4 Dec 2016 19:29:13 +0100 Subject: [PATCH] Eiffel version with manual timing --- Makefile | 14 ++++++++++++ main.e | 70 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 84 insertions(+) create mode 100644 main.e diff --git a/Makefile b/Makefile index 86a5cf7..713271a 100644 --- a/Makefile +++ b/Makefile @@ -119,3 +119,17 @@ run-d: d analyze-d: @echo "Max Pause: " @cat d.log + +eiffel: main.e + /opt/estudio/studio/spec/linux-x86-64/bin/ec -finalize main.e -library time + chmod +x main + +clean:: + rm -rf main EIFGENs + +run-eiffel: eiffel + ./main > eiffel.log + cat eiffel.log + +analyze-eiffel: + @cat eiffel.log diff --git a/main.e b/main.e new file mode 100644 index 0000000..898c419 --- /dev/null +++ b/main.e @@ -0,0 +1,70 @@ +note + description: "GC_performance application root class" + date: "$Date$" + revision: "$Revision$" + +class + MAIN + +inherit + ARGUMENTS + +create + make + +feature createMessage(n: INTEGER): ARRAY[INTEGER_8] + local + msg: ARRAY[INTEGER_8] + do + create msg.make_filled(n.as_integer_8, 0, msgSize-1) + Result:= msg + end + +feature pushMessage(map: HASH_TABLE[ARRAY[INTEGER_8],INTEGER]; id: INTEGER) + local + lowId : INTEGER + do + lowId := id - windowSize + map.put (createMessage(id), id) + if lowId>=0 then + map.remove (lowId) + end + end + +feature {NONE} -- Initialization + windowSize : INTEGER = 200_000 + msgCount : INTEGER = 1_000_000 + msgSize : INTEGER = 1024 + + make + -- Run application. + local + + map : HASH_TABLE[ARRAY[INTEGER_8],INTEGER] + i : INTEGER + currentTime, lastTime: TIME + iterPause, maxPause: TIME_DURATION + do + create map.make(0) + + create lastTime.make_now + create maxPause.make_by_fine_seconds (0.0) + + from i:=0 + until i=msgCount + loop + pushMessage(map,i) + create currentTime.make_now + iterPause:= currentTime.relative_duration (lastTime) + if iterPause>maxPause then + maxPause:= iterPause + end + lastTime:= currentTime + i:= i + 1 + end + print("Max pause: ") + print (maxPause.fine_second*1000.0) + print (" ms %N") + end + +end