Check-in [b0e3b6588f]
Overview
Comment:Added benchmark code
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: b0e3b6588fd6f04f0f5bbc61f4fc77c961e14b78ceb5d5aa11e958b9aa5133f4
User & Date: rkeene on 2019-09-17 23:41:31
Other Links: manifest | tags
Context
2019-09-17
23:43
When compiling the benchmarks, optimize check-in: 7225016a7e user: rkeene tags: trunk
23:41
Added benchmark code check-in: b0e3b6588f user: rkeene tags: trunk
23:23
Made the entire data for file contents read-only check-in: 745e0c0839 user: rkeene tags: trunk
Changes

Modified Makefile from [e3065892de] to [eeaa998272].

1
2
3

4
5
6
7
8
9
10
1
2

3
4
5
6
7
8
9
10


-
+







TCL_CONFIG_SH := /usr/lib64/tclConfig.sh
CPPFLAGS      := -I. -DUSE_TCL_STUBS=1 -DXVFS_DEBUG $(shell . "${TCL_CONFIG_SH}" && echo "$${TCL_INCLUDE_SPEC}") $(XVFS_ADD_CPPFLAGS)
CFLAGS        := -fPIC -g3 -ggdb3 -Wall $(XVFS_ADD_CFLAGS)
CFLAGS        := -fPIC -g3 -ggdb3 -Wall -Wextra $(XVFS_ADD_CFLAGS)
LDFLAGS       := $(XVFS_ADD_LDFLAGS)
LIBS          := $(shell . "${TCL_CONFIG_SH}" && echo "$${TCL_STUB_LIB_SPEC}")
TCLSH         := tclsh
LIB_SUFFIX    := $(shell . "${TCL_CONFIG_SH}"; echo "$${TCL_SHLIB_SUFFIX:-.so}")

all: example-standalone$(LIB_SUFFIX) example-client$(LIB_SUFFIX) example-flexible$(LIB_SUFFIX) xvfs$(LIB_SUFFIX)

39
40
41
42
43
44
45



46
47
48
49
50
51
52
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55







+
+
+







# xvfs-create-standalone is a standalone (i.e., no external dependencies
# like lib/minirivet, xvfs-core.c, etc) version of "xvfs-create"
xvfs-create-standalone: $(shell find lib -type f) xvfs-create xvfs-core.c xvfs-core.h xvfs.c.rvt Makefile
	rm -f xvfs-create-standalone.new xvfs-create-standalone
	./xvfs-create --dump-tcl --remove-debug > xvfs-create-standalone.new
	chmod +x xvfs-create-standalone.new
	mv xvfs-create-standalone.new xvfs-create-standalone

benchmark: xvfs$(LIB_SUFFIX) example-flexible$(LIB_SUFFIX) Makefile
	./benchmark.tcl

test: example-standalone$(LIB_SUFFIX) xvfs$(LIB_SUFFIX) example-client$(LIB_SUFFIX) example-flexible$(LIB_SUFFIX) Makefile
	rm -f __test__.tcl
	echo 'if {[catch { eval $$::env(XVFS_TEST_LOAD_COMMANDS); source //xvfs:/example/main.tcl }]} { puts stderr $$::errorInfo; exit 1 }; exit 0' > __test__.tcl
	@export XVFS_TEST_LOAD_COMMANDS; for XVFS_TEST_LOAD_COMMANDS in \
		'load ./example-standalone$(LIB_SUFFIX) Xvfs_example' \
		'load -global ./xvfs$(LIB_SUFFIX); load ./example-client$(LIB_SUFFIX) Xvfs_example' \
81
82
83
84
85
86
87
88

84
85
86
87
88
89
90

91







-
+
	rm -f xvfs.gcda xvfs.gcno
	rm -f __test__.tcl
	rm -f xvfs-test-coverage.info
	rm -rf xvfs-test-coverage

distclean: clean

.PHONY: all clean distclean test coverage
.PHONY: all clean distclean test coverage benchmark

Added benchmark.tcl version [23868591a9].








































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
#! /usr/bin/env tclsh

set LIB_SUFFIX [info sharedlibextension]
load -global ./xvfs${LIB_SUFFIX}; # Optional, uses a dispatcher
load ./example-flexible${LIB_SUFFIX} Xvfs_example

set benchmarkFormat "%-6s %-5s: %s"

proc benchmark {type name code} {
	time $code 100
	set time [time $code 10000]

	puts [format $::benchmarkFormat $type $name $time]
}

set rootDirMap(xvfs) "//xvfs:/example"
set rootDirMap(native) [file join [pwd] example]

set test(CD) {
	cd $::rootDir
	pwd
}

set test(Read) {
	set fd [open ${::rootDir}/main.tcl]
	read $fd
	close $fd
}

set test(Glob) {
	glob -directory ${::rootDir} *
}

foreach {testName testBody} [lsort -stride 2 -dictionary [array get test]] {
	foreach rootDirType {xvfs native} {
		set rootDir $rootDirMap($rootDirType)
		benchmark $rootDirType $testName $testBody
	}
}