/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 parse/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:
 
1
#include <stdio.h>
 
2
#include <sys/time.h>
1
3
#include <stdlib.h>
2
4
#include <unistd.h>
3
5
#include <sys/types.h>
83
85
    struct TestData td;
84
86
    char *xmlbuf;
85
87
    FILE *f;
 
88
 
 
89
    int execute_xml = 1;
 
90
    
 
91
    if (getenv("skip_xml")) execute_xml = 0;
86
92
    
87
93
    if ((argc<3)||(argc>4)) Usage(argv[0]);
88
94
    
89
95
    td.iterations = atol(argv[1]);
90
 
    if (td.iterations<=0) Usage(argv[0]);
 
96
    if (td.iterations<0) Usage(argv[0]);
91
97
 
92
98
#ifdef DTD_VALIDATION
93
99
#ifndef DTD_VALIDATION_SUPPORTED
151
157
#endif /* GENERATOR_XMARK */
152
158
 
153
159
    }
154
 
 
 
160
//    printf("here: %u %p %p\n", sizeof(struct TestData), &td, td.xml);
 
161
    
155
162
    gettimeofday(&pre_time,NULL);
156
163
    initXML(&td);
157
164
    gettimeofday(&post_time,NULL);
164
171
#endif
165
172
 
166
173
    gettimeofday(&pre_time,NULL);
167
 
    parseXML(&td,0);
 
174
    if (execute_xml) parseXML(&td,0);
168
175
    gettimeofday(&post_time,NULL);
169
176
    init_time2=(post_time.tv_sec-pre_time.tv_sec)*1000000+(post_time.tv_usec-pre_time.tv_usec);
170
177
        
171
178
    disp_init();
172
179
    for (i=1;i<=td.iterations;i++) {
173
180
        switch (mode) {
 
181
#if defined(RAPIDXML_PARSER_FIX)
 
182
            case 0:
 
183
                f=fopen(argv[2],"r");
 
184
                if (f) {
 
185
                    fread(td.xml,td.xmllen,1,f);
 
186
                    fclose(f);
 
187
                }
 
188
            break;
 
189
#endif /* defined(RAPIDXML_PARSER_FIX) */
174
190
            case 1:
175
191
                td.xmllen=xmlgen();
176
192
            break;
194
210
#endif
195
211
        
196
212
        gettimeofday(&pre_time,NULL);
197
 
        parseXML(&td,i);
 
213
        if (execute_xml) parseXML(&td,i);
198
214
        gettimeofday(&post_time,NULL);
199
215
        time=(post_time.tv_sec-pre_time.tv_sec)*1000000+(post_time.tv_usec-pre_time.tv_usec);
200
216
        disp_event(time);