void benchmark_summary::write_data_files(const string_list& ops) const
{
  typedef std::vector<std::string> string_list;
  for (string_list::const_iterator op = ops.begin(); op != ops.end(); ++op)
  {
    if (!results_for_op_exist(op))
      continue;

    const std::string filename(std::string(to_string(op)) + ".dat");
    std::ofstream file(filename.c_str());
    if (!file.is_open())
      throw std::runtime_error("couldn't open data file");

    const unsigned int num_ops = results.count(op);
    const_result_iterator first = results.lower_bound(op);
    const_result_iterator last = results.upper_bound(op);

    for (unsigned int i = 0; i < num_input_samples_; ++i)
    {
      while (first != last)
      {
        file << first->ops.at(i);
        
        if (++first != last)
          file << "\t";
      }
      file << "\n";
    }
  }
}
Beispiel #2
0
 result_list::iterator where(const result_ptr & inserted)
 {
     return std::lower_bound<result_list::iterator,
            result_ptr,
            kneeboard_draw_checker>
            (result.begin(), result.end(), inserted, *this);
 }
bool benchmark_summary::results_for_op_exist(const std::string& opname) const
{
  return results.find(benchmark_result("", opname)) != results.end();
}