Lines of
benchmark.tcl
from check-in b0e3b6588f
that are changed by the sequence of edits moving toward
check-in 200a60c198:
1: #! /usr/bin/env tclsh
2:
3: set LIB_SUFFIX [info sharedlibextension]
4: load -global ./xvfs${LIB_SUFFIX}; # Optional, uses a dispatcher
5: load ./example-flexible${LIB_SUFFIX} Xvfs_example
6:
b0e3b6588f 2019-09-17 7: set benchmarkFormat "%-6s %-5s: %s"
8:
9: proc benchmark {type name code} {
b0e3b6588f 2019-09-17 10: time $code 100
b0e3b6588f 2019-09-17 11: set time [time $code 10000]
12:
13: puts [format $::benchmarkFormat $type $name $time]
14: }
15:
16: set rootDirMap(xvfs) "//xvfs:/example"
17: set rootDirMap(native) [file join [pwd] example]
18:
b0e3b6588f 2019-09-17 19: set test(CD) {
b0e3b6588f 2019-09-17 20: cd $::rootDir
b0e3b6588f 2019-09-17 21: pwd
b0e3b6588f 2019-09-17 22: }
b0e3b6588f 2019-09-17 23:
b0e3b6588f 2019-09-17 24: set test(Read) {
b0e3b6588f 2019-09-17 25: set fd [open ${::rootDir}/main.tcl]
b0e3b6588f 2019-09-17 26: read $fd
b0e3b6588f 2019-09-17 27: close $fd
b0e3b6588f 2019-09-17 28: }
b0e3b6588f 2019-09-17 29:
b0e3b6588f 2019-09-17 30: set test(Glob) {
b0e3b6588f 2019-09-17 31: glob -directory ${::rootDir} *
32: }
33:
34: foreach {testName testBody} [lsort -stride 2 -dictionary [array get test]] {
35: foreach rootDirType {xvfs native} {
36: set rootDir $rootDirMap($rootDirType)
37: benchmark $rootDirType $testName $testBody
38: }
39: }