summaryrefslogtreecommitdiff
path: root/src/runtime/c/utils
diff options
context:
space:
mode:
authorkr.angelov <kr.angelov@gmail.com>2012-02-21 20:17:18 +0000
committerkr.angelov <kr.angelov@gmail.com>2012-02-21 20:17:18 +0000
commita178608f3756c6c8ec673c6fe2b39d8e75d8c0a4 (patch)
tree702c5a542bf055ec41672f4b4dee87bbc06d2486 /src/runtime/c/utils
parente725b10d667678b79b28899093fe4df69d35755c (diff)
utils/pgf-translate now reports the parsing time
Diffstat (limited to 'src/runtime/c/utils')
-rw-r--r--src/runtime/c/utils/pgf-translate.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/runtime/c/utils/pgf-translate.c b/src/runtime/c/utils/pgf-translate.c
index 6d0a8804d..129bd29a4 100644
--- a/src/runtime/c/utils/pgf-translate.c
+++ b/src/runtime/c/utils/pgf-translate.c
@@ -14,6 +14,7 @@
#include <stdlib.h>
#include <string.h>
#include <locale.h>
+#include <time.h>
int main(int argc, char* argv[]) {
// Set the character locale, so we can produce proper output.
@@ -102,6 +103,8 @@ int main(int argc, char* argv[]) {
// sentence, so our memory usage doesn't increase over time.
GuPool* ppool = gu_new_pool();
+ clock_t start = clock();
+
// Begin parsing a sentence of the specified category
PgfParse* parse =
pgf_parser_parse(from_concr, cat, lin_idx, pool);
@@ -125,6 +128,11 @@ int main(int argc, char* argv[]) {
}
tok = strtok(NULL, " \n");
}
+
+ clock_t end = clock();
+
+ double cpu_time_used = ((double) (end - start)) / CLOCKS_PER_SEC;
+ printf("%.2f sec\n", cpu_time_used);
// Now begin enumerating the resulting syntax trees
GuEnum* result = pgf_parse_result(parse, ppool);