Changeset 1786


Ignore:
Timestamp:
Dec 15, 2011, 12:38:09 AM (7 years ago)
Author:
vla24
Message:

Added some code to support performance tests using PAPI

Location:
proto/SymbolTable
Files:
13 edited

Legend:

Unmodified
Added
Removed
  • proto/SymbolTable/build_xmlwf.sh

    r1769 r1786  
    1 cd src && make all && ./xmlwf ../test/test_files/soap.xml && cd ..
     1cd src && make all && ./xmlwf ../../../trunk/QA/TD/po.xml && cd ..
    22
  • proto/SymbolTable/common_definitions.h

    r1777 r1786  
    88#define SIMD_type BitBlock
    99#define DEBUG 0
    10 #define PRINT_SYMBOL_DISTRIBUTION 0
     10#define PRINT_SYMBOL_DISTRIBUTION 0 
    1111#define PRINT_DICTIONARY_INFO 1
    1212#define SEGMENT_BLOCKS 12
  • proto/SymbolTable/src/Makefile

    r1777 r1786  
    5656
    5757buffer_profiling_papi: $(SRCFILE)
    58         $(CC) $(INCLUDES) -o $(OUTFILE) $(SRCFILE) $(AFLAGS) -DCODE_CLOCKER  -DPERF_SCRIPT -DUSE_XMLWF $(CODE_CLOCKER)
     58        $(CC) $(INCLUDES) -o $(OUTFILE) $(SRCFILE) $(AFLAGS) -DCODE_CLOCKER  -DPERF_SCRIPT -DUSE_XMLWF $(CODE_CLOCKER) #-DCACHE_PERF
    5959
    6060asm:  $(SRCFILE)
  • proto/SymbolTable/symbol_stat_gatherer.h

    r1769 r1786  
    2424    int min(vector<int>v);
    2525    int max(vector<int>v);
     26    float total(vector<int>v);
    2627    double average(vector<int>v);
    2728};
     
    6768//    symbol density (symbol separation distance)
    6869    vector<int> symbol_density = compute_symbol_density(density_starts, density_ends);
    69     printf ("Avg symbol density: %f\n", average(symbol_density));
     70//    printf ("Avg symbol density: %f\n", average(symbol_density));
     71    float total_lgth = total(symbol_lgth);
     72    float total_delimiters = total(symbol_density);
     73    printf ("Symbol density: %f\n", total_lgth/(total_lgth+total_delimiters));
    7074}
    7175
     
    104108}
    105109
     110float SymbolStatGatherer::total(vector<int> v)
     111{
     112    float result = 0;
     113    for (vector<int>::iterator it = v.begin(); it < v.end(); it++)
     114    {
     115        int number = *it;
     116        result += number;
     117    }
     118    return result;
     119}
     120
    106121int SymbolStatGatherer::max(vector<int> v)
    107122{
  • proto/SymbolTable/symtab_hash_template.cpp

    r1777 r1786  
    1010#elif CODE_CLOCKER
    1111        #define NUM_EVENTS 1
    12         int Events[NUM_EVENTS] = {PAPI_TOT_CYC};
    13         //int Events[NUM_EVENTS] = {PAPI_L2_DCM};
     12//      int Events[NUM_EVENTS] = {PAPI_TOT_CYC};
     13//      int Events[NUM_EVENTS] = {PAPI_L2_DCM};
     14        int Events[NUM_EVENTS] = {PAPI_L1_DCM};
     15//      int Events[NUM_EVENTS] = {PAPI_BR_MSP};
    1416        //int Events[NUM_EVENTS] = {PAPI_TOT_CYC, PAPI_BR_MSP};
    1517        int cal_size = 20;
     
    5355    PERF_SEC_DESTROY(parser_timer);
    5456
     57#if PRINT_SYMBOL_DISTRIBUTION
     58    symbol_table.Print_Symbol_Table_Distribution();
     59#endif
     60
    5561    fclose(infile);
    5662    fclose(outfile);
    57 
    58 #if PRINT_SYMBOL_DISTRIBUTION
    59     print_GIDS(gids);
    60 #endif
    6163    return(0);
    6264}
     
    243245      matcher.Advance_buffer();
    244246      tracker.Advance_buffer();
    245       PERF_SEC_END(parser_timer, chars_avail);
     247
     248#ifndef CACHE_PERF
     249    PERF_SEC_END(parser_timer, chars_avail);
     250#else
     251    PERF_SEC_END(parser_timer, 1);
     252#endif
    246253           
    247254      int bytes_left = chars_read - chars_avail;
     
    287294    matcher.Advance_buffer();
    288295    tracker.Advance_buffer();
    289 
     296#ifndef CACHE_PERF
    290297    PERF_SEC_END(parser_timer, chars_avail);
     298#else
     299    PERF_SEC_END(parser_timer, 1);
     300#endif
    291301    if (matcher.depth != 0) {
    292302      fprintf(stderr, "tag matching error (depth %i) at position %i\n", matcher.depth, buffer_base);
  • proto/SymbolTable/symtab_identity_template.cpp

    r1721 r1786  
    1010#elif CODE_CLOCKER
    1111        #define NUM_EVENTS 1
    12         int Events[NUM_EVENTS] = {PAPI_TOT_CYC};
    13         //int Events[NUM_EVENTS] = {PAPI_L2_DCM};
     12//      int Events[NUM_EVENTS] = {PAPI_TOT_CYC};
     13//      int Events[NUM_EVENTS] = {PAPI_L2_DCM};
     14        int Events[NUM_EVENTS] = {PAPI_L1_DCM};
     15//      int Events[NUM_EVENTS] = {PAPI_BR_MSP};
    1416        //int Events[NUM_EVENTS] = {PAPI_TOT_CYC, PAPI_BR_MSP};
    1517        int cal_size = 20;
     
    301303@stream_stmts
    302304
     305
    303306/* Full Buffers */
    304307    while (chars_avail == BUFFER_SIZE) {
     
    313316      matcher.Advance_buffer();
    314317      tracker.Advance_buffer();
    315       PERF_SEC_END(parser_timer, chars_avail);
     318#ifndef CACHE_PERF
     319    PERF_SEC_END(parser_timer, chars_avail);
     320#else
     321    PERF_SEC_END(parser_timer, 1);
     322#endif
    316323
    317324      int bytes_left = chars_read - chars_avail;
     
    353360    tracker.Advance_buffer();
    354361
     362#ifndef CACHE_PERF
    355363    PERF_SEC_END(parser_timer, chars_avail);
     364#else
     365    PERF_SEC_END(parser_timer, 1);
     366#endif
    356367    if (matcher.depth != 0) {
    357368      fprintf(stderr, "tag matching error (depth %i) at position %i\n", matcher.depth, buffer_base);
  • proto/SymbolTable/symtab_ls_template.cpp

    r1777 r1786  
    1010#elif CODE_CLOCKER
    1111        #define NUM_EVENTS 1
    12         int Events[NUM_EVENTS] = {PAPI_TOT_CYC};
    13         //int Events[NUM_EVENTS] = {PAPI_L2_DCM};
    14         //int Events[NUM_EVENTS] = {PAPI_TOT_CYC, PAPI_BR_MSP};
     12        //      int Events[NUM_EVENTS] = {PAPI_TOT_CYC};
     13//              int Events[NUM_EVENTS] = {PAPI_L2_DCM};
     14                int Events[NUM_EVENTS] = {PAPI_L1_DCM};
     15//              int Events[NUM_EVENTS] = {PAPI_BR_MSP};
    1516        int cal_size = 20;
    1617        CC * parser_timer = new CC(Events,NUM_EVENTS,cal_size);
     
    221222
    222223@stream_stmts
    223 
    224224/* Full Buffers */
    225225    while (chars_avail == BUFFER_SIZE) {
    226226      PERF_SEC_START(parser_timer);
     227
    227228      for (int blk = 0; blk < SEGMENT_BLOCKS; blk++) {
    228229          block_base = blk*BLOCK_SIZE;
     
    234235      matcher.Advance_buffer();
    235236      tracker.Advance_buffer();
    236       PERF_SEC_END(parser_timer, chars_avail);
     237#ifndef CACHE_PERF
     238    PERF_SEC_END(parser_timer, chars_avail);
     239#else
     240    PERF_SEC_END(parser_timer, 1);
     241#endif
    237242
    238243      int bytes_left = chars_read - chars_avail;
     
    281286    ls_symbol_table.bind();
    282287    ls_symbol_table.finalize();
    283 
     288#ifndef CACHE_PERF
    284289    PERF_SEC_END(parser_timer, chars_avail);
     290#else
     291    PERF_SEC_END(parser_timer, 1);
     292#endif
    285293    if (matcher.depth != 0) {
    286294      fprintf(stderr, "tag matching error (depth %i) at position %i\n", matcher.depth, buffer_base);
  • proto/SymbolTable/symtab_pbgs_div_template.cpp

    r1721 r1786  
    1010#elif CODE_CLOCKER
    1111        #define NUM_EVENTS 1
    12         int Events[NUM_EVENTS] = {PAPI_TOT_CYC};
    13         //int Events[NUM_EVENTS] = {PAPI_L2_DCM};
    14         //int Events[NUM_EVENTS] = {PAPI_TOT_CYC, PAPI_BR_MSP};
     12        //      int Events[NUM_EVENTS] = {PAPI_TOT_CYC};
     13//              int Events[NUM_EVENTS] = {PAPI_L2_DCM};
     14                int Events[NUM_EVENTS] = {PAPI_L1_DCM};
     15//              int Events[NUM_EVENTS] = {PAPI_BR_MSP};
    1516        int cal_size = 20;
    1617        CC * parser_timer = new CC(Events,NUM_EVENTS,cal_size);
     
    353354      matcher.Advance_buffer();
    354355      tracker.Advance_buffer();
    355       PERF_SEC_END(parser_timer, chars_avail);
     356#ifndef CACHE_PERF
     357    PERF_SEC_END(parser_timer, chars_avail);
     358#else
     359    PERF_SEC_END(parser_timer, 1);
     360#endif
    356361
    357362      int bytes_left = chars_read - chars_avail;
     
    393398    matcher.Advance_buffer();
    394399    tracker.Advance_buffer();
    395 
     400#ifndef CACHE_PERF
    396401    PERF_SEC_END(parser_timer, chars_avail);
     402#else
     403    PERF_SEC_END(parser_timer, 1);
     404#endif
    397405    if (matcher.depth != 0) {
    398406      fprintf(stderr, "tag matching error (depth %i) at position %i\n", matcher.depth, buffer_base);
  • proto/SymbolTable/symtab_pbgs_identity_template.cpp

    r1721 r1786  
    1111#elif CODE_CLOCKER
    1212        #define NUM_EVENTS 1
    13         int Events[NUM_EVENTS] = {PAPI_TOT_CYC};
    14         //int Events[NUM_EVENTS] = {PAPI_L2_DCM};
    15         //int Events[NUM_EVENTS] = {PAPI_TOT_CYC, PAPI_BR_MSP};
     13//      int Events[NUM_EVENTS] = {PAPI_TOT_CYC};
     14//      int Events[NUM_EVENTS] = {PAPI_L2_DCM};
     15        int Events[NUM_EVENTS] = {PAPI_L1_DCM};
     16//      int Events[NUM_EVENTS] = {PAPI_BR_MSP};
    1617        int cal_size = 20;
    1718        CC * parser_timer = new CC(Events,NUM_EVENTS,cal_size);
     
    7374    PERF_SEC_DESTROY(parser_timer);
    7475
    75     fclose(infile);
    76     fclose(outfile);
    77 
    7876#if PRINT_SYMBOL_DISTRIBUTION
    7977//    print_GIDS();
    8078    pbgs_symbol_table.Print_Symbol_Table_Distribution();
    8179#endif
     80
     81    fclose(infile);
     82    fclose(outfile);
    8283
    8384    return 0;
     
    751752      matcher.Advance_buffer();
    752753      tracker.Advance_buffer();
    753       PERF_SEC_END(parser_timer, chars_avail);
     754#ifndef CACHE_PERF
     755    PERF_SEC_END(parser_timer, chars_avail);
     756#else
     757    PERF_SEC_END(parser_timer, 1);
     758#endif
    754759
    755760      int bytes_left = chars_read - chars_avail;
     
    790795    matcher.Advance_buffer();
    791796    tracker.Advance_buffer();
    792 
     797#ifndef CACHE_PERF
    793798    PERF_SEC_END(parser_timer, chars_avail);
     799#else
     800    PERF_SEC_END(parser_timer, 1);
     801#endif
    794802    if (matcher.depth != 0) {
    795803      fprintf(stderr, "tag matching error (depth %i) at position %i\n", matcher.depth, buffer_base);
  • proto/SymbolTable/symtab_pbgs_log_template.cpp

    r1721 r1786  
    1212#elif CODE_CLOCKER
    1313        #define NUM_EVENTS 1
    14         int Events[NUM_EVENTS] = {PAPI_TOT_CYC};
    15         //int Events[NUM_EVENTS] = {PAPI_L2_DCM};
    16         //int Events[NUM_EVENTS] = {PAPI_TOT_CYC, PAPI_BR_MSP};
     14//      int Events[NUM_EVENTS] = {PAPI_TOT_CYC};
     15//      int Events[NUM_EVENTS] = {PAPI_L2_DCM};
     16//      int Events[NUM_EVENTS] = {PAPI_L1_DCM};
     17        int Events[NUM_EVENTS] = {PAPI_BR_MSP};
    1718        int cal_size = 20;
    1819        CC * parser_timer = new CC(Events,NUM_EVENTS,cal_size);
     
    411412      matcher.Advance_buffer();
    412413      tracker.Advance_buffer();
    413       PERF_SEC_END(parser_timer, chars_avail);
     414#ifndef CACHE_PERF
     415    PERF_SEC_END(parser_timer, chars_avail);
     416#else
     417    PERF_SEC_END(parser_timer, 1);
     418#endif
    414419
    415420      int bytes_left = chars_read - chars_avail;
     
    426431/* Final Partial Buffer */
    427432    PERF_SEC_START(parser_timer);
    428 
    429433    block_pos = 0;
    430434    int remaining = chars_avail;
     
    451455    matcher.Advance_buffer();
    452456    tracker.Advance_buffer();
    453 
     457#ifndef CACHE_PERF
    454458    PERF_SEC_END(parser_timer, chars_avail);
     459#else
     460    PERF_SEC_END(parser_timer, 1);
     461#endif
    455462    if (matcher.depth != 0) {
    456463      fprintf(stderr, "tag matching error (depth %i) at position %i\n", matcher.depth, buffer_base);
  • proto/SymbolTable/symtab_stl_template.cpp

    r1777 r1786  
    1010#elif CODE_CLOCKER
    1111        #define NUM_EVENTS 1
    12         int Events[NUM_EVENTS] = {PAPI_TOT_CYC};
    13         //int Events[NUM_EVENTS] = {PAPI_L2_DCM};
    14         //int Events[NUM_EVENTS] = {PAPI_TOT_CYC, PAPI_BR_MSP};
     12//      int Events[NUM_EVENTS] = {PAPI_TOT_CYC};
     13//      int Events[NUM_EVENTS] = {PAPI_L2_DCM};
     14        int Events[NUM_EVENTS] = {PAPI_L1_DCM};
     15//      int Events[NUM_EVENTS] = {PAPI_BR_MSP};
    1516        int cal_size = 20;
    1617        CC * parser_timer = new CC(Events,NUM_EVENTS,cal_size);
     
    222223
    223224@stream_stmts
    224 
    225225/* Full Buffers */
    226226
    227227    while (chars_avail == BUFFER_SIZE) {
    228228      PERF_SEC_START(parser_timer);
     229
    229230      for (int blk = 0; blk < SEGMENT_BLOCKS; blk++) {
    230231          block_base = blk*BLOCK_SIZE;
     
    236237      matcher.Advance_buffer();
    237238      tracker.Advance_buffer();
    238       PERF_SEC_END(parser_timer, chars_avail);
     239#ifndef CACHE_PERF
     240    PERF_SEC_END(parser_timer, chars_avail);
     241#else
     242    PERF_SEC_END(parser_timer, 1);
     243#endif
    239244           
    240245      int bytes_left = chars_read - chars_avail;
     
    280285    matcher.Advance_buffer();
    281286    tracker.Advance_buffer();
    282 
     287#ifndef CACHE_PERF
    283288    PERF_SEC_END(parser_timer, chars_avail);
     289#else
     290    PERF_SEC_END(parser_timer, 1);
     291#endif
     292
    284293    if (matcher.depth != 0) {
    285294      fprintf(stderr, "tag matching error (depth %i) at position %i\n", matcher.depth, buffer_base);
  • proto/SymbolTable/test/perftest.py

    r1499 r1786  
    88testfiles = []
    99output_dir = ""
    10 repeat = 1
     10repeat = 10
    1111
    1212def set_test_files(tests):
  • proto/SymbolTable/wcd_common_functions.h

    r1777 r1786  
    4646{
    4747#if PRINT_DICTIONARY_INFO
    48     fprintf (stderr, "%i known words, %i unknown words\n",totalKnownWordsInDictionary, totalUnknownWordsInDictionary);
     48    printf ("%i known words, %i unknown words\n",totalKnownWordsInDictionary, totalUnknownWordsInDictionary);
    4949#endif
    5050}
Note: See TracChangeset for help on using the changeset viewer.