Annotation For profile.c

Origin for each line in profile.c from check-in 22c09ebad1:

3cae553059 2019-09-20    1: #include <tcl.h>
3cae553059 2019-09-20    2: #include <stdio.h>
22c09ebad1 2019-09-20    3: #include <stdlib.h>
3cae553059 2019-09-20    4: 
22c09ebad1 2019-09-20    5: #undef  XVFS_DEBUG
22c09ebad1 2019-09-20    6: #define XVFS_MODE_STANDALONE
22c09ebad1 2019-09-20    7: #include "example.c"
22c09ebad1 2019-09-20    8: 
3cae553059 2019-09-20    9: int main(int argc, char **argv) {
3cae553059 2019-09-20   10: 	Tcl_Interp *interp;
22c09ebad1 2019-09-20   11: 	int profileTests, profileBenchmark;
3cae553059 2019-09-20   12: 	int tclRet;
3cae553059 2019-09-20   13: 	int try;
22c09ebad1 2019-09-20   14: 
22c09ebad1 2019-09-20   15: 	profileTests = 0;
22c09ebad1 2019-09-20   16: 	profileBenchmark = 1000000;
22c09ebad1 2019-09-20   17: 
22c09ebad1 2019-09-20   18: 	if (argc > 1) {
22c09ebad1 2019-09-20   19: 		profileBenchmark = atoi(argv[1]);
22c09ebad1 2019-09-20   20: 	}
22c09ebad1 2019-09-20   21: 
22c09ebad1 2019-09-20   22: 	if (argc > 2) {
22c09ebad1 2019-09-20   23: 		profileTests = atoi(argv[2]);
22c09ebad1 2019-09-20   24: 	}
3cae553059 2019-09-20   25: 
3cae553059 2019-09-20   26: 	interp = Tcl_CreateInterp();
3cae553059 2019-09-20   27: 	if (!interp) {
3cae553059 2019-09-20   28: 		fprintf(stderr, "Tcl_CreateInterp failed\n");
3cae553059 2019-09-20   29: 
3cae553059 2019-09-20   30: 		return(1);
3cae553059 2019-09-20   31: 	}
3cae553059 2019-09-20   32: 
3cae553059 2019-09-20   33: 	tclRet = Tcl_Init(interp);
3cae553059 2019-09-20   34: 	if (tclRet != TCL_OK) {
3cae553059 2019-09-20   35: 		fprintf(stderr, "Tcl_Init failed: %s\n", Tcl_GetStringResult(interp));
3cae553059 2019-09-20   36: 
3cae553059 2019-09-20   37: 		return(1);
3cae553059 2019-09-20   38: 	}
3cae553059 2019-09-20   39: 
3cae553059 2019-09-20   40: 	tclRet = Xvfs_example_Init(interp);
3cae553059 2019-09-20   41: 	if (tclRet != TCL_OK) {
3cae553059 2019-09-20   42: 		fprintf(stderr, "Xvfs_example_Init failed: %s\n", Tcl_GetStringResult(interp));
3cae553059 2019-09-20   43: 
3cae553059 2019-09-20   44: 		return(1);
3cae553059 2019-09-20   45: 	}
3cae553059 2019-09-20   46: 
3cae553059 2019-09-20   47: 	Tcl_Eval(interp, "proc benchmark args { glob -directory //xvfs:/example * }");
22c09ebad1 2019-09-20   48: 	for (try = 0; try < profileBenchmark; try++) {
22c09ebad1 2019-09-20   49: 		Tcl_Eval(interp, "benchmark");
22c09ebad1 2019-09-20   50: 	}
3cae553059 2019-09-20   51: 
3cae553059 2019-09-20   52: 	Tcl_Eval(interp, "proc exit args {}");
3cae553059 2019-09-20   53: 	Tcl_Eval(interp, "proc puts args {}");
3cae553059 2019-09-20   54: 	Tcl_SetVar(interp, "argv", "-verbose {}", 0);
22c09ebad1 2019-09-20   55: 	for (try = 0; try < profileTests; try++) {
3cae553059 2019-09-20   56: 		Tcl_EvalFile(interp, "//xvfs:/example/main.tcl");
3cae553059 2019-09-20   57: 	}
3cae553059 2019-09-20   58: 
3cae553059 2019-09-20   59: 	return(0);
3cae553059 2019-09-20   60: }