s/BenchmarkResult.st
changeset 6 25b264cec44e
parent 5 8669edf62d9b
child 12 3a7ebd3da52f
equal deleted inserted replaced
5:8669edf62d9b 6:25b264cec44e
     1 "{ Package: 'jv:calipel/s' }"
     1 "{ Package: 'jv:calipel/s' }"
     2 
     2 
     3 Object subclass:#BenchmarkResult
     3 Object subclass:#BenchmarkResult
     4 	instanceVariableNames:'outcomes'
     4 	instanceVariableNames:'outcomes runs'
     5 	classVariableNames:''
     5 	classVariableNames:''
     6 	poolDictionaries:''
     6 	poolDictionaries:''
     7 	category:'CalipeL/S-Core'
     7 	category:'CalipeL/S-Core'
     8 !
     8 !
     9 
     9 
    18 
    18 
    19 !BenchmarkResult methodsFor:'accessing'!
    19 !BenchmarkResult methodsFor:'accessing'!
    20 
    20 
    21 outcomes
    21 outcomes
    22     ^ outcomes
    22     ^ outcomes
       
    23 !
       
    24 
       
    25 runs
       
    26     "Return how many times each benchmark is run." 
       
    27 
       
    28     ^ runs
       
    29 
       
    30     "Modified (format): / 04-06-2013 / 22:25:20 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
    31 !
       
    32 
       
    33 runs:anInteger
       
    34      "Sets how many times each benchmark is run." 
       
    35 
       
    36     runs := anInteger.
       
    37 
       
    38     "Modified (comment): / 04-06-2013 / 22:25:17 / Jan Vrany <jan.vrany@fit.cvut.cz>"
    23 ! !
    39 ! !
    24 
    40 
    25 !BenchmarkResult methodsFor:'initialization'!
    41 !BenchmarkResult methodsFor:'initialization'!
    26 
    42 
    27 initialize
    43 initialize
    28     "Invoked when a new instance is created."
    44     "Invoked when a new instance is created."
    29 
    45 
    30     outcomes := Set new.
    46     outcomes := Set new.
       
    47     runs := 1.
    31 
    48 
    32     "Modified: / 27-05-2013 / 18:57:00 / Jan Vrany <jan.vrany@fit.cvut.cz>"
    49     "Modified: / 04-06-2013 / 22:23:46 / Jan Vrany <jan.vrany@fit.cvut.cz>"
    33     "Modified (comment): / 31-05-2013 / 00:31:03 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
    34 ! !
    50 ! !
    35 
    51 
    36 !BenchmarkResult methodsFor:'printing & storing'!
    52 !BenchmarkResult methodsFor:'printing & storing'!
    37 
    53 
    38 printOn:aStream
    54 printOn:aStream
    44     "Modified: / 31-05-2013 / 10:38:46 / Jan Vrany <jan.vrany@fit.cvut.cz>"
    60     "Modified: / 31-05-2013 / 10:38:46 / Jan Vrany <jan.vrany@fit.cvut.cz>"
    45 ! !
    61 ! !
    46 
    62 
    47 !BenchmarkResult methodsFor:'running-private'!
    63 !BenchmarkResult methodsFor:'running-private'!
    48 
    64 
    49 performBenchmark:aBenchmarkInstance withParameters:aDictionary
    65 runBenchmark:aBenchmarkInstance withParameters: aDictionary
    50     ^aBenchmarkInstance runBenchmarkWithParameters:aDictionary
    66     | times |
    51 
    67 
    52     "Created: / 27-05-2013 / 22:24:55 / Jan Vrany <jan.vrany@fit.cvut.cz>"
    68     times := (1 to: runs) collect: [:i | aBenchmarkInstance runBenchmarkWithParameters: aDictionary].
    53 !
       
    54 
       
    55 runBenchmark:aBenchmarkInstance withParameters: aDictionary
       
    56     | time |
       
    57 
       
    58     time := self performBenchmark: aBenchmarkInstance withParameters:aDictionary.
       
    59     outcomes add:
    69     outcomes add:
    60         (BenchmarkOutcome 
    70         (BenchmarkOutcome 
    61             instance: aBenchmarkInstance
    71             instance: aBenchmarkInstance
    62             time: time
    72             times: times
    63             parameters: aBenchmarkInstance)
    73             parameters: aBenchmarkInstance)
    64 
    74 
    65     "Created: / 27-05-2013 / 22:20:03 / Jan Vrany <jan.vrany@fit.cvut.cz>"
    75     "Created: / 27-05-2013 / 22:20:03 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
    76     "Modified: / 05-06-2013 / 10:29:30 / Jan Vrany <jan.vrany@fit.cvut.cz>"
    66 ! !
    77 ! !
    67 
    78 
    68 !BenchmarkResult class methodsFor:'documentation'!
    79 !BenchmarkResult class methodsFor:'documentation'!
    69 
    80 
    70 version_HG
    81 version_HG