Skip to content

Commit

Permalink
Version 3.2
Browse files Browse the repository at this point in the history
  • Loading branch information
sm-shaw committed Jul 4, 2019
1 parent e220d27 commit 9d819bb
Show file tree
Hide file tree
Showing 27 changed files with 6,148 additions and 92 deletions.
21 changes: 21 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
Expand Up @@ -860,3 +860,24 @@ Bug fixes
[#131] Duplicate Files with incorrect prefix in MySQL and Redis Directories

Added Oracle Database Metrics based on Ashmon by Kyle Hailey, used with permission to add as GPLv3

---------------------------------------------------------------------

Version 3.2 2019

Bug fixes

[#132] Running buildschema in CLI for TPC-H has incorrect VU count
[#133] Use all warehouses omits warehouse 1 and fails if more VUsers than warehouses
[#134] Buildschema in CLI errors if 1 virtual user and more than 1 warehouse
[GH#58] Bug when building TPC-C and TPC-H on Azure

Updated time profiler to report percentile values at 10 second intervals

Updated PostgreSQL Oracle SLEV Stored Procedure to return stock count

Updated hammerdbcli to enable autostart with script

Added PostgreSQL v11+ compatible Stored Procedures to use instead of Functions

Added HTTP Web Service interface
4 changes: 2 additions & 2 deletions agent/agent
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ exit
# mpstatPlot -- visual display of mpstat idle value for all processors
# by Keith Vetter
#
# Copyright (C) 2003-2018 Steve Shaw
# Copyright (C) 2003-2019 Steve Shaw
# Author contact information at: http://www.hammerdb.com
#
# This program is free software; you can redistribute it and/or
Expand All @@ -40,7 +40,7 @@ namespace import comm::*
interp recursionlimit {} 3000
global agentlist S iswin
set iswin "false"
set version 3.1
set version 3.2

if {$tcl_platform(platform) == "windows"} {
package require twapi
Expand Down
2 changes: 1 addition & 1 deletion agent/mpstat.bat
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ tclsh86t %0 %*
#
#Simulation of Linux mpstat program for Windows using Twapi
#
# Copyright (C) 2003-2018 Steve Shaw
# Copyright (C) 2003-2019 Steve Shaw
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public
Expand Down
6 changes: 5 additions & 1 deletion config/generic.xml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
</mode>
<transaction_counter>
<settings>
<refresh_rate>10</refresh_rate>
<refresh_rate>10</refresh_rate>
</settings>
</transaction_counter>
<metrics>
Expand All @@ -47,4 +47,8 @@
<gen_directory>
</gen_directory>
</datageneration>
<webservice>
<ws_port>8080</ws_port>
<sqlite_db>:memory:</sqlite_db>
</webservice>
</hammerdb>
1 change: 1 addition & 0 deletions config/postgresql.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
<pg_vacuum>false</pg_vacuum>
<pg_dritasnap>false</pg_dritasnap>
<pg_oracompat>false</pg_oracompat>
<pg_storedprocs>false</pg_storedprocs>
</schema>
<driver>
<pg_total_iterations>1000000</pg_total_iterations>
Expand Down
8 changes: 4 additions & 4 deletions hammerdb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ exec wish8.6 -file $0 ${1+"$@"}
exit
########################################################################
# HammerDB
# Copyright (C) 2003-2018 Steve Shaw
# Copyright (C) 2003-2019 Steve Shaw
# Author contact information at: http://www.hammerdb.com
#
# This program is free software; you can redistribute it and/or
Expand All @@ -27,7 +27,7 @@ exit
# License along with this program; If not, see <https://www.gnu.org/licenses/>
########################################################################
global hdb_version
set hdb_version "v3.1"
set hdb_version "v3.2"
set mainGeometry +10+10
set UserDefaultDir [ file dirname [ info script ] ]
::tcl::tm::path add "$UserDefaultDir/modules"
Expand All @@ -36,15 +36,15 @@ namespace eval autostart {
set autostartap "false"
if {$argc == 0} { ; } else {
if {$argc != 2 || [lindex $argv 0] != "auto" } {
puts {Usage: hammerdb.tcl [ auto [ script_to_autoload.tcl ] ]}
puts {Usage: hammerdb [ auto [ script_to_autoload.tcl ] ]}
exit
} else {
set autostartap "true"
set autoloadscript [lindex $argv 1]
if { [ file exists $autoloadscript ] && [ file isfile $autoloadscript ] && [ file extension $autoloadscript ] eq ".tcl" } {
;# autostart selected and tcl file exists
} else {
puts {Usage: hammerdb.tcl [ auto [ script_to_autoload.tcl ] ]}
puts {Usage: hammerdb [ auto [ script_to_autoload.tcl ] ]}
exit
}
}
Expand Down
30 changes: 27 additions & 3 deletions hammerdbcli
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export PATH=./bin:$PATH
exec ./bin/tclsh8.6 "$0" ${1+"$@"}
########################################################################
# HammerDB
# Copyright (C) 2003-2018 Steve Shaw
# Copyright (C) 2003-2019 Steve Shaw
# Author contact information at: http://www.hammerdb.com
#
# This program is free software; you can redistribute it and/or
Expand All @@ -25,13 +25,32 @@ exec ./bin/tclsh8.6 "$0" ${1+"$@"}
# License along with this program; If not, see <https://www.gnu.org/licenses/>
########################################################################
global hdb_version
set hdb_version "v3.1"
set hdb_version "v3.2"
puts "HammerDB CLI $hdb_version"
puts "Copyright (C) 2003-2018 Steve Shaw"
puts "Copyright (C) 2003-2019 Steve Shaw"
puts "Type \"help\" for a list of commands"
set UserDefaultDir [ file dirname [ info script ] ]
::tcl::tm::path add "$UserDefaultDir/modules"

namespace eval autostart {
set autostartap "false"
if {$argc == 0} { ; } else {
if {$argc != 2 || [lindex $argv 0] != "auto" } {
puts {Usage: hammerdbcli [ auto [ script_to_autoload.tcl ] ]}
exit
} else {
set autostartap "true"
set autoloadscript [lindex $argv 1]
if { [ file exists $autoloadscript ] && [ file isfile $autoloadscript ] && [ file extension $autoloadscript ] eq ".tcl" } {
;# autostart selected and tcl file exists
} else {
puts {Usage: hammerdbcli [ auto [ script_to_autoload.tcl ] ]}
exit
}
}
}
}

append modulelist { Thread msgcat xml tclreadline }
for { set modcount 0 } { $modcount < [llength $modulelist] } { incr modcount } {
set m [lindex $modulelist $modcount]
Expand Down Expand Up @@ -61,4 +80,9 @@ for { set dbsrccount 0 } { $dbsrccount < [llength $dbsrclist] } { incr dbsrccoun
puts stderr "Error loading database source files/$f"
}
}

if { $autostart::autostartap == "true" } {
source $autostart::autoloadscript
} else {
TclReadLine::interact
}
3 changes: 1 addition & 2 deletions hammerdbcli.bat
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
@echo off
set path=.\bin;%PATH%
START tclsh86t hammerdbcli
START tclsh86t hammerdbcli %1 %2
exit

64 changes: 64 additions & 0 deletions hammerdbws
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
#!/bin/sh
#########################################################################
## \
export LD_LIBRARY_PATH=./lib:$LD_LIBRARY_PATH
## \
export PATH=./bin:$PATH
## \
exec ./bin/tclsh8.6 "$0" ${1+"$@"}
########################################################################
# HammerDB
# Copyright (C) 2003-2018 Steve Shaw
# Author contact information at: http://www.hammerdb.com
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public
# License as published by the Free Software Foundation; either
# version 3 of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public
# License along with this program; If not, see <https://www.gnu.org/licenses/>
########################################################################
global hdb_version
set hdb_version "v3.2"
puts "HammerDB Web Service $hdb_version"
puts "Copyright (C) 2003-2019 Steve Shaw"
puts "Type \"help\" for a list of commands"
set UserDefaultDir [ file dirname [ info script ] ]
::tcl::tm::path add "$UserDefaultDir/modules"

append modulelist { Thread msgcat sqlite3 xml wapp huddle }
for { set modcount 0 } { $modcount < [llength $modulelist] } { incr modcount } {
set m [lindex $modulelist $modcount]
set loadtext $m
if [catch { package require $m }] {
puts stderr "While loading module\
\"$m\"...\n$errorInfo"
exit 1
}
}

append loadlist { gendict.tcl genvu.tcl gentpcc.tcl gentpch.tcl gengen.tcl genxml.tcl geninitws.tcl genws.tcl }
for { set loadcount 0 } { $loadcount < [llength $loadlist] } { incr loadcount } {
set f [lindex $loadlist $loadcount]
set loadtext $f
if [catch {source [ file join $UserDefaultDir src generic $f ]}] {
puts stderr "While loading component file\
\"$f\"...\n$errorInfo"
exit 1
}
}

for { set dbsrccount 0 } { $dbsrccount < [llength $dbsrclist] } { incr dbsrccount } {
set f [lindex $dbsrclist $dbsrccount]
set loadtext $f
if [catch {source [ file join $UserDefaultDir src $f ]}] {
puts stderr "Error loading database source files/$f"
}
}
start_webservice
5 changes: 5 additions & 0 deletions hammerdbws.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
@echo off
set path=.\bin;%PATH%
START tclsh86t hammerdbws
exit

81 changes: 78 additions & 3 deletions modules/etprof-1.0.tm → modules/etprof-1.1.tm
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,15 @@
# at runtime.
#
# Copyright (C) 2004 Salvatore Sanfilippo
package provide etprof 1.0
#
#etprof 1.0 posted at https://wiki.tcl-lang.org/page/etprof
#https://wiki.tcl-lang.org/license
#Tcl and extensions such as Tk, Expect, tcllib are distributed under the terms of this license, a BSD-type license, which is much less restrictive than the GPL.
#It is safe to assume that any code posted on this Wiki (or that you post on this wiki) is, unless otherwise explicitly specified, under the same license.
#
# etprof 1.1 modifications from original Copyright (C) 2019 Steve Shaw under HammerDB License
#
package provide etprof 1.1

namespace eval ::etprof {}

Expand All @@ -29,7 +37,9 @@ package provide etprof 1.0
proc ::etprof::TraceHandler {name cmd args} {
# We need to misure the elapsed time as early as possible.
set enter_clicks [clock clicks]
set enter_secs [clock seconds]
set elapsed [expr {$enter_clicks-$::etprof::timer}]
set seconds [expr {$enter_secs-$::etprof::timersecs}]

#####################################################################
# Starting from this point it's possible to do potentially slow
Expand Down Expand Up @@ -64,7 +74,20 @@ package provide etprof 1.0
set t [lpop ::etprof::cumulative_timers]
set cum_elapsed [expr {$enter_clicks-$t}]
incr ::etprof::cumulative($name) $cum_elapsed
}
#intermediate percentile measurements
if {![string match {::tcl*} $name]} {
#add to list of elapsed times per name for 10 seconds
lappend ::etprof::pctiles($name) $elapsed
if {[ expr $seconds % 10 ] eq 0 } {
if { $::etprof::iterations != $seconds } {
set ::etprof::iterations $seconds
#calculate and print percentiles
::etprof::printPercentiles $seconds
}
}
}
#intermediate percentile measurements
}
::etprof::leaveHandler $name $elapsed
incr ::etprof::depth($name) -1
}
Expand Down Expand Up @@ -158,12 +181,15 @@ package provide etprof 1.0
set ::etprof::exclusive($name) 0
set ::etprof::cumulative($name) 0
set ::etprof::depth($name) 0
set ::etprof::pctiles($name) 0
}

proc ::etprof::init {} {
rename ::proc ::etprof::oldProc
rename ::etprof::profProc ::proc
set ::etprof::timer [clock clicks]
set ::etprof::timersecs [clock seconds]
set ::etprof::iterations 0
set ::etprof::hits 0
array set ::etprof::exclusive {}
array set ::etprof::cumulative {}
Expand Down Expand Up @@ -191,10 +217,59 @@ set name2 [string trimleft $name "::" ]
format "%.02f" $p
}

proc ::etprof::percentile {pvalues percent} {
proc is_whole { float } {
return [expr abs($float - int($float)) > 0 ? 0 : 1]
}
set k [ expr [ llength $pvalues ] * $percent ]
if { [ is_whole $k ] } {
set kint [ expr int($k) ]
set pctile [ expr ([lindex $pvalues [ expr $kint - 1 ]] + [lindex $pvalues $kint ]) / 2.0 ]
if { [ is_whole $pctile ] } {
set pctile [ expr int($pctile) ]
}
} else {
set k [ expr round($k) ]
set pctile [ lindex $pvalues [ expr $k - 1 ]]
}
return $pctile
}

proc ::etprof::printPercentiles { seconds } {
puts "|PERCENTILES [clock format [ expr $::etprof::timersecs + $seconds - 10 ] -format {%Y-%m-%d %H:%M:%S}] to [clock format [ expr $::etprof::timersecs + $seconds ] -format {%Y-%m-%d %H:%M:%S}]"
foreach {key val} [array get ::etprof::exclusive] {
if {[string match {::tcl*} $key]||[string match {::msgcat*} $key]||[string match {::etprof*} $key]} {
;
} else {
lappend info [list $key $val]
}
}
set info [lsort -decreasing -index 1 -integer $info]
foreach i $info {
foreach {name exclusiveTime} $i break
unset -nocomplain sortedset
set sortedset [ lsort -integer $::etprof::pctiles($name) ]
set ::etprof::pctiles($name) 0
set numvalues [ llength $sortedset ]
if { $numvalues > 1 } {
set sortedset [ lreplace $sortedset 0 0 ]
set minv [ lindex $sortedset 0 ]
set maxv [ lindex $sortedset end ]
set p99 [ ::etprof::percentile $sortedset 0.99 ]
set p95 [ ::etprof::percentile $sortedset 0.95 ]
set p50 [ ::etprof::percentile $sortedset 0.50 ]
set name2 [string trimleft $name "::" ]
puts "|$name2|MIN-$minv|P50%-$p50|P95%-$p95|P99%-$p99|MAX-$maxv|SAMPLES-$numvalues"
}
set ::etprof::pctiles($name) 0
}
::etprof::printInfoSeparator
}

proc ::etprof::printLiveInfo {} {
set info {}
foreach {key val} [array get ::etprof::exclusive] {
if {[string match {::tcl*} $key]||[string match {::msgcat*} $key]} {
if {[string match {::tcl*} $key]||[string match {::msgcat*} $key]||[string match {::etprof*} $key]} {
;
} else {
lappend info [list $key $val]
Expand Down
Loading

0 comments on commit 9d819bb

Please sign in to comment.