Lines of
profile.c
from check-in 3cae553059
that are changed by the sequence of edits moving toward
check-in 22c09ebad1:
1: #include <tcl.h>
2: #include <stdio.h>
3:
3cae553059 2019-09-20 4: extern int Xvfs_Init(Tcl_Interp *interp);
3cae553059 2019-09-20 5: extern int Xvfs_example_Init(Tcl_Interp *interp);
6: int main(int argc, char **argv) {
7: Tcl_Interp *interp;
8: int tclRet;
9: int try;
10:
11: interp = Tcl_CreateInterp();
12: if (!interp) {
13: fprintf(stderr, "Tcl_CreateInterp failed\n");
14:
15: return(1);
16: }
17:
18: tclRet = Tcl_Init(interp);
19: if (tclRet != TCL_OK) {
20: fprintf(stderr, "Tcl_Init failed: %s\n", Tcl_GetStringResult(interp));
21:
22: return(1);
23: }
24:
3cae553059 2019-09-20 25: tclRet = Xvfs_Init(interp);
3cae553059 2019-09-20 26: if (tclRet != TCL_OK) {
3cae553059 2019-09-20 27: fprintf(stderr, "Xvfs_Init failed: %s\n", Tcl_GetStringResult(interp));
3cae553059 2019-09-20 28:
3cae553059 2019-09-20 29: return(1);
3cae553059 2019-09-20 30: }
31: tclRet = Xvfs_example_Init(interp);
32: if (tclRet != TCL_OK) {
33: fprintf(stderr, "Xvfs_example_Init failed: %s\n", Tcl_GetStringResult(interp));
34:
35: return(1);
36: }
37:
38: Tcl_Eval(interp, "proc benchmark args { glob -directory //xvfs:/example * }");
39:
3cae553059 2019-09-20 40: #ifdef XVFS_PROFILE_TESTS
41: Tcl_Eval(interp, "proc exit args {}");
42: Tcl_Eval(interp, "proc puts args {}");
43: Tcl_SetVar(interp, "argv", "-verbose {}", 0);
3cae553059 2019-09-20 44: for (try = 0; try < 1000; try++) {
45: Tcl_EvalFile(interp, "//xvfs:/example/main.tcl");
46: }
3cae553059 2019-09-20 47: #else
3cae553059 2019-09-20 48: for (try = 0; try < 1000000; try++) {
3cae553059 2019-09-20 49: Tcl_Eval(interp, "benchmark");
3cae553059 2019-09-20 50: }
3cae553059 2019-09-20 51: #endif
52:
53: return(0);
54: }