/xmlbench/trunk

To get this branch, use:
bzr branch http://darksoft.org/webbzr/xmlbench/trunk

« back to all changes in this revision

Viewing changes to create/tools.h

  • Committer: Suren A. Chilingaryan
  • Date: 2009-09-23 17:13:04 UTC
  • Revision ID: csa@dside.dyndns.org-20090923171304-osvtr4zqb29h11kd
Intel, Tango, Phobos, and RapidXML parsers; Memory benchmark scripts

Show diffs side-by-side

added added

removed removed

Lines of Context:
7
7
struct TestData {
8
8
    unsigned long iterations;
9
9
    unsigned long inc;
 
10
    char memory_bench;
10
11
};
11
12
 
12
13
char *ReadFile(char *fn) {
59
60
    unsigned long time;
60
61
    struct TestData td;
61
62
 
 
63
    int execute_xml = 1;
 
64
    
 
65
    if (getenv("skip_xml")) execute_xml = 0;
 
66
 
 
67
    if (getenv("memory_bench")) td.memory_bench = 1;
 
68
    else td.memory_bench = 0;
 
69
    
62
70
    if (argc>=2) td.iterations=atol(argv[1]);
63
71
    else Usage(argv[0]);
64
 
    if (argc==3) td.inc=atol(argv[2]);
 
72
    if (argc>3) td.inc=atol(argv[3]);
 
73
    else if (argc==3) td.inc=atol(argv[2]);
65
74
    else td.inc=0;
66
75
 
67
76
    initXML(&td);
68
 
    parseXML(&td,0);
 
77
    if (execute_xml) parseXML(&td,0);
69
78
    
70
79
    disp_init();
71
80
    for (i=1;i<=td.iterations;i++) {
72
81
        gettimeofday(&pre_time,NULL);
73
 
        parseXML(&td,i);
 
82
        if (execute_xml) parseXML(&td,i);
74
83
        gettimeofday(&post_time,NULL);
75
84
        time=(post_time.tv_sec-pre_time.tv_sec)*1000000+(post_time.tv_usec-pre_time.tv_usec);
76
85
        disp_event(time);