diff --git a/libs/util/test/test-plist.c b/libs/util/test/test-plist.c index 14b516d6c..17eaf8c6f 100644 --- a/libs/util/test/test-plist.c +++ b/libs/util/test/test-plist.c @@ -1,8 +1,11 @@ #ifdef HAVE_CONFIG_H # include "config.h" #endif +#include #include #include "QF/plist.h" +#include "QF/quakeio.h" +#include "QF/sys.h" static const char *test_strings[] = { "Guarding the entrance to the Grendal\n" @@ -45,9 +48,34 @@ main (int argc, const char **argv) int res = 0; size_t i; - for (i = 0; i < num_string_tests; i ++) { - if (!test_string_io (test_strings[i])) - res = 1; + if (argc > 1) { + int64_t start = Sys_LongTime (); + QFile *file = Qopen (argv[1], "rbz"); + size_t len = Qfilesize (file); + char *buf = malloc (len + 1); + char *txt = buf; + if (argc > 2) { + txt += atoi (argv[2]); + } + Qread (file, buf, len); + buf[len] = 0; + int64_t read = Sys_LongTime (); + plitem_t *item = PL_GetPropertyList (txt, nullptr); + printf ("%p %d\n", item, PL_Type (item)); + free (buf); + int64_t parse = Sys_LongTime (); + PL_Release (item); + int64_t end = Sys_LongTime (); + printf ("total:%g read:%g parse:%g free:%g\n", + (end - start) / 1000.0, + (read - start) / 1000.0, + (parse - read) / 1000.0, + (end - parse) / 1000.0); + } else { + for (i = 0; i < num_string_tests; i ++) { + if (!test_string_io (test_strings[i])) + res = 1; + } } return res; }