Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extended Time Profiling as per Issue #224 #225

Merged
merged 7 commits into from
Apr 6, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions config/generic.xml
Original file line number Diff line number Diff line change
Expand Up @@ -60,4 +60,8 @@
<ws_port>8080</ws_port>
<sqlite_db>:memory:</sqlite_db>
</webservice>
<timeprofile>
<profiler>xtprof</profiler>
<xt_unique_log_name>0</xt_unique_log_name>
</timeprofile>
</hammerdb>
2 changes: 1 addition & 1 deletion config/oracle.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
<rampup>2</rampup>
<duration>5</duration>
<allwarehouse>false</allwarehouse>
<timeprofile>false</timeprofile>
<otimeprofile>false</otimeprofile>
<async_scale>false</async_scale>
<async_client>10</async_client>
<async_verbose>false</async_verbose>
Expand Down
485 changes: 485 additions & 0 deletions modules/xtprof-1.0.tm

Large diffs are not rendered by default.

7 changes: 6 additions & 1 deletion src/generic/gencli.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -1143,10 +1143,15 @@ set db_async_scale "false"
}
if { $db_allwarehouse } { shared_tpcc_functions "allwarehouse" $db_async_scale }
}
upvar #0 genericdict genericdict
if {[dict exists $genericdict timeprofile profiler]} {
set profiler [ dict get $genericdict timeprofile profiler]
}
if { $profiler eq "xtprof" } { set profile_func "xttimeprofile" } else { set profile_func "ettimeprofile" }
set timep [ lsearch -inline [ dict get [ set $dictname ] tpcc ] *timeprofile ]
if { $timep != "" } {
set db_timeprofile [ dict get [ set $dictname ] tpcc $timep ]
if { $db_timeprofile } { shared_tpcc_functions "timeprofile" "false" }
if { $db_timeprofile } { shared_tpcc_functions $profile_func "false" }
}
break
}
Expand Down
7 changes: 6 additions & 1 deletion src/generic/gened.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -3181,10 +3181,15 @@ set db_async_scale "false"
}
if { $db_allwarehouse } { shared_tpcc_functions "allwarehouse" $db_async_scale }
}
upvar #0 genericdict genericdict
if {[dict exists $genericdict timeprofile profiler]} {
set profiler [ dict get $genericdict timeprofile profiler]
}
if { $profiler eq "xtprof" } { set profile_func "xttimeprofile" } else { set profile_func "ettimeprofile" }
set timep [ lsearch -inline [ dict get [ set $dictname ] tpcc ] *timeprofile ]
if { $timep != "" } {
set db_timeprofile [ dict get [ set $dictname ] tpcc $timep ]
if { $db_timeprofile } { shared_tpcc_functions "timeprofile" "false" }
if { $db_timeprofile } { shared_tpcc_functions $profile_func "false" }
}
break
}
Expand Down
1 change: 1 addition & 0 deletions src/generic/gentccmn.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ if { [catch {set tc_flog "notclog"} message]} { ; }

proc write_to_transcount_log { number rdbms metric } {
global tc_flog
if { ![info exists tc_flog] } { set tc_flog "notclog"}
upvar #0 genericdict genericdict
if { $tc_flog != "notclog" } {
dict with genericdict { dict with transaction_counter { set tstamp $tc_log_timestamps }}
Expand Down
17 changes: 16 additions & 1 deletion src/generic/gentpcc.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ set allwi(5) [.ed_mainFrame.mainwin.textFrame.left.text search -backwards "promi
.ed_mainFrame.mainwin.textFrame.left.text fastinsert $allwi(5)+1l $allwt(4)
}
}
timeprofile {
ettimeprofile {
#set additional text for all warehouses
set timept(1) {set timeprofile "true";# Output virtual user response times
}
Expand All @@ -56,6 +56,21 @@ set timepi(1) [.ed_mainFrame.mainwin.textFrame.left.text search -backwards "#EDI
.ed_mainFrame.mainwin.textFrame.left.text fastinsert $timepi(1) $timept(1)
set timepi(2) [.ed_mainFrame.mainwin.textFrame.left.text search -backwards "default \{" end ]
.ed_mainFrame.mainwin.textFrame.left.text fastinsert $timepi(2)+1l $timept(2)
.ed_mainFrame.mainwin.textFrame.left.text fastinsert end-2l $timept(3)
}
xttimeprofile {
#set additional text for all warehouses
set timept(1) {if [catch {package require xtprof} ] { error "Failed to load extended time profile functions" } else { namespace import xtprof::* }
}
set timept(2) {xttimeproflog $totalvirtualusers $library
}
set timept(3) {xtreport $myposition
}
#search for insert points and insert functions
set timepi(1) [.ed_mainFrame.mainwin.textFrame.left.text search -backwards "if \[catch \{package require tpcccommon\} \]" end ]
.ed_mainFrame.mainwin.textFrame.left.text fastinsert $timepi(1)+1l $timept(1)
set timepi(2) [.ed_mainFrame.mainwin.textFrame.left.text search -backwards "tsv::set application abort 1" end ]
.ed_mainFrame.mainwin.textFrame.left.text fastinsert $timepi(2)+1l $timept(2)
.ed_mainFrame.mainwin.textFrame.left.text fastinsert end-2l $timept(3)
}
}
Expand Down
3 changes: 2 additions & 1 deletion src/generic/genws.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,8 @@ if { $db_allwarehouse } { shared_tpcc_functions "allwarehouse" $db_async_scale }
set timep [ lsearch -inline [ dict get [ set $dictname ] tpcc ] *timeprofile ]
if { $timep != "" } {
set db_timeprofile [ dict get [ set $dictname ] tpcc $timep ]
if { $db_timeprofile } { shared_tpcc_functions "timeprofile" "false" }
#Always run ettimeprofile in WS as the extended timeprofile uses a separate log
if { $db_timeprofile } { shared_tpcc_functions "ettimeprofile" "false" }
}
break
}
Expand Down
3 changes: 3 additions & 0 deletions src/oracle/oraoltp.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -2164,6 +2164,7 @@ set connect $tpcc_user/$tpcc_pass@$instance ;# Oracle connect string for tpc-c u
if [catch {package require $library} message] { error "Failed to load $library - $message" }
if [catch {::tcl::tm::path add modules} ] { error "Failed to find modules directory" }
if [catch {package require tpcccommon} ] { error "Failed to load tpcc common functions" } else { namespace import tpcccommon::* }

#LOGON
proc OracleLogon { connectstring lda } {
set lda [oralogon $connectstring ]
Expand Down Expand Up @@ -2452,6 +2453,7 @@ set connect $tpcc_user/$tpcc_pass@$instance ;# Oracle connect string for tpc-c u
if [catch {package require $library} message] { error "Failed to load $library - $message" }
if [catch {::tcl::tm::path add modules} ] { error "Failed to find modules directory" }
if [catch {package require tpcccommon} ] { error "Failed to load tpcc common functions" } else { namespace import tpcccommon::* }

#LOGON
proc OracleLogon { connectstring lda timesten } {
set lda [oralogon $connectstring ]
Expand Down Expand Up @@ -2861,6 +2863,7 @@ if [catch {package require $library} message] { error "Failed to load $library -
if [catch {::tcl::tm::path add modules} ] { error "Failed to find modules directory" }
if [catch {package require tpcccommon} ] { error "Failed to load tpcc common functions" } else { namespace import tpcccommon::* }
if [catch {package require promise } message] { error "Failed to load promise package for asynchronous clients" }

#LOGON
proc OracleLogon { connectstring lda timesten } {
set lda [oralogon $connectstring ]
Expand Down
6 changes: 3 additions & 3 deletions src/oracle/oraopt.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ upvar #0 configoracle configoracle
setlocaltpccvars $configoracle
#set matching fields in dialog to temporary dict
variable orafields
set orafields [ dict create connection {system_user {.tpc.f1.e2 get} system_password {.tpc.f1.e3 get} instance {.tpc.f1.e1 get}} tpcc {tpcc_user {.tpc.f1.e4 get} tpcc_pass {.tpc.f1.e5 get} tpcc_def_tab {.tpc.f1.e6 get} tpcc_ol_tab {.tpc.f1.e6a get} tpcc_def_temp {.tpc.f1.e7 get} total_iterations {.tpc.f1.e17 get} rampup {.tpc.f1.e21 get} duration {.tpc.f1.e22 get} async_client {.tpc.f1.e26 get} async_delay {.tpc.f1.e27 get} tpcc_tt_compat $tpcc_tt_compat hash_clusters $hash_clusters partition $partition count_ware $count_ware num_vu $num_vu ora_driver $ora_driver raiseerror $raiseerror keyandthink $keyandthink checkpoint $checkpoint allwarehouse $allwarehouse timeprofile $timeprofile async_scale $async_scale async_verbose $async_verbose connect_pool $connect_pool}]
set orafields [ dict create connection {system_user {.tpc.f1.e2 get} system_password {.tpc.f1.e3 get} instance {.tpc.f1.e1 get}} tpcc {tpcc_user {.tpc.f1.e4 get} tpcc_pass {.tpc.f1.e5 get} tpcc_def_tab {.tpc.f1.e6 get} tpcc_ol_tab {.tpc.f1.e6a get} tpcc_def_temp {.tpc.f1.e7 get} total_iterations {.tpc.f1.e17 get} rampup {.tpc.f1.e21 get} duration {.tpc.f1.e22 get} async_client {.tpc.f1.e26 get} async_delay {.tpc.f1.e27 get} tpcc_tt_compat $tpcc_tt_compat hash_clusters $hash_clusters partition $partition count_ware $count_ware num_vu $num_vu ora_driver $ora_driver raiseerror $raiseerror keyandthink $keyandthink checkpoint $checkpoint allwarehouse $allwarehouse otimeprofile $otimeprofile async_scale $async_scale async_verbose $async_verbose connect_pool $connect_pool}]
set whlist [ get_warehouse_list_for_spinbox ]
catch "destroy .tpc"
ttk::toplevel .tpc
Expand Down Expand Up @@ -398,7 +398,7 @@ grid $Name -column 1 -row 17 -sticky w
bind .tpc.f1.r1 <ButtonPress-1> {
set checkpoint "false"
set allwarehouse "false"
set timeprofile "false"
set otimeprofile "false"
set async_scale "false"
set async_verbose "false"
.tpc.f1.e20 configure -state disabled
Expand Down Expand Up @@ -495,7 +495,7 @@ if {$ora_driver == "test" } {
set Name $Parent.f1.e24
set Prompt $Parent.f1.p24
ttk::label $Prompt -text "Time Profile :"
ttk::checkbutton $Name -text "" -variable timeprofile -onvalue "true" -offvalue "false"
ttk::checkbutton $Name -text "" -variable otimeprofile -onvalue "true" -offvalue "false"
grid $Prompt -column 0 -row 26 -sticky e
grid $Name -column 1 -row 26 -sticky ew
if {$ora_driver == "test" } {
Expand Down