Skip to content

Commit

Permalink
Working on issue #67 (performance profiling infrastructure): Set-up p…
Browse files Browse the repository at this point in the history
…rofiling for atomic petrinets.
  • Loading branch information
christoff-buerger committed Nov 15, 2016
1 parent f127a99 commit 7aad8ac
Show file tree
Hide file tree
Showing 7 changed files with 46 additions and 34 deletions.
10 changes: 6 additions & 4 deletions profiling/atomic-petrinets/profiling-configuration
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
run.bash
#Transitions|Number of transitions
#Influenced|Number of transitions influenced including the one fired
#L-Places|Number of local places per transition
#L-Tokens|Number of tokens in local places
Scheme|Scheme system used for measurements
#Transitions|Number of transitions (scale load)
#Influenced|Number of transitions influenced including the one fired (invalidation load)
#L-Places|Number of local places per transition (base load)
#L-Tokens|Number of tokens in each local place (base load)
#Executions|Number of execution steps (times the net is fired)
>
Time|Execution time in ms
13 changes: 5 additions & 8 deletions profiling/atomic-petrinets/profiling.scm
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

(library
(atomic-petrinets profiling)
(export profiling-net profile)
(export make-profiling-net profile-net)
(import (rnrs) (racr core) (racr testing) (atomic-petrinets analyses) (atomic-petrinets user-interface))

(define (make-profiling-net $transitions $influenced $local-places $local-tokens)
Expand Down Expand Up @@ -46,11 +46,8 @@
(for-each =enabled? (=transitions net))
net))

(define profiling-net
(begin
(initialise-petrinet-language)
(include "profiling-net-configuration.scm" (make-profiling-net 560 20 13 3))))

(define (profile $executions)
(define (profile-net net $executions)
(do ((i 0 (+ i 1))) ((>= i $executions))
(fire-transition! (find =enabled? (=transitions profiling-net))))))
(fire-transition! (find =enabled? (=transitions net)))))

(initialise-petrinet-language))
1 change: 0 additions & 1 deletion profiling/atomic-petrinets/racr-library-configuration
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,3 @@
../../examples/atomic-petrinets
@sources:
profiling
static-profiling
14 changes: 12 additions & 2 deletions profiling/atomic-petrinets/run.bash
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,15 @@ set -e
set -o pipefail
script_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"

ex_time=$(( $1 + $3 ))
echo $(( $4 * ex_time ))
selected_system=$1
shift

exec 3>&1 4>&2
execution_time=$(
TIMEFORMAT=%R
{
time "$script_dir/../../run-program.bash" -s $selected_system -e "$script_dir/run.scm" -- "$@" 1>&3 2>&4
} 2>&1
)
exec 3>&- 4>&-
echo $execution_time
19 changes: 19 additions & 0 deletions profiling/atomic-petrinets/run.scm
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
; This program and the accompanying materials are made available under the
; terms of the MIT license (X11 license) which accompanies this distribution.

; Author: C. Bürger

#!r6rs

(import (rnrs) (atomic-petrinets profiling))

(define arguments (command-line))
(define $transitions (string->number (list-ref arguments 1)))
(define $influenced (string->number (list-ref arguments 2)))
(define $local-places (string->number (list-ref arguments 3)))
(define $local-tokens (string->number (list-ref arguments 4)))
(define $executions (string->number (list-ref arguments 5)))

(profile-net
(make-profiling-net $transitions $influenced $local-places $local-tokens)
$executions)
16 changes: 0 additions & 16 deletions profiling/atomic-petrinets/static-profiling.scm

This file was deleted.

7 changes: 4 additions & 3 deletions profiling/make-measurements.bash
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ then
"$script_dir/make-measurements.bash" -h
exit $?
fi
while getopts c:s:x:h opt
while getopts c:s:xh opt
do
case $opt in
c)
Expand Down Expand Up @@ -231,7 +231,7 @@ do
IFS="$old_IFS"
if [ ${#measurement_results[@]} -ne $number_of_results -a $measurement_error -eq 0 ]
then
echo " !!! ERROR: Unexpected number of measurement results !!!" >&2
echo " !!! ERROR: Unexpected number of measurement results !!!" >&2
measurement_error=1
fi
if [ $measurement_error -ne 0 -o -s "$measurement_stderr" ]
Expand Down Expand Up @@ -268,7 +268,8 @@ do
elif [ "$undo" = true ] && (( current_parameter_iterations[current_parameter] < parameter_iterations[current_parameter] ))
then # redo with adjusted parameters
undo=false
current_parameter_values[$current_parameter]=$(( current_parameter_values[current_parameter] + parameter_adjustments[current_parameter] ))
current_parameter_values[$current_parameter]=$((
current_parameter_values[current_parameter] + parameter_adjustments[current_parameter] ))
current_parameter_iterations[$current_parameter]=$(( current_parameter_iterations[current_parameter] + 1 ))
current_parameter=$(( current_parameter + 1 ))
elif [ "$undo" = true ]
Expand Down

0 comments on commit 7aad8ac

Please sign in to comment.