MCPcopy Create free account
hub / github.com/acl-dev/acl / parse_xml_benchmark

Function parse_xml_benchmark

lib_acl/samples/xml/xml3/xml.c:140–186  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

138 "<?xml-stylesheet type=\"text/xsl\">\r\n";
139
140static void parse_xml_benchmark(int once, int max, const char *data)
141{
142 int i;
143 size_t size = strlen(data) * 4;
144 const char *mmap_file = "./local.map";
145 ACL_XML2 *xml = acl_xml2_mmap_file(mmap_file, size, 1, NULL);
146
147 acl_xml2_slash(xml, 1);
148
149 ACL_METER_TIME("-------------bat begin--------------");
150 for (i = 0; i < max; i++) {
151 const char *ptr = data;
152
153 if (once) {
154 acl_xml2_parse(xml, ptr);
155 } else {
156 /* ÿ�ν�����һ���ֽ������� xml ���� */
157 while (*ptr != 0) {
158 char ch2[2];
159
160 ch2[0] = *ptr;
161 ch2[1] = 0;
162 acl_xml2_parse(xml, ch2);
163 ptr++;
164 }
165 }
166 /*
167 if (i < 2 || i == 4) {
168 printf("--------- dump xml --------------\n");
169 acl_xml_dump(xml, ACL_VSTREAM_OUT);
170 printf("--------- data src --------------\n");
171 printf("%s", data);
172 printf("--------- dump end --------------\n");
173 }
174 */
175
176 acl_xml2_reset(xml);
177 }
178
179 ACL_METER_TIME("-------------bat end--------------");
180 acl_xml2_free(xml);
181
182 printf("--------------benchmark_max: %d--------------\r\n", max);
183
184 printf("Enter any key to continue ...\r\n");
185 getchar();
186}
187
188static int parse_xml_file(const char *filepath)
189{

Callers 1

mainFunction · 0.70

Calls 4

acl_xml2_mmap_fileFunction · 0.85
acl_xml2_slashFunction · 0.85
acl_xml2_resetFunction · 0.85
acl_xml2_freeFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…