Changeset 1766 for proto


Ignore:
Timestamp:
Dec 11, 2011, 11:15:07 PM (8 years ago)
Author:
vla24
Message:

Fixed Makefile and added s2p include

Location:
proto/SymbolTable
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • proto/SymbolTable/Makefile

    r1764 r1766  
    108108symtab_stat:    $(PABLO_SYMTAB_PBS) # Paralel bitstream based group sorting
    109109        python $(PABLO_COMPILER) $(PABLO_SYMTAB_PBS) -t $(PARSER_COMMON_FUNCTIONS) -o $(PARSER_COMMON_FUNCTIONS_OUTFILE)
    110         python $(PABLO_COMPILER) $(PABLO_FLAGS) $(PABLO_SYMTAB_ID) -t $(SYMBOLTABLE_STAT_TEMPLATE) -o $(XMLWF_OUTFILE)
     110        python $(PABLO_COMPILER) $(PABLO_FLAGS) $(PABLO_SYMTAB_PBS) -t $(SYMBOLTABLE_STAT_TEMPLATE) -o $(XMLWF_OUTFILE)
    111111
    112112pablo_help:
  • proto/SymbolTable/common_definitions.h

    r1765 r1766  
    55
    66//typedef long ScanBlock;
    7 
    87
    98#define SIMD_type BitBlock
     
    2524using namespace std;
    2625
     26#include "../lib/s2p.hpp"
     27
    2728#include <carryQ.hpp>
    2829#include <bitstream_iterator.hpp>
  • proto/SymbolTable/symtab_symbol_stat_gather.cpp

    r1764 r1766  
    3333vector <int> gids;
    3434vector <int> symbol_lgth;
     35vector <int> density_starts;
     36vector <int> density_ends;
    3537PBGSIdentitySymbolTable pbgs_symbol_table;
    3638
     
    5658
    5759void symbol_statistic_gathering();
     60void store_symbol_density(int symbol_start, int symbol_end);
     61vector<int> compute_symbol_density(vector<int> density_starts, vector<int> density_ends);
    5862
    5963int main(int argc, char * argv[]) {
     
    97101    gids.push_back(gid);
    98102    symbol_lgth.push_back(L);
     103    store_symbol_density(start, end);
    99104#if DEBUG
    100105    char* symbol = new char[L+1];
     
    122127        gid = pbgs_symbol_table.Lookup_or_Insert_Name(source + start, hashvalue, lgth);
    123128        symbol_lgth.push_back(lgth);
     129        store_symbol_density(start, end);
    124130    }
    125131    gids.push_back(gid);
     
    148154int min(vector<int> v)
    149155{
    150     int result = INT_MIN;
    151     for (vector<int>::iterator it = v.begin; it < v.end; it++)
     156    int result = INT_MAX;
     157    for (vector<int>::iterator it = v.begin(); it < v.end(); it++)
    152158    {
    153159        int number = *it;
     
    163169int max(vector<int> v)
    164170{
    165     int result = INT_MAX;
    166     for (vector<int>::iterator it = v.begin; it < v.end; it++)
     171    int result = INT_MIN;
     172    for (vector<int>::iterator it = v.begin(); it < v.end(); it++)
    167173    {
    168174        int number = *it;
     
    176182}
    177183
    178 int average(vector<int> v)
     184double average(vector<int> v)
    179185{
    180186    double result = 0.0;
    181     for (vector<int>::iterator it = v.begin; it < v.end; it++)
     187    for (vector<int>::iterator it = v.begin(); it < v.end(); it++)
    182188    {
    183189        int number = *it;
     
    185191        result += number;
    186192    }
    187     return result/v.count();
     193    return result/v.size();
     194}
     195
     196vector<int> compute_symbol_density(vector<int> density_starts, vector<int> density_ends)
     197{
     198    vector<int> symbol_density;
     199    int size = density_starts.size();
     200
     201    for(int i = 0; i < size; i++)
     202    {
     203        int start, end, density;
     204        start = density_starts[i];
     205        end = density_ends[i];
     206        density = end - start;
     207
     208        symbol_density.push_back(density);
     209    }
     210    return symbol_density;
     211}
     212
     213void store_symbol_density(int symbol_start, int symbol_end)
     214{
     215    if (!density_starts.size())
     216    {
     217        density_starts.push_back(0);
     218    }
     219
     220    density_ends.push_back(symbol_start);
     221
     222    if (symbol_end > -1)
     223    {
     224        density_starts.push_back(symbol_end);
     225    }
    188226}
    189227
     
    194232
    195233//    symbol length
    196     printf ("min length: %i \n", min(symbol_lgth));
    197     printf ("max length: %i \n", max(symbol_lgth));
    198     printf ("average length: %i \n", average(symbol_lgth));
     234    printf ("Min length: %i \n", min(symbol_lgth));
     235    printf ("Max length: %i \n", max(symbol_lgth));
     236    printf ("Avg length: %f \n", average(symbol_lgth));
    199237
    200238//    frequency of unique symbols
    201     printf ("total unique symbols: %i\n", max(gids));
     239    printf ("Total unique symbols: %i\n", max(gids));
    202240
    203241//    symbol density (symbol separation distance)
     242    vector<int> symbol_density = compute_symbol_density(density_starts, density_ends);
     243    printf ("Avg symbol density: %f\n", average(symbol_density));
    204244}
    205245
     
    623663    buffer_base = buf_pos;
    624664
     665    store_symbol_density(buffer_base, -1);
     666
    625667    matcher.StreamScan(chars_avail);
    626668    matcher.Advance_buffer();
Note: See TracChangeset for help on using the changeset viewer.