Changeset 36 for trunk/lib/Stats.cc
- Timestamp:
- Jan 13, 2006, 2:05:53 AM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/lib/Stats.cc
r35 r36 2 2 3 3 #include "Stats.h" 4 #include "Gnuplot.h" 4 5 #include "utility.h" 5 6 … … 22 23 std::vector<double> Stats::accumulated(void) const 23 24 { 24 std::vector<u_int> sum;25 25 if (map_.empty()) 26 26 return std::vector<double>(); 27 27 28 // sum of all users 29 std::accumulate(map_.begin(), map_.end(), sum, 30 PairValuePlus<std::string,u_int>()); 28 // sum of all users 29 std::vector<u_int> sum; 30 sum=std::accumulate(map_.begin(), map_.end(), sum, 31 PairValuePlus<std::string,u_int>()); 31 32 32 33 // calculate accumulated sum … … 60 61 vec[rev]++; 61 62 map_[user]=vec; 62 63 63 } 64 64 … … 70 70 exit(-1); 71 71 } 72 // Jari, temporary empty files are created that needs to be removed.73 72 std::string cmd=std::string("set term png; set output '")+name+".png'"; 74 73 gnuplot_pipe_.command(cmd); 75 std::vector<double> x=accumulated(); 76 gnuplot_pipe_.plot_y(x); 77 for (MapConstIter_ i= map_.begin(); i != map_.end(); i++) { 78 x=accumulated(i->first); 79 gnuplot_pipe_.plot_y(x); 80 } 74 gnuplot_pipe_.plot(accumulated()); 75 for (MapConstIter_ i= map_.begin(); i != map_.end(); i++) 76 gnuplot_pipe_.replot(accumulated(i->first)); 77 78 // Jari, must rewrite output once since the replots above are not 79 // added to the plot. Rather, the plot only contains the result 80 // from the first 'plot' call. 81 gnuplot_pipe_.command(cmd); 82 gnuplot_pipe_.command("replot"); 81 83 return std::string(name)+".png"; 82 84 }
Note: See TracChangeset
for help on using the changeset viewer.