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);
}
|
>
>
>
>
|
<
>
>
>
>
>
>
>
>
>
>
>
>
<
<
<
<
<
<
>
>
|
|
|
<
<
<
<
<
|
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
55
56
57
58
59
60
|
#include <tcl.h>
#include <stdio.h>
#include <stdlib.h>
#undef XVFS_DEBUG
#define XVFS_MODE_STANDALONE
#include "example.c"
int main(int argc, char **argv) {
Tcl_Interp *interp;
int profileTests, profileBenchmark;
int tclRet;
int try;
profileTests = 0;
profileBenchmark = 1000000;
if (argc > 1) {
profileBenchmark = atoi(argv[1]);
}
if (argc > 2) {
profileTests = atoi(argv[2]);
}
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_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 * }");
for (try = 0; try < profileBenchmark; try++) {
Tcl_Eval(interp, "benchmark");
}
Tcl_Eval(interp, "proc exit args {}");
Tcl_Eval(interp, "proc puts args {}");
Tcl_SetVar(interp, "argv", "-verbose {}", 0);
for (try = 0; try < profileTests; try++) {
Tcl_EvalFile(interp, "//xvfs:/example/main.tcl");
}
return(0);
}
|