Skip to content

Commit

Permalink
Merge pull request #446 from sm-shaw/445
Browse files Browse the repository at this point in the history
Fix for keepalive issue #445
  • Loading branch information
abondvt89 committed Nov 3, 2022
2 parents fa9e267 + 14a9da6 commit ffe1409
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 22 deletions.
3 changes: 3 additions & 0 deletions config/generic.xml
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,9 @@
<gen_directory>
</gen_directory>
</datageneration>
<commandline>
<keepalive_margin>10</keepalive_margin>
</commandline>
<webservice>
<ws_port>8080</ws_port>
<sqlite_db>TMP</sqlite_db>
Expand Down
57 changes: 35 additions & 22 deletions src/generic/gencli.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ proc .ed_mainFrame.buttons.datagen { args } { ; }
proc .ed_mainFrame.buttons.boxes { args } { ; }
proc .ed_mainFrame.buttons.test { args } { ; }
proc .ed_mainFrame.buttons.runworld { args } { ; }
proc .ed_mainFrame.buttons.delete { args } { ; }
proc ed_lvuser_button { args } { ; }
proc .ed_mainFrame.editbuttons.test { args } { ; }
proc .ed_mainFrame.editbuttons.distribute { args } { ; }
Expand Down Expand Up @@ -779,6 +780,9 @@ proc vucreate {} {
catch {loadscript}
if { [ string length $_ED(package) ] eq 0 } {
putscli "No Script loaded: Load script before creating Virtual Users"
} else {
#Call vucreate recursively, first call loaded script, 2nd to create VUs
vucreate
}
} else {
if {[expr [ llength [ threadnames_without_tcthread ] ] - 1 ] > 0} {
Expand Down Expand Up @@ -1045,35 +1049,44 @@ proc buildschema {} {
}

proc keepalive {} {
#Routine to keep the main thread alive during vurun
global rdbms bm
set ka_valid 1
if {$bm eq "TPC-C"} {
#For TPC-C we have a rampup and duration time, find these, check they are valid and call _runtimer automatically with these values
upvar #0 dbdict dbdict
foreach { key } [ dict keys $dbdict ] {
if { [ dict get $dbdict $key name ] eq $rdbms } {
set dictname config$key
upvar #0 $dictname $dictname
#Routine to keep the main thread alive during vurun
global rdbms bm
set ka_valid 1
if {$bm eq "TPC-C"} {
#For TPC-C we have a rampup and duration time, find these, check they are valid and call _runtimer automatically with these values
upvar #0 dbdict dbdict
upvar #0 genericdict genericdict
if {[dict exists $genericdict commandline keepalive_margin]} {
set ka_margin [ dict get $genericdict commandline keepalive_margin]
if {![string is entier $ka_margin]} {
set ka_margin 10
}
} else {
set ka_margin 10
}
foreach { key } [ dict keys $dbdict ] {
if { [ dict get $dbdict $key name ] eq $rdbms } {
set dictname config$key
upvar #0 $dictname $dictname
}
}
set rampup_secs [expr {[ get_base_rampup [ set $dictname ]]*60}]
set duration_secs [expr {[ get_base_duration [ set $dictname ]] *60}]
foreach { val } [ list $rampup_secs $duration_secs ] {
if { ![string is integer -strict $val ] || $val < 60 } {
set ka_valid 0
}
if { ![string is entier $val ] || ($val < 60 && $val != 0) } {
set ka_valid 0
}
}
if { $ka_valid } {
_runtimer [expr {$rampup_secs + $duration_secs + 10}]
} else {
tk_messageBox -icon warning -message "Cannot detect rampup and duration times, keepalive for main thread not active"
}
} else {
#Workload is TPROC-H, call _waittocomplete to wait until vucomplete message after an indeterminate amount of time
_waittocomplete
return
}
_runtimer [expr {$rampup_secs + $duration_secs + $ka_margin}]
} else {
tk_messageBox -icon warning -message "Cannot detect rampup and duration times, keepalive for main thread not active"
}
} else {
#Workload is TPROC-H, call _waittocomplete to wait until vucomplete message after an indeterminate amount of time
_waittocomplete
return
}
}

proc delete_schema {} {
Expand Down
1 change: 1 addition & 0 deletions src/generic/genws.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ proc .ed_mainFrame.buttons.datagen { args } { ; }
proc .ed_mainFrame.buttons.boxes { args } { ; }
proc .ed_mainFrame.buttons.test { args } { ; }
proc .ed_mainFrame.buttons.runworld { args } { ; }
proc .ed_mainFrame.buttons.delete { args } { ; }
proc ed_lvuser_button { args } { ; }
proc .ed_mainFrame.editbuttons.test { args } { ; }
proc .ed_mainFrame.editbuttons.distribute { args } { ; }
Expand Down

0 comments on commit ffe1409

Please sign in to comment.