Ignore:
Timestamp:
Feb 25, 2013, 10:45:10 AM (7 years ago)
Author:
cameron
Message:

Lex 2-block mode

File:
1 edited

Legend:

Unmodified
Added
Removed
  • proto/PDF/cb_template.cpp

    r2911 r2914  
    2222
    2323#ifdef BUFFER_PROFILING
     24        BOM_Table * s2p_lex_timer;
    2425        BOM_Table * parser_timer;
     26        BOM_Table * postprocess_timer;
    2527
    2628#elif CODE_CLOCKER
     
    3234        CC * parser_timer = new CC(Events,NUM_EVENTS,cal_size);
    3335#else
     36        void * s2p_lex_timer;
    3437        void * parser_timer;
     38        void * postprocess_timer;
    3539#endif
    3640
     
    139143//      PERF_SEC_BIND(1);
    140144
     145        PERF_SEC_INIT(s2p_lex_timer);
    141146        PERF_SEC_INIT(parser_timer);
     147        PERF_SEC_INIT(postprocess_timer);
    142148
    143149        do_process(infile, outfile, fileinfo.st_size+1);
    144150
     151        PERF_SEC_DUMP(s2p_lex_timer);
    145152        PERF_SEC_DUMP(parser_timer);
    146 
     153        PERF_SEC_DUMP(postprocess_timer);
     154
     155        PERF_SEC_DESTROY(s2p_lex_timer);
    147156        PERF_SEC_DESTROY(parser_timer);
     157        PERF_SEC_DESTROY(postprocess_timer);
    148158
    149159        fclose(infile);
     
    312322  struct Basis_bits * basis_bits = (struct Basis_bits *)malloc(sizeof(struct Basis_bits)*BLOCKS);
    313323
     324#ifndef TWOBLOCK_LEX
    314325  struct Lex * lex = (struct Lex *)malloc(sizeof(struct Lex)*BLOCKS);
    315  
     326#endif
     327#ifdef TWOBLOCK_LEX 
     328  struct Lex lex0;
     329  struct Lex lex1;
     330#endif
     331
    316332  struct Parity parity;
    317333
     
    341357
    342358
    343     PERF_SEC_START(parser_timer);
     359    PERF_SEC_START(s2p_lex_timer);
    344360   
    345361    for (int i = 0; i < BLOCKS; i++){
    346362      s2p_do_block((BytePack *) &srcbuf[i*BLOCK_SIZE], basis_bits[i]);
     363    }
     364#ifndef TWOBLOCK_LEX
     365    for (int i = 0; i < BLOCKS; i++){
    347366      classify_bytes.do_block(basis_bits[i], lex[i]);
    348367    }
    349    
     368#endif
     369#ifdef TWOBLOCK_LEX 
     370    classify_bytes.do_block(basis_bits[0], lex0);
     371#endif
     372   
     373    PERF_SEC_END(s2p_lex_timer, chars_read);
     374    PERF_SEC_START(parser_timer);
     375
     376
    350377    for (int i = 0; i < BLOCKS-1; i++){
     378#ifdef TWOBLOCK_LEX 
     379      classify_bytes.do_block(basis_bits[i+1], lex1);
     380      parse_Escaped.do_block(lex0, parity, escape_Callouts, out_Callouts, lex1);
     381      parse_Comment.do_block(lex0, escape_Callouts, marker[i], out_Callouts);
     382      parse_String.do_block(escape_Callouts, marker[i], out_Callouts);
     383      parse_HexStrings.do_block(lex0, marker[i], out_Callouts);
     384      parse_Names.do_block(lex0, marker[i], out_Callouts, lex1);
     385      parse_Numeric.do_block(lex0, marker[i], out_Callouts);
     386      prepare_content_buffer.do_block(basis_bits[i], lex0, marker[i], parity, escape_Callouts, out_Callouts, lex1);
     387      Build_ContentBuffer(out_Callouts, marker[i], content_buf, &content_buf_ptr, del_sum, i);
     388      lex0 = lex1;
     389#endif
     390#ifndef TWOBLOCK_LEX
    351391      parse_Escaped.do_block(lex[i], parity, escape_Callouts, out_Callouts, lex[i+1]);
    352392      parse_Comment.do_block(lex[i], escape_Callouts, marker[i], out_Callouts);
     
    357397      prepare_content_buffer.do_block(basis_bits[i], lex[i], marker[i], parity, escape_Callouts, out_Callouts, lex[i+1]);
    358398      Build_ContentBuffer(out_Callouts, marker[i], content_buf, &content_buf_ptr, del_sum, i);
     399#endif
    359400    }
    360401   
    361402    /*final block*/
    362403    EOF_mask = bitblock::srl(simd<1>::constant<1>(), convert(BLOCK_SIZE-chars_avail));
     404#ifdef TWOBLOCK_LEX
     405    parse_Escaped.do_final_block(lex0, parity, escape_Callouts, out_Callouts, EOF_mask);
     406    parse_Comment.do_final_block(lex0, escape_Callouts, marker[BLOCKS-1], out_Callouts, EOF_mask);
     407    parse_String.do_final_block(escape_Callouts, marker[BLOCKS-1], out_Callouts, EOF_mask);
     408    parse_HexStrings.do_final_block(lex0, marker[BLOCKS-1], out_Callouts, EOF_mask);
     409    parse_Names.do_final_block(lex0, marker[BLOCKS-1], out_Callouts, EOF_mask);
     410    parse_Numeric.do_final_block(lex0, marker[BLOCKS-1], out_Callouts, EOF_mask);
     411    prepare_content_buffer.do_final_block(basis_bits[BLOCKS-1], lex0, marker[BLOCKS-1], parity, escape_Callouts, out_Callouts, EOF_mask);
     412    out_Callouts.delmask |= ~EOF_mask;         
     413    Build_ContentBuffer(out_Callouts, marker[BLOCKS-1], content_buf, &content_buf_ptr, del_sum, BLOCKS-1);
     414#endif
     415#ifndef TWOBLOCK_LEX
    363416    parse_Escaped.do_final_block(lex[BLOCKS-1], parity, escape_Callouts, out_Callouts, EOF_mask);
    364417    parse_Comment.do_final_block(lex[BLOCKS-1], escape_Callouts, marker[BLOCKS-1], out_Callouts, EOF_mask);
     
    370423    out_Callouts.delmask |= ~EOF_mask;         
    371424    Build_ContentBuffer(out_Callouts, marker[BLOCKS-1], content_buf, &content_buf_ptr, del_sum, BLOCKS-1);
    372    
     425#endif
     426   
     427    PERF_SEC_END(parser_timer, chars_read);
     428    PERF_SEC_START(postprocess_timer);
    373429
    374430    Postprocessing(content_buf, (content_buf_ptr-content_buf)/BLOCK_SIZE+1, marker, del_sum);
     
    399455     
    400456 
    401     PERF_SEC_END(parser_timer, chars_read);
     457    PERF_SEC_END(postprocess_timer, chars_read);
    402458   
    403459    fwrite(content_buf, 1, content_buf_ptr-content_buf, outfile);
Note: See TracChangeset for help on using the changeset viewer.