Changeset 65


Ignore:
Timestamp:
Mar 16, 2008, 5:15:18 AM (11 years ago)
Author:
cameron
Message:

Add CODE_CLOCKING instrumentation.

Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Makefile

    r64 r65  
    11CC= g++ $(CFLAGS)
    2 CFLAGS= -O3 -DBUFFER_PROFILING
     2CFLAGS= -O3
    33OS = $(shell uname)
    44ICONV_FLAGS=
     
    2525        g++-4.2 -O3 -lgomp -fopenmp -o markup_stats_omp markup_stats.cxx -march=nocona -m64
    2626
    27 markup_stats.s: markup_stats.cxx src/xmlbuffer.h src/multiliteral.h src/engine.h\
    28                 src/transpose.h src/bitlex.h src/xmlbuffer.c src/bitlex.c src/engine.c\
    29                 lib/sse_simd.h\
    30                 src/bytelex.h src/charsets/ASCII_EBCDIC.h
    31         $(CC) -o markup_stats.s markup_stats.cxx -march=pentium4 -S -fverbose-asm
    32 
    3327markup_stats_g4:         markup_stats.cxx src/xmlbuffer.h src/multiliteral.h src/engine.h\
    3428                src/transpose.h src/bitlex.h src/xmlbuffer.c src/bitlex.c src/engine.c\
  • trunk/markup_stats.cxx

    r64 r65  
    1717#include <iostream>
    1818using namespace std;
     19
     20#ifdef CODE_CLOCKING
     21#include "codeclocker/clocker/code_clocker_session.h"
     22#include "codeclocker/clocker/code_clocker_session.c"
     23Code_Clocker * total_clocker;
     24#endif
     25
     26
    1927
    2028//#include "src/ilax.h"
     
    220228template <CodeUnit_Base C>
    221229inline void ParsingEngine<C>::FinalizeBuffer_action() {
     230#ifdef CODE_CLOCKING
     231end_Interval (total_clocker, buffer_rel_pos);
     232start_Interval (total_clocker);
     233#endif
    222234}
    223235
     
    225237template <CodeUnit_Base C>
    226238inline void ParsingEngine<C>::DocumentStart_action() {
     239#ifdef CODE_CLOCKING
     240start_Interval (total_clocker);
     241#endif
    227242}
    228243
    229244template <CodeUnit_Base C>
    230245inline void ParsingEngine<C>::DocumentEnd_action() {
     246#ifdef CODE_CLOCKING
     247end_Interval (total_clocker, buffer_rel_pos);
     248#endif
    231249}
    232250
     
    247265        }
    248266        char * filename = argv[1];
     267#ifdef CODE_CLOCKING
     268
     269init_Code_Clocker_Session(8, // num code clockers
     270                         64096, // max individual timestamp measurements
     271                         4ul, // num session parameters
     272                         65536, // num timestamp calibration measurements,
     273                            65534,// num constant time loop executions
     274                         8 // num constant time loop iterations
     275                         );
     276set_Session_Cmd_Line_Args(argv[0]);
     277total_clocker = register_Code_Clocker("Markup_stats_total", "Total markup_stats time\n");
     278#endif
    249279
    250280        for (int run = 0; run < REPEAT_RUNS; run++) {
     
    288318        print_stats("error item", error_item_count, error_item_length);
    289319        printf("Maximum nesting depth = %i\n", max_nesting_depth);
     320#ifdef CODE_CLOCKING
     321        write_XML_File();
     322#endif
    290323       
    291324        return(0);
  • trunk/src/bitlex.c

    r63 r65  
    1111
    1212
     13#ifdef CODE_CLOCKING
     14#include "../codeclocker/clocker/code_clocker_session.h"
     15Code_Clocker * transpose_clocker;
     16Code_Clocker * WS_Control_clocker;
     17Code_Clocker * MarkupStreams_clocker;
     18Code_Clocker * char_validation_clocker;
     19#endif
     20
     21
    1322Lexer_Interface::Lexer_Interface(XML_Buffer_Interface *b, LexicalStreamSet *l) {
    1423        xml_buf = b;
     
    3847template <>
    3948Lexer_Interface * Lexer<ASCII>::LexerFactory(XML_Buffer_Interface *b, LexicalStreamSet *l) {
     49#ifdef CODE_CLOCKING
     50transpose_clocker = register_Code_Clocker("s2p", "transposition to parallel bit streams\n");
     51WS_Control_clocker = register_Code_Clocker("WS", "WhiteSpace/Control\n");
     52MarkupStreams_clocker = register_Code_Clocker("bitlex", "Markup streams\n");
     53char_validation_clocker = register_Code_Clocker("charcheck", "Character validation\n");
     54
     55#endif
    4056        if (!(b->has_encoding_decl)) {
    4157                // Must be UTF-8 or UTF-16; UTF-16 requires a ByteOrderMark.
     
    884900
    885901void Lexer_Interface::TransposeToBitStreams() {
     902#ifdef CODE_CLOCKING
     903start_Interval(transpose_clocker);
     904#endif
    886905        BytePack * pseudoASCII_src = &(xml_buf->x8data[lexer_base_pos/PACKSIZE]);
    887906        for (int blk = 0; blk < buffer_blocks; blk++) {
    888907                s2p_bytepack(&pseudoASCII_src[blk*8], x8basis[blk].bit);
    889908        }
     909#ifdef CODE_CLOCKING
     910end_Interval(transpose_clocker, buffer_blocks * BLOCKSIZE);
     911#endif
    890912}
    891913
     
    921943        printf("Transposition to bit streams complete.\n");
    922944#endif
     945#ifdef CODE_CLOCKING
     946start_Interval(WS_Control_clocker);
     947#endif
    923948        if (xml_buf->version == XML_1_1) Do_XML_11_WS_Control();
    924949        else Do_XML_10_WS_Control();
     950#ifdef CODE_CLOCKING
     951end_Interval(WS_Control_clocker, buffer_blocks * BLOCKSIZE);
     952#endif
     953#ifdef CODE_CLOCKING
     954start_Interval(MarkupStreams_clocker);
     955#endif
    925956        Do_MarkupStreams();
     957#ifdef CODE_CLOCKING
     958end_Interval(MarkupStreams_clocker, buffer_blocks * BLOCKSIZE);
     959#endif
     960
    926961#ifdef DEBUG
    927962        printf("Markup streams complete.\n");
    928963#endif
     964#ifdef CODE_CLOCKING
     965//start_Interval(char_validation_clocker);
     966#endif
    929967        Do_CharsetValidation();
     968#ifdef CODE_CLOCKING
     969//end_Interval(char_validation_clocker, buffer_blocks * BLOCKSIZE);
     970#endif
    930971#ifdef DEBUG
    931972        printf("Validation complete.\n");
  • trunk/src/xmlbuffer.h

    r54 r65  
    159159public:
    160160        U32_Buffer(BytePack * src, int lgth, int BOM);
    161     ~U32_Buffer();
     161        ~U32_Buffer();
    162162        virtual void DoByteplex() = 0;
    163163        void PreparePseudoASCII_Stream();
Note: See TracChangeset for help on using the changeset viewer.