示例#1
0
 SExpr makeBufManage(int bi) {
     std::vector<SExpr> vals = {
         SExpr("servio_nextr", (int) log_main.buffers[bi].servio_nextr),
         SExpr("fileio_nextr", (int) log_main.buffers[bi].fileio_nextr),
         SExpr("next_write", (int) log_main.buffers[bi].next_write),
         
         SExpr("nl_assoc", (int) nlog_assoc[bi])
     };
     return SExpr(vals);
 }
示例#2
0
文件: sexpr.cpp 项目: g2graman/CVC4
SExpr SExpr::parseListOfListOfAtoms(const std::vector< std::vector<std::string> >& atoms_lists) {
  std::vector<SExpr> parsedListsOfAtoms;
  typedef std::vector< std::vector<std::string> >::const_iterator const_iterator;
  for(const_iterator i = atoms_lists.begin(), i_end = atoms_lists.end(); i != i_end; ++i){
    parsedListsOfAtoms.push_back(parseListOfAtoms(*i));
  }
  return SExpr(parsedListsOfAtoms);
}
示例#3
0
SExpr StatisticsBase::getStatistic(std::string name) const {
  SExpr value;
  IntStat s(name, 0);
  StatSet::iterator i = d_stats.find(&s);
  if(i != d_stats.end()) {
    return (*i)->getValue();
  } else {
    return SExpr();
  }
}
示例#4
0
文件: sexpr.cpp 项目: g2graman/CVC4
SExpr SExpr::parseAtom(const std::string& atom) {
  if(atom == "true"){
    return SExpr(true);
  } else if(atom == "false"){
    return SExpr(false);
  } else {
    try {
      Integer z(atom);
      return SExpr(z);
    }catch(std::invalid_argument&){
      // Fall through to the next case
    }
    try {
      Rational q(atom);
      return SExpr(q);
    }catch(std::invalid_argument&){
      // Fall through to the next case
    }
    return SExpr(atom);
  }
}
示例#5
0
 SExpr makeBufState(io_state_t * start, io_state_t * end) {
     std::vector<SExpr> vals = {
         SExpr("l_given", (long) (end->l_given - start->l_given)),
         SExpr("b_given", (long) (end->b_given - start->b_given)),
         
         SExpr("l_freed", (long) (end->l_freed - start->l_freed)),
         SExpr("l_lost", (long) (end->l_lost - start->l_lost)),
         SExpr("b_lost", (long) (end->b_lost - start->b_lost)),
         
         SExpr("l_writ", (long) (end->l_writ - start->l_writ)),
         SExpr("b_writ", (long) (end->b_writ - start->b_writ)),
     };
     
     return SExpr(vals);
 }
示例#6
0
 Log * makeSTATSlog() {
     //Log state.
     std::vector<SExpr> fields;
     fields.push_back(SExpr(CONTENT_TYPE_S, "STATS"));
     
     std::vector<SExpr> fvector = {
         SExpr("flags"),
         SExpr("serv_connected", control::serv_connected,
               control::flags[control::serv_connected]),
         SExpr("control_connected", control::control_connected,
               control::flags[control::control_connected]),
         SExpr("fileio", control::fileio,
               control::flags[control::fileio]),
         SExpr("SENSORS", control::SENSORS,
               control::flags[control::SENSORS]),
         SExpr("GUARDIAN", control::GUARDIAN,
               control::flags[control::GUARDIAN]),
         SExpr("COMM", control::COMM,
               control::flags[control::COMM]),
         SExpr("LOCATION", control::LOCATION,
               control::flags[control::LOCATION]),
         SExpr("ODOMETRY", control::ODOMETRY,
               control::flags[control::ODOMETRY]),
         SExpr("OBSERVATIONS", control::OBSERVATIONS,
               control::flags[control::OBSERVATIONS]),
         SExpr("LOCALIZATION", control::LOCALIZATION,
               control::flags[control::LOCALIZATION]),
         SExpr("BALLTRACK", control::BALLTRACK,
               control::flags[control::BALLTRACK]),
         
         SExpr("VISION", control::VISION,
               control::flags[control::VISION]),
         
         SExpr("tripoint", control::tripoint,
               control::flags[control::tripoint]),
         
         SExpr("thumbnail", control::thumbnail,
               control::flags[control::thumbnail])
     };
     fields.push_back(SExpr(fvector));
     
     
     fields.push_back(SExpr("num_buffers", NUM_LOG_BUFFERS));
     fields.push_back(SExpr("num_cores", (int) NUM_CORES));
     
     SExpr ratios;
     ratios.append(SExpr("ratio"));
     for (int i = 0; i < NUM_LOG_BUFFERS; ++i) {
         ratios.append(SExpr(LOG_RATIO[i]));
     }
     fields.push_back(ratios);
     
     SExpr sizes;
     sizes.append(SExpr("size"));
     for (int i = 0; i < NUM_LOG_BUFFERS; ++i) {
         sizes.append(SExpr(LOG_BUFFER_SIZES[i]));
     }
     fields.push_back(sizes);
     
     time_t NOW = time(NULL);
     
     fields.push_back(SExpr("con_uptime", control::flags[control::serv_connected] ? difftime(NOW, cio_upstart) : 0));
     fields.push_back(SExpr("cnc_uptime", control::flags[control::control_connected] ? difftime(NOW, cnc_upstart) : 0));
     fields.push_back(SExpr("fio_uptime", control::flags[control::fileio] ? difftime(NOW, fio_upstart) : 0));
     
     fields.push_back(SExpr("log_uptime", difftime(NOW, main_upstart)));
     
     SExpr manages;
     manages.append(SExpr("bufmanage"));
     for (int i = 0; i < NUM_LOG_BUFFERS; ++i) {
         manages.append(makeBufManage(i));
     }
     fields.push_back(manages);
     
     /*
      This system of grabbing io state is subject to multi-threading accuracy drift.
      It is therefore only for estimates.
      */
     io_state_t zerostate;
     bzero(&zerostate, sizeof(io_state_t));
     
     SExpr state_total;
     state_total.append(SExpr("total-state"));
     for (int i = 0; i < NUM_LOG_BUFFERS; ++i) {
         state_total.append(makeBufState(&zerostate, total + i));
     }
     fields.push_back(state_total);
     
     if (control::flags[control::fileio]) {
         SExpr state_file;
         state_file.append(SExpr("file-state"));
         for (int i = 0; i < NUM_LOG_BUFFERS; ++i) {
             state_file.append(makeBufState(fio_start + i, total + i));
         }
         fields.push_back(state_file);
     }
     
     if (control::flags[control::serv_connected]) {
         SExpr state_serv;
         state_serv.append(SExpr("serv-state"));
         for (int i = 0; i < NUM_LOG_BUFFERS; ++i) {
             state_serv.append(makeBufState(cio_start + i, total + i));
         }
         fields.push_back(state_serv);
     }
     
     std::vector<SExpr> contents = {SExpr(fields)};
     
     return new Log(LOG_FIRST_ATOM_S, "makeSTATSlog()", time(NULL), LOG_VERSION, contents, "");
 };