Ignore:
Timestamp:
03/06/06 09:17:09 (18 years ago)
Author:
mattausch
Message:
 
File:
1 edited

Legend:

Unmodified
Added
Removed
  • GTP/trunk/Lib/Vis/shared/EvalStats/EvalStats.cpp

    r670 r675  
    3838 
    3939        int currentTag = NO_TAG; 
    40          
     40 
    4141        while (!(getline(file, buf)).eof()) 
    4242        { 
     
    106106                         //<< "#TotalRenderCostGain\n" << 100.0f - costRatio * 100.0f << endl 
    107107                         //<< "#AvgRenderCostGain\n" << 100.0f - avgCostRatio * 100.0f << endl << endl; 
    108                          << "#TotalRenderCostGain\n" << 100.0f * costRatio - 100.0f<< endl 
    109                          << "#AvgRenderCostGain\n" << 100.0f * avgCostRatio -100.0f << endl << endl; 
    110 } 
    111  
     108                         << "#TotalRenderCostRatio\n" << costRatio << endl 
     109                         << "#AvgRenderCostRatio\n" << avgCostRatio << endl << endl; 
     110} 
     111 
     112 
     113int ComputeNoViewCells(const StatsContainer &firstStats,  
     114                                           const StatsContainer &currentStats) 
     115{ 
     116        const int n = min((int)firstStats.size(), (int)currentStats.size()); 
     117 
     118        const float renderCost = (int)currentStats[n - 1].mRenderCost; 
     119 
     120        int i = 0; 
     121        while ((i ++ < (int)firstStats.size()) && (renderCost > (int)firstStats[i].mRenderCost)); 
     122         
     123        return i; 
     124} 
    112125 
    113126 
     
    129142                StatsContainer currentStats; 
    130143       
    131                 ifstream file(argv[i]); 
     144                ifstream file; 
     145                file.open(argv[i]); 
    132146 
    133147                // extract the render cost 
    134148                cout << "extracting render cost of file " << argv[i] << endl; 
    135                 cout.flush(); 
    136  
    137                 extractRenderStats(file, currentStats); 
    138                 renderStats.push_back(currentStats); 
    139  
    140                 // create output file name 
    141                 string fn = argv[i]; 
    142                  
    143                 string::size_type pos = fn.find(".log", 0); 
    144                 fn.erase(pos, 4); 
    145                 //sscanf(argv[i], "%s.log", fn); 
    146                 string outFilename = string(fn) + string("-ratio.log"); 
    147  
    148                 outFilenames.push_back(outFilename); 
     149         
     150                if (extractRenderStats(file, currentStats)) 
     151                { 
     152                        renderStats.push_back(currentStats); 
     153 
     154                        // create output file name 
     155                        string fn = argv[i]; 
     156                 
     157                        string::size_type pos = fn.find(".log", 0); 
     158                        fn.erase(pos, 4); 
     159                        //sscanf(argv[i], "%s.log", fn); 
     160                        string outFilename = string(fn) + string("-ratio.log"); 
     161 
     162                        outFilenames.push_back(outFilename); 
     163                } 
     164                else 
     165                { 
     166                        cout << "could not open file!" << endl; 
     167                } 
    149168        } 
    150169 
     
    159178 
    160179        // don't compare with itself 
    161         ++ it; 
    162         ++ sit; 
     180        //++ it; 
     181        //++ sit; 
    163182 
    164183        for (it; it != it_end; ++ it) 
    165184        { 
    166                 cout << "writing output to file " << *sit << endl; 
    167                 ofstream statsOut((*sit).c_str()); 
    168                 ++ sit; 
     185                cout << "now writing output to file " << *sit << endl; 
     186                ofstream statsOut; 
     187                statsOut.open((*sit).c_str()); 
    169188 
    170189                // compute size of output vector 
     
    176195                } 
    177196                 
     197                int vc = ComputeNoViewCells(firstStats, *it); 
     198                cout << "need " << vc << " view cells to reach rendercost of method " << i << " with " << n << " view cells" << endl; 
     199 
    178200                statsOut.close(); 
     201                 
     202                ++ sit; 
    179203        } 
    180204 
Note: See TracChangeset for help on using the changeset viewer.