Skip to content

Commit

Permalink
Persist VU settings across restarts
Browse files Browse the repository at this point in the history
  • Loading branch information
v1k1nghawk committed Apr 24, 2024
1 parent 39d8f52 commit 4f83d39
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/generic/gencli.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -423,6 +423,8 @@ proc vuset { args } {
puts "Error: Virtual Users exist, destroy with vudestroy before changing settings"
return
}
set db "generic"
set dct "virtual_user_options"
switch $option {
vu {
set virtual_users $val
Expand All @@ -441,6 +443,7 @@ proc vuset { args } {
return
}
}
SQLiteUpdateKeyValue $db $dct "virtual_users" $virtual_users
remote_command [ concat vuset vu $val ]
}
delay {
Expand All @@ -455,6 +458,7 @@ proc vuset { args } {
set conpause 500
}
}
SQLiteUpdateKeyValue $db $dct "user_delay" $conpause
remote_command [ concat vuset delay $val ]
}
repeat {
Expand All @@ -469,6 +473,7 @@ proc vuset { args } {
set delayms 500
}
}
SQLiteUpdateKeyValue $db $dct "repeat_delay" $delayms
remote_command [ concat vuset repeat $val ]
}
iterations {
Expand All @@ -483,6 +488,7 @@ proc vuset { args } {
set ntimes 1
}
}
SQLiteUpdateKeyValue $db $dct "iterations" $ntimes
remote_command [ concat vuset iterations $val ]
}
showoutput {
Expand All @@ -497,6 +503,7 @@ proc vuset { args } {
set suppo 1
}
}
SQLiteUpdateKeyValue $db $dct "show_output" $suppo
remote_command [ concat vuset showoutput $val ]
}
logtotemp {
Expand All @@ -511,6 +518,7 @@ proc vuset { args } {
set optlog 0
}
}
SQLiteUpdateKeyValue $db $dct "log_to_temp" $optlog
remote_command [ concat vuset logtotemp $val ]
}
unique {
Expand All @@ -525,6 +533,7 @@ proc vuset { args } {
set unique_log_name 0
}
}
SQLiteUpdateKeyValue $db $dct "unique_log_name" $unique_log_name
remote_command [ concat vuset unique $val ]
}
nobuff {
Expand All @@ -539,6 +548,7 @@ proc vuset { args } {
set no_log_buffer 0
}
}
SQLiteUpdateKeyValue $db $dct "no_log_buffer" $no_log_buffer
remote_command [ concat vuset nobuff $val ]
}
timestamps {
Expand All @@ -553,6 +563,7 @@ proc vuset { args } {
set log_timestamps 0
}
}
SQLiteUpdateKeyValue $db $dct "log_timestamps" $log_timestamps
remote_command [ concat vuset timestamps $val ]
}
default {
Expand Down
14 changes: 14 additions & 0 deletions src/generic/gened.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -1954,6 +1954,20 @@ proc vuser_options {} {
if { $ntimes < 1 } { tk_messageBox -message "The number of iterations must be 1 or greater"
set ntimes 1
}

#Save new values to SQLite
set db "generic"
set dct "virtual_user_options"
SQLiteUpdateKeyValue $db $dct "virtual_users" $virtual_users
SQLiteUpdateKeyValue $db $dct "user_delay" $conpause
SQLiteUpdateKeyValue $db $dct "repeat_delay" $delayms
SQLiteUpdateKeyValue $db $dct "iterations" $ntimes
SQLiteUpdateKeyValue $db $dct "show_output" $suppo
SQLiteUpdateKeyValue $db $dct "log_to_temp" $optlog
SQLiteUpdateKeyValue $db $dct "unique_log_name" $unique_log_name
SQLiteUpdateKeyValue $db $dct "no_log_buffer" $no_log_buffer
SQLiteUpdateKeyValue $db $dct "log_timestamps" $log_timestamps

remote_command [ concat vuser_slave_ops $maxvuser $virtual_users $delayms $conpause $ntimes $suppo $optlog ]
destroy .vuserop
} \
Expand Down

0 comments on commit 4f83d39

Please sign in to comment.