Changeset a15e59b for src/dgp/main.cc
- Timestamp:
- 03/13/12 17:07:34 (13 years ago)
- Branches:
- master
- Children:
- f4bf33e
- Parents:
- abd28d1
- git-author:
- Tomasz Obrebski <to@…> (03/13/12 17:07:34)
- git-committer:
- Tomasz Obrebski <to@…> (03/13/12 17:07:34)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/dgp/main.cc
re7de6cc ra15e59b 6 6 * Author: Tomasz Obrebski 7 7 */ 8 9 #include <ctime> 10 #include <sys/time.h> 8 11 9 12 #include "global.hh" … … 16 19 17 20 #define MAXSEGMENTS 500 21 22 #define MICROSECONDSELAPSED(A,B) ((B.tv_sec - A.tv_sec)*1000000 + (B.tv_usec - A.tv_usec)) 18 23 19 24 char segment[MAXSEGMENTS][MAXLINE]; … … 30 35 FILE* debugf=stdout; 31 36 unsigned int info=0U; 37 38 bool printtimeinfo=false; 32 39 33 40 void output(); … … 53 60 if(args.debug_given) debug=true; 54 61 62 if(args.time_given) printtimeinfo=true; 63 55 64 for(char* c=args.info_arg; *c!='\0' ; ++c) 56 65 switch(*c) … … 70 79 // exit(0); 71 80 72 81 struct timeval starttime,afterinput,afterparse,endtime; 73 82 74 83 mgraph.clear(); … … 78 87 while (fgets(line, MAXLINE+1, inputf)) 79 88 { 89 gettimeofday(&starttime,NULL); 80 90 line[strlen(line)-1] = '\0'; 81 91 strcpy(segment[segcount],line); … … 90 100 if(strcmp(segtype,"EOS")==0) 91 101 { 102 gettimeofday(&afterinput,NULL); 92 103 dgp1(); // parametry!!! MGraph, SGraph, Grammar 104 gettimeofday(&afterparse,NULL); 93 105 output(); 106 gettimeofday(&endtime,NULL); 107 108 if(printtimeinfo) 109 { 110 fprintf(stderr,"### INPUT TIME: %10.2fms\n", (float)MICROSECONDSELAPSED(starttime,afterinput)/1000 ); 111 fprintf(stderr,"### PARSE TIME: %10.2fms\n", (float)MICROSECONDSELAPSED(afterinput,afterparse)/1000 ); 112 fprintf(stderr,"### OUTPUT TIME: %10.2fms\n", (float)MICROSECONDSELAPSED(afterparse,endtime)/1000 ); 113 fprintf(stderr,"### TOTAL TIME: %10.2fms\n", (float)MICROSECONDSELAPSED(starttime,endtime)/1000 ); 114 } 94 115 95 116 mgraph.clear();
Note: See TracChangeset
for help on using the changeset viewer.