performance measurements

Each table row shows performance measurements for this Smalltalk VisualWorks program with a particular command-line input value N.

 N  CPU secs Elapsed secs Memory KB Code B ≈ CPU Load
500,0000.570.6122,480566  2% 5% 3% 95%
5,000,0004.944.9422,480566  0% 0% 0% 100%
50,000,00048.8248.8422,480566  0% 0% 0% 100%

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.

 notes

VisualWorks® Personal Use Edition Release 7.9 of May 11, 2012

 thread-ring Smalltalk VisualWorks #2 program source code

"* The Computer Language Benchmarks Game

    http://benchmarksgame.alioth.debian.org/

    adapted from a program by Paolo Bonzini

    contributed by Isaac Gouy 

    modified by Carlo Teixeira *"!


!Tests class methodsFor: 'benchmarking'!

threadring2

   | done |
   (self threadRing: (done := Semaphore new)) takeToken: self arg.
   done wait.
   ^''!

threadRing: aSemaphore
   | first last |
   503 to: 1 by: -1 do: [:i|
      first := Thread named: i next: first done: aSemaphore.
      last isNil ifTrue: [ last:=first. ].
   ].
   last nextThread: first.
   ^first! !


Object subclass: #Thread
   instanceVariableNames: 'name nextThread token semaphore done '
   classVariableNames: ''
   poolDictionaries: ''
   category: 'BenchmarksGame'!

Thread class
   instanceVariableNames: ''!


!Thread class methodsFor: 'instance creation'!

named: anInteger next: aThread done: aSemaphore
   ^self new name: anInteger; nextThread: aThread; done: aSemaphore; fork !

new

   ^self basicNew semaphore: Semaphore new ! !


!Thread methodsFor: 'accessing'!

done: aSemaphore
   done := aSemaphore !

fork

   [ self run ] forkAt: Processor userBackgroundPriority.!

name: anInteger
   name := anInteger !

nextThread: aThread
   nextThread := aThread !

run

   [semaphore wait.
   0==token] whileFalse: [nextThread takeToken: token - 1].
   name printOn: Tests stdout.
   Tests stdout cr.
   done signal!

semaphore: aSemaphore
   semaphore := aSemaphore !

takeToken: x
   token := x.
   semaphore signal ! !

 make, command-line, and program output logs

Thu, 07 Feb 2013 00:51:37 GMT

COMMAND LINE:
/usr/local/src/vw7.9pul/bin/linux86/vwlinux86 /usr/local/src/vw7.9pul/image/benchmarks.im -nogui -evaluate "Tests threadring2" -a 50000000

PROGRAM OUTPUT:
292

Revised BSD license

  Home   Conclusions   License   Play