Changeset a15e59b for src/dgp/main.cc


Ignore:
Timestamp:
03/13/12 17:07:34 (12 years ago)
Author:
Tomasz Obrebski <to@…>
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)
Message:

dodana opcja --time w dgp, poprawione przesy�anie b�belk�w, obsluga &LEFT, &RIGHT

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/dgp/main.cc

    re7de6cc ra15e59b  
    66 * Author:      Tomasz Obrebski 
    77 */ 
     8 
     9#include <ctime> 
     10#include <sys/time.h> 
    811 
    912#include "global.hh" 
     
    1619 
    1720#define MAXSEGMENTS 500 
     21 
     22#define MICROSECONDSELAPSED(A,B) ((B.tv_sec - A.tv_sec)*1000000 + (B.tv_usec - A.tv_usec)) 
    1823 
    1924char segment[MAXSEGMENTS][MAXLINE]; 
     
    3035FILE* debugf=stdout; 
    3136unsigned int info=0U; 
     37 
     38bool printtimeinfo=false; 
    3239 
    3340void output(); 
     
    5360  if(args.debug_given) debug=true; 
    5461 
     62  if(args.time_given) printtimeinfo=true; 
     63 
    5564  for(char* c=args.info_arg; *c!='\0' ; ++c) 
    5665    switch(*c) 
     
    7079  // exit(0); 
    7180 
    72  
     81  struct timeval starttime,afterinput,afterparse,endtime; 
    7382 
    7483  mgraph.clear(); 
     
    7887  while (fgets(line, MAXLINE+1, inputf)) 
    7988  { 
     89    gettimeofday(&starttime,NULL); 
    8090    line[strlen(line)-1] = '\0'; 
    8191    strcpy(segment[segcount],line); 
     
    90100    if(strcmp(segtype,"EOS")==0) 
    91101    { 
     102      gettimeofday(&afterinput,NULL); 
    92103      dgp1(); // parametry!!! MGraph, SGraph, Grammar 
     104      gettimeofday(&afterparse,NULL); 
    93105      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        } 
    94115       
    95116      mgraph.clear(); 
Note: See TracChangeset for help on using the changeset viewer.