%{
#include <stdio.h>
+#include <time.h>
#include <pakfire/constants.h>
#include <pakfire/logging.h>
DEBUG(pakfire, "Parsing the following data:\n%s\n", data);
+ // Save start time
+ clock_t t_start = clock();
+
// Create a new sub-parser
PakfireParser parser = pakfire_parser_create(pakfire, parent, NULL);
parent = pakfire_parser_merge(parent, parser);
}
+ // Save end time
+ clock_t t_end = clock();
+
// Destroy the parser
pakfire_parser_unref(parser);
DEBUG(pakfire, "Status of the parser %p:\n%s\n", parent, dump);
pakfire_free(dump);
+ // Log time we needed to parse data
+ DEBUG(pakfire, "Parser finished in %.4fms\n",
+ (double)(t_end - t_start) * 1000 / CLOCKS_PER_SEC);
+
// Cleanup
pakfire_unref(pakfire);