Check-in [3cae553059]
Overview
Comment:Added a "do-profile" target which uses OProfile to profile
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 3cae5530598fb27dec130da52a9faa2dba5ef57b0189a28a5af9b09c8d3ff8bf
User & Date: rkeene on 2019-09-20 20:30:19
Other Links: manifest | tags
Context
2019-09-20
20:52
More profiling work check-in: 22c09ebad1 user: rkeene tags: trunk
20:30
Added a "do-profile" target which uses OProfile to profile check-in: 3cae553059 user: rkeene tags: trunk
19:04
Use flexible mode for our demos check-in: 9b49bfa195 user: rkeene tags: trunk
Changes

Modified .fossil-settings/ignore-glob from [921d15e503] to [7ee6f2e4ca].

19
20
21
22
23
24
25


xvfs-create-standalone.new
xvfs-create-standalone
xvfs-test-coverage
__test__.tcl
sdks
xvfs_random.so
xvfs_synthetic.so









>
>
19
20
21
22
23
24
25
26
27
xvfs-create-standalone.new
xvfs-create-standalone
xvfs-test-coverage
__test__.tcl
sdks
xvfs_random.so
xvfs_synthetic.so
profile
oprofile_data

Modified Makefile from [70eadc23e9] to [fa807992c6].

47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70


71
72
73
74
75
76
77
78
79
80










81
82
83
84
85
86
87
88
89
90
91
92
93
94


95
96
97
98
99
100

xvfs_random$(LIB_SUFFIX): $(shell find example -type f) $(shell find lib -type f) lib/xvfs/xvfs.c.rvt xvfs-create-random Makefile
	./xvfs-create-random | $(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) -DXVFS_MODE_FLEXIBLE -x c - -shared -o xvfs_random$(LIB_SUFFIX) $(LIBS)

xvfs_synthetic$(LIB_SUFFIX): $(shell find lib -type f) lib/xvfs/xvfs.c.rvt xvfs-create-synthetic Makefile
	./xvfs-create-synthetic | $(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) -DXVFS_MODE_FLEXIBLE -x c - -shared -o xvfs_synthetic$(LIB_SUFFIX) $(LIBS)

benchmark:
	$(MAKE) clean all XVFS_ADD_CPPFLAGS="-UXVFS_DEBUG" XVFS_ADD_CFLAGS="-g0 -ggdb0 -s -O3"
	./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_ROOT_MOUNTPOINT)example/main.tcl }]} { puts stderr $$::errorInfo; exit 1 }; exit 0' > __test__.tcl
	@export XVFS_ROOT_MOUNTPOINT; 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' \
		'load ./xvfs$(LIB_SUFFIX); load ./example-flexible$(LIB_SUFFIX) Xvfs_example' \
		'load ./example-flexible$(LIB_SUFFIX) Xvfs_example'; do \
			echo "[$${XVFS_TEST_LOAD_COMMANDS}] $(GDB) $(TCLSH) __test__.tcl $(TCL_TEST_ARGS)"; \
			$(GDB) $(TCLSH) __test__.tcl $(TCL_TEST_ARGS) || exit 1; \
	done
	rm -f __test__.tcl



coverage:
	$(MAKE) clean
	$(MAKE) XVFS_ADD_CFLAGS=-coverage XVFS_ADD_LDFLAGS=-coverage
	$(MAKE) test XVFS_TEST_EXIT_ON_FAILURE=0
	rm -f xvfs-test-coverage.info
	lcov --capture --directory . --output-file xvfs-test-coverage.info
	rm -rf xvfs-test-coverage
	mkdir xvfs-test-coverage
	genhtml xvfs-test-coverage.info --output-directory xvfs-test-coverage
	rm -f xvfs-test-coverage.info











clean:
	rm -f xvfs-create-standalone.new xvfs-create-standalone
	rm -f example.c example.c.new
	rm -f example-standalone$(LIB_SUFFIX) example-standalone.o
	rm -f example-client.o example-client$(LIB_SUFFIX)
	rm -f example-flexible.o example-flexible$(LIB_SUFFIX)
	rm -f xvfs.o xvfs$(LIB_SUFFIX)
	rm -f example-standalone.gcda example-standalone.gcno
	rm -f example-client.gcda example-client.gcno
	rm -f example-flexible.gcda example-flexible.gcno
	rm -f xvfs_random$(LIB_SUFFIX) xvfs_synthetic$(LIB_SUFFIX)
	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 benchmark







|
















>
>
|









>
>
>
>
>
>
>
>
>
>














>
>





|
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114

xvfs_random$(LIB_SUFFIX): $(shell find example -type f) $(shell find lib -type f) lib/xvfs/xvfs.c.rvt xvfs-create-random Makefile
	./xvfs-create-random | $(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) -DXVFS_MODE_FLEXIBLE -x c - -shared -o xvfs_random$(LIB_SUFFIX) $(LIBS)

xvfs_synthetic$(LIB_SUFFIX): $(shell find lib -type f) lib/xvfs/xvfs.c.rvt xvfs-create-synthetic Makefile
	./xvfs-create-synthetic | $(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) -DXVFS_MODE_FLEXIBLE -x c - -shared -o xvfs_synthetic$(LIB_SUFFIX) $(LIBS)

do-benchmark:
	$(MAKE) clean all XVFS_ADD_CPPFLAGS="-UXVFS_DEBUG" XVFS_ADD_CFLAGS="-g0 -ggdb0 -s -O3"
	./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_ROOT_MOUNTPOINT)example/main.tcl }]} { puts stderr $$::errorInfo; exit 1 }; exit 0' > __test__.tcl
	@export XVFS_ROOT_MOUNTPOINT; 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' \
		'load ./xvfs$(LIB_SUFFIX); load ./example-flexible$(LIB_SUFFIX) Xvfs_example' \
		'load ./example-flexible$(LIB_SUFFIX) Xvfs_example'; do \
			echo "[$${XVFS_TEST_LOAD_COMMANDS}] $(GDB) $(TCLSH) __test__.tcl $(TCL_TEST_ARGS)"; \
			$(GDB) $(TCLSH) __test__.tcl $(TCL_TEST_ARGS) || exit 1; \
	done
	rm -f __test__.tcl

do-test: test

do-coverage:
	$(MAKE) clean
	$(MAKE) XVFS_ADD_CFLAGS=-coverage XVFS_ADD_LDFLAGS=-coverage
	$(MAKE) test XVFS_TEST_EXIT_ON_FAILURE=0
	rm -f xvfs-test-coverage.info
	lcov --capture --directory . --output-file xvfs-test-coverage.info
	rm -rf xvfs-test-coverage
	mkdir xvfs-test-coverage
	genhtml xvfs-test-coverage.info --output-directory xvfs-test-coverage
	rm -f xvfs-test-coverage.info

profile: profile.c Makefile
	rm -f example-client$(LIB_SUFFIX) xvfs$(LIB_SUFFIX)
	$(MAKE) xvfs$(LIB_SUFFIX) example-client$(LIB_SUFFIX) XVFS_ADD_CPPFLAGS="-UXVFS_DEBUG"
	$(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) -UUSE_TCL_STUBS ./xvfs$(LIB_SUFFIX) ./example-client$(LIB_SUFFIX) -o profile profile.c -ltcl

do-profile: profile Makefile
	rm -rf oprofile_data
	LD_LIBRARY_PATH='$(shell pwd):$(LD_LIBRARY_PATH)' operf ./profile
	opreport

clean:
	rm -f xvfs-create-standalone.new xvfs-create-standalone
	rm -f example.c example.c.new
	rm -f example-standalone$(LIB_SUFFIX) example-standalone.o
	rm -f example-client.o example-client$(LIB_SUFFIX)
	rm -f example-flexible.o example-flexible$(LIB_SUFFIX)
	rm -f xvfs.o xvfs$(LIB_SUFFIX)
	rm -f example-standalone.gcda example-standalone.gcno
	rm -f example-client.gcda example-client.gcno
	rm -f example-flexible.gcda example-flexible.gcno
	rm -f xvfs_random$(LIB_SUFFIX) xvfs_synthetic$(LIB_SUFFIX)
	rm -f xvfs.gcda xvfs.gcno
	rm -f __test__.tcl
	rm -f profile
	rm -rf oprofile_data
	rm -f xvfs-test-coverage.info
	rm -rf xvfs-test-coverage

distclean: clean

.PHONY: all clean distclean test do-test do-coverage do-benchmark do-profile

Added profile.c version [e65448a613].













































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#include <tcl.h>
#include <stdio.h>

extern int Xvfs_Init(Tcl_Interp *interp);
extern int Xvfs_example_Init(Tcl_Interp *interp);
int main(int argc, char **argv) {
	Tcl_Interp *interp;
	int tclRet;
	int try;

	interp = Tcl_CreateInterp();
	if (!interp) {
		fprintf(stderr, "Tcl_CreateInterp failed\n");

		return(1);
	}

	tclRet = Tcl_Init(interp);
	if (tclRet != TCL_OK) {
		fprintf(stderr, "Tcl_Init failed: %s\n", Tcl_GetStringResult(interp));

		return(1);
	}

	tclRet = Xvfs_Init(interp);
	if (tclRet != TCL_OK) {
		fprintf(stderr, "Xvfs_Init failed: %s\n", Tcl_GetStringResult(interp));

		return(1);
	}
	tclRet = Xvfs_example_Init(interp);
	if (tclRet != TCL_OK) {
		fprintf(stderr, "Xvfs_example_Init failed: %s\n", Tcl_GetStringResult(interp));

		return(1);
	}

	Tcl_Eval(interp, "proc benchmark args { glob -directory //xvfs:/example * }");

#ifdef XVFS_PROFILE_TESTS
	Tcl_Eval(interp, "proc exit args {}");
	Tcl_Eval(interp, "proc puts args {}");
	Tcl_SetVar(interp, "argv", "-verbose {}", 0);
	for (try = 0; try < 1000; try++) {
		Tcl_EvalFile(interp, "//xvfs:/example/main.tcl");
	}
#else
	for (try = 0; try < 1000000; try++) {
		Tcl_Eval(interp, "benchmark");
	}
#endif

	return(0);
}