您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ xbt_die函数代码示例

51自学网 2021-06-03 10:15:27
  C++
这篇教程C++ xbt_die函数代码示例写得很实用,希望能帮到您。

本文整理汇总了C++中xbt_die函数的典型用法代码示例。如果您正苦于以下问题:C++ xbt_die函数的具体用法?C++ xbt_die怎么用?C++ xbt_die使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。

在下文中一共展示了xbt_die函数的27个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: smpi_get_executable_global_size

void smpi_get_executable_global_size(){    char buffer[PATH_MAX];    char* full_name = realpath(xbt_binary_name, buffer);    if (full_name == nullptr)        xbt_die("Could not resolve binary file name");    std::vector<simgrid::xbt::VmMap> map = simgrid::xbt::get_memory_map(getpid());    for (auto i = map.begin(); i != map.end() ; ++i) {        // TODO, In practice, this implementation would not detect a completely        // anonymous data segment. This does not happen in practice, however.        // File backed RW entry:        if (i->pathname == full_name && (i->prot & PROT_RWX) == PROT_RW) {            smpi_start_data_exe = (char*) i->start_addr;            smpi_size_data_exe = i->end_addr - i->start_addr;            ++i;            /* Here we are making the assumption that a suitable empty region               following the rw- area is the end of the data segment. It would               be better to check with the size of the data segment. */            if (i != map.end() && i->pathname.empty() && (i->prot & PROT_RWX) == PROT_RW                    && i->start_addr == (std::uint64_t) smpi_start_data_exe + smpi_size_data_exe) {                smpi_size_data_exe = i->end_addr - (std::uint64_t) smpi_start_data_exe;            }            return;        }    }    xbt_die("Did not find my data segment.");}
开发者ID:fabienchaix,项目名称:simgrid,代码行数:29,


示例2: terrorist

/** Terrorist. This process sends a bunch of exceptions to the victim. */static int terrorist(int argc, char *argv[]){  msg_process_t victim_process = NULL;  XBT_INFO("Let's create a victim.");  victim_process = MSG_process_create("victim", victim, NULL, MSG_host_self());  XBT_INFO("Going to sleep for 1 second");  if (MSG_process_sleep(1) != MSG_OK)     xbt_die("What's going on??? I failed to sleep!");  XBT_INFO("Send a first exception (host failure)");  SIMIX_process_throw(victim_process, host_error, 0, "First Trick: Let's pretend that the host failed");  XBT_INFO("Sweet, let's prepare a second trick!");  XBT_INFO("Going to sleep for 2 seconds");  if (MSG_process_sleep(2) != MSG_OK)     xbt_die("What's going on??? I failed to sleep!");  XBT_INFO("Send a second exception (host failure)");  SIMIX_process_throw(victim_process, host_error, 0, "Second Trick: Let's pretend again that the host failed");  XBT_INFO("Sweet, let's prepare a third trick!");  XBT_INFO("Going to sleep for 3 seconds");  if (MSG_process_sleep(3) != MSG_OK)     xbt_die("What's going on??? I failed to sleep!");  XBT_INFO("Send a third exception (cancellation)");  SIMIX_process_throw(victim_process, cancel_error, 0, "Third Trick: Let's pretend this time that someone canceled something");  XBT_INFO("OK, goodbye now.");  return 0;}
开发者ID:adegomme,项目名称:simgrid,代码行数:33,


示例3: shm_map

static void* shm_map(int fd, size_t size, shared_data_t* data) {  void* mem;  char loc[PTR_STRLEN];  shared_metadata_t* meta;  if(size > shm_size(fd)) {    if(ftruncate(fd, (off_t)size) < 0) {      xbt_die("Could not truncate fd %d to %zu: %s", fd, size, strerror(errno));    }  }  mem = mmap(NULL, size, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);  if(mem == MAP_FAILED) {    xbt_die("Could not map fd %d: %s", fd, strerror(errno));  }  if(!allocs_metadata) {    allocs_metadata = xbt_dict_new();  }  snprintf(loc, PTR_STRLEN, "%p", mem);  meta = xbt_new(shared_metadata_t, 1);  meta->size = size;  meta->data = data;  xbt_dict_set(allocs_metadata, loc, meta, &free);  XBT_DEBUG("MMAP %zu to %p", size, mem);  return mem;}
开发者ID:Shurakai,项目名称:SimGrid,代码行数:26,


示例4: mc_get_snapshot_region

/** @brief Find the snapshoted region from a pointer * *  @param addr     Pointer *  @param snapshot Snapshot *  @param Snapshot region in the snapshot this pointer belongs to *         (or NULL if it does not belong to any snapshot region) * */mc_mem_region_t mc_get_snapshot_region(  const void* addr, const simgrid::mc::Snapshot* snapshot, int process_index){  size_t n = snapshot->snapshot_regions.size();  for (size_t i = 0; i != n; ++i) {    mc_mem_region_t region = snapshot->snapshot_regions[i].get();    if (!(region && region->contain(simgrid::mc::remote(addr))))      continue;    if (region->storage_type() == simgrid::mc::StorageType::Privatized) {#ifdef HAVE_SMPI      // Use the current process index of the snapshot:      if (process_index == simgrid::mc::ProcessIndexDisabled) {        process_index = snapshot->privatization_index;      }      if (process_index < 0) {        xbt_die("Missing process index");      }      if (process_index >= (int) region->privatized_data().size()) {        xbt_die("Invalid process index");      }      simgrid::mc::RegionSnapshot& priv_region = region->privatized_data()[process_index];      xbt_assert(priv_region.contain(simgrid::mc::remote(addr)));      return &priv_region;#else      xbt_die("Privatized region in a non SMPI build (this should not happen)");#endif    }    return region;  }  return NULL;}
开发者ID:apargupta,项目名称:simgrid,代码行数:41,


示例5: smx_ctx_cojava_create_coroutine

static void smx_ctx_cojava_create_coroutine(smx_ctx_cojava_t context) {  JNIEnv *env = get_current_thread_env();  jclass coclass = (*env)->FindClass(env, "java/dyn/Coroutine");  xbt_assert((coclass != NULL), "Can't find coroutine class ! :(");  jobject jcoroutine = (*env)->NewObject(env, coclass, coroutine_init, context->jprocess);  if (jcoroutine == NULL) {     FILE *conf= fopen("/proc/sys/vm/max_map_count","r");     if (conf) {	int limit=-1;        if(fscanf(conf,"%d",&limit) != 1)           xbt_die("Error while creating a new coroutine. Parse error.");	fclose(conf);	if (limit!=-1 && SIMIX_process_count() > (limit - 100) /2)	   xbt_die("Error while creating a new coroutine. "		   "This seem due to the the vm.max_map_count system limit that is only equal to %d while we already have %d coroutines. "		   "Please check the install documentation to see how to increase this limit", limit, SIMIX_process_count());	if (limit == -1)	  xbt_die("Error while creating a new coroutine. "		  "This seems to be a non-linux system, disabling the automatic verification that the system limit on the amount of memory maps is high enough.");	xbt_die("Error while creating a new coroutine. ");     }       }     jcoroutine = (*env)->NewGlobalRef(env, jcoroutine);  context->jcoroutine = jcoroutine;}
开发者ID:Julio-Anjos,项目名称:simgrid,代码行数:27,


示例6: victim

/** Victim. This process gets a lot of remote exceptions  */static int victim(int argc, char *argv[]) {  xbt_ex_t e;  msg_error_t res = MSG_OK;    XBT_INFO("Let's work.");  TRY {	    res = MSG_task_execute(MSG_task_create("Task", 1e14, 0, NULL));    if (res != MSG_OK) {      XBT_INFO("The MSG_task_execute caught the exception for me and returned %d)",res);    } else {      xbt_die("I was expecting an exception during my execution!");    }  } CATCH(e) {    XBT_INFO("The received exception resumed my execution. Good. Here is it:  ----------------------->8----");    xbt_ex_display(&e);    XBT_INFO("(end of the first exception) ----8<------------------------");    xbt_ex_free(e);  }  XBT_INFO("Let's get suspended.");  int gotit = 0;  TRY {    MSG_process_suspend(MSG_process_self());  } CATCH(e) {    XBT_INFO("The received exception resumed my suspension. Good. Here is it:  ----------------------->8----");    xbt_ex_display(&e);    XBT_INFO("(end of the second exception) ----8<------------------------");    gotit = 1;    xbt_ex_free(e);  }  if(!gotit) {    xbt_die("I was expecting an exception during my suspension!");  }    XBT_INFO("Let's sleep for 10 seconds.");  TRY {    res = MSG_process_sleep(10);    if (res != MSG_OK) {      XBT_INFO("The MSG_process_sleep caught the exception for me and returned %d)",res);    } else {      xbt_die("I was expecting to get an exception during my nap.");    }  } CATCH(e) {    XBT_INFO("Got the second exception:   ----------------------->8----");    xbt_ex_display(&e);    XBT_INFO("(end of the third exception) ----8<------------------------");    xbt_ex_free(e);  }  XBT_INFO("Let's try a last time to do something on something");  MSG_process_sleep(10);  XBT_INFO("That's enough now. I quit.");    return 0;}
开发者ID:apargupta,项目名称:simgrid,代码行数:59,


示例7: main

int main(int argc, char** argv){  // We need to keep the original parameters in order to pass them to the  // model-checked process:  int argc_copy = argc;  char** argv_copy = argvdup(argc, argv);  xbt_log_init(&argc_copy, argv_copy);  sg_config_init(&argc_copy, argv_copy);  if (argc < 2)    xbt_die("Missing arguments./n");  bool server_mode = true;  char* env = std::getenv("SIMGRID_MC_MODE");  if (env) {    if (std::strcmp(env, "server") == 0)      server_mode = true;    else if (std::strcmp(env, "standalone") == 0)      server_mode = false;    else      xbt_die("Unrecognised value for SIMGRID_MC_MODE (server/standalone)");  }  if (!server_mode) {    setenv(MC_ENV_VARIABLE, "1", 1);    execvp(argv[1], argv+1);    std::perror("simgrid-mc");    return 127;  }  // Create a AF_LOCAL socketpair:  int res;  int sockets[2];  res = socketpair(AF_LOCAL, SOCK_DGRAM | SOCK_CLOEXEC, 0, sockets);  if (res == -1) {    perror("simgrid-mc");    return MC_SERVER_ERROR;  }  XBT_DEBUG("Created socketpair");  pid_t pid = fork();  if (pid < 0) {    perror("simgrid-mc");    return MC_SERVER_ERROR;  } else if (pid == 0) {    close(sockets[1]);    return do_child(sockets[0], argv);  } else {    close(sockets[0]);    return do_parent(sockets[1], pid);  }  return 0;}
开发者ID:tempbottle,项目名称:simgrid,代码行数:57,


示例8: MC_dwarf_fill_member_location

/** /brief Initialize the location of a member of a type * (DW_AT_data_member_location of a DW_TAG_member). * *  /param  type   a type (struct, class) *  /param  member the member of the type *  /param  child  DIE of the member (DW_TAG_member) */static void MC_dwarf_fill_member_location(  simgrid::mc::Type* type, simgrid::mc::Member* member, Dwarf_Die * child){  if (dwarf_hasattr(child, DW_AT_data_bit_offset))    xbt_die("Can't groke DW_AT_data_bit_offset.");  if (not dwarf_hasattr_integrate(child, DW_AT_data_member_location)) {    if (type->type == DW_TAG_union_type)      return;    xbt_die        ("Missing DW_AT_data_member_location field in DW_TAG_member %s of type <%"         PRIx64 ">%s", member->name.c_str(),         (uint64_t) type->id, type->name.c_str());  }  Dwarf_Attribute attr;  dwarf_attr_integrate(child, DW_AT_data_member_location, &attr);  int form = dwarf_whatform(&attr);  simgrid::dwarf::FormClass form_class = simgrid::dwarf::classify_form(form);  switch (form_class) {  case simgrid::dwarf::FormClass::ExprLoc:  case simgrid::dwarf::FormClass::Block:    // Location expression:    {      Dwarf_Op *expr;      size_t len;      if (dwarf_getlocation(&attr, &expr, &len))        xbt_die            ("Could not read location expression DW_AT_data_member_location in DW_TAG_member %s of type <%"             PRIx64 ">%s", MC_dwarf_attr_integrate_string(child, DW_AT_name),             (uint64_t) type->id, type->name.c_str());      member->location_expression = simgrid::dwarf::DwarfExpression(expr, expr+len);      break;    }  case simgrid::dwarf::FormClass::Constant:    // Offset from the base address of the object:    {      Dwarf_Word offset;      if (not dwarf_formudata(&attr, &offset))        member->offset(offset);      else        xbt_die("Cannot get %s location <%" PRIx64 ">%s",                MC_dwarf_attr_integrate_string(child, DW_AT_name),                (uint64_t) type->id, type->name.c_str());      break;    }  default:    // includes FormClass::LocListPtr (reference to a location list: TODO) and FormClass::Reference (it's supposed to be    // possible in DWARF2 but I couldn't find its semantic in the spec)    xbt_die("Can't handle form class (%d) / form 0x%x as DW_AT_member_location", (int)form_class, (unsigned)form);  }}
开发者ID:mpoquet,项目名称:simgrid,代码行数:61,


示例9: read_element

void read_element(AddressSpace const& as,  void* local, remote_ptr<s_xbt_dynar_t> addr, size_t i, size_t len){  s_xbt_dynar_t d;  as.read_bytes(&d, sizeof(d), addr);  if (i >= d.used)    xbt_die("Out of bound index %zi/%lu", i, d.used);  if (len != d.elmsize)    xbt_die("Bad size in simgrid::mc::read_element");  as.read_bytes(local, len, remote(xbt_dynar_get_ptr(&d, i)));}
开发者ID:apargupta,项目名称:simgrid,代码行数:11,


示例10: while

static char *remplace(char *value, const char **src_list, int src_size,    const char **dst_list, int dst_size){  char result[BUFFER_SIZE];  int i_res = 0;  int i = 0;  while (value[i]) {    if (value[i] == '$') {      i++;                      /* skip the '$' */      if (value[i] < '0' || value[i] > '9')        xbt_die("bad string parameter, no number indication, at offset: "            "%d (/"%s/")", i, value);      /* solve the number */      int number = value[i++] - '0';      while (value[i] >= '0' && value[i] <= '9')        number = 10 * number + (value[i++] - '0');      /* solve the indication */      const char **param_list;      _XBT_GNUC_UNUSED int param_size;      if (value[i] == 's' && value[i + 1] == 'r' && value[i + 2] == 'c') {        param_list = src_list;        param_size = src_size;      } else if (value[i] == 'd' && value[i + 1] == 's'          && value[i + 2] == 't') {        param_list = dst_list;        param_size = dst_size;      } else {        xbt_die("bad string parameter, support only /"src/" and /"dst/", "            "at offset: %d (/"%s/")", i, value);      }      i += 3;      xbt_assert(number < param_size,          "bad string parameter, not enough length param_size, "          "at offset: %d (/"%s/") %d %d", i, value, param_size, number);      const char *param = param_list[number];      int j = 0;      while (param[j] && i_res < BUFFER_SIZE)        result[i_res++] = param[j++];    } else {      result[i_res++] = value[i++]; /* next char */    }    if (i_res >= BUFFER_SIZE)      xbt_die("solving string /"%s/", small buffer size (%d)",          value, BUFFER_SIZE);  }  result[i_res++] = '/0';  char *res = xbt_malloc(i_res);  return memcpy(res, result, i_res);}
开发者ID:Shurakai,项目名称:SimGrid,代码行数:54,


示例11: tmgr_trace_new_from_string

tmgr_trace_t tmgr_trace_new_from_string(const char *id, const char *input,                                        double periodicity){  tmgr_trace_t trace = NULL;  int linecount = 0;  s_tmgr_event_t event;  tmgr_event_t last_event = NULL;  xbt_dynar_t list;  unsigned int cpt;  char *val;  if (trace_list) {    trace = xbt_dict_get_or_null(trace_list, id);    if (trace) {      XBT_WARN("Ignoring redefinition of trace %s", id);      return trace;    }  }  xbt_assert(periodicity >= 0,              "Invalid periodicity %lg (must be positive)", periodicity);  trace = xbt_new0(s_tmgr_trace_t, 1);  trace->type = e_trace_list;  trace->s_list.event_list = xbt_dynar_new(sizeof(s_tmgr_event_t), NULL);  list = xbt_str_split(input, "/n/r");  xbt_dynar_foreach(list, cpt, val) {    linecount++;    xbt_str_trim(val, " /t/n/r/x0B");    if (val[0] == '#' || val[0] == '/0' || val[0] == '%')      continue;    if (sscanf(val, "PERIODICITY " "%lg" "/n", &periodicity) == 1)      continue;    if (sscanf(val, "%lg" " " "%lg" "/n", &event.delta, &event.value) != 2)      xbt_die("%s:%d: Syntax error in trace/n%s", id, linecount, input);    if (last_event) {      if (last_event->delta > event.delta) {        xbt_die("%s:%d: Invalid trace: Events must be sorted, "                "but time %lg > time %lg./n%s",                id, linecount, last_event->delta, event.delta, input);      }      last_event->delta = event.delta - last_event->delta;    }    xbt_dynar_push(trace->s_list.event_list, &event);    last_event =        xbt_dynar_get_ptr(trace->s_list.event_list,                          xbt_dynar_length(trace->s_list.event_list) - 1);  }
开发者ID:Shurakai,项目名称:SimGrid,代码行数:53,


示例12: worker

static int worker(int argc, char *argv[]){  msg_task_t task = NULL;  char mailbox[80];  long id= xbt_str_parse_int(argv[1], "Invalid argument %s");  snprintf(mailbox, 79,"worker-%ld", id);  while (1) {    double time1 = MSG_get_clock();    int retcode = MSG_task_receive( &(task), mailbox);    double time2 = MSG_get_clock();    if (retcode == MSG_OK) {      XBT_INFO("Received /"%s/"", MSG_task_get_name(task));      if (MSG_task_get_data(task) == FINALIZE) {        MSG_task_destroy(task);        task = NULL;        break;      }      if (time1 < *((double *) task->data))        time1 = *((double *) task->data);      XBT_INFO("Communication time : /"%f/"", time2 - time1);      XBT_INFO("Processing /"%s/"", MSG_task_get_name(task));      retcode = MSG_task_execute(task);      if (retcode == MSG_OK) {        XBT_INFO("/"%s/" done", MSG_task_get_name(task));        MSG_task_destroy(task);        task = NULL;      } else if (retcode == MSG_HOST_FAILURE) {        XBT_INFO("Gloups. The cpu on which I'm running just turned off!. See you!");        MSG_task_destroy(task);        task = NULL;        return 0;      } else {        XBT_INFO("Hey ?! What's up ? ");        xbt_die("Unexpected behavior");      }    } else if (retcode == MSG_HOST_FAILURE) {      XBT_INFO("Gloups. The cpu on which I'm running just turned off!. See you!");      return 0;    } else if (retcode == MSG_TRANSFER_FAILURE) {      XBT_INFO("Mmh. Something went wrong. Nevermind. Let's keep going!");    } else {      xbt_die("Unexpected behavior");    }  }  XBT_INFO("I'm done. See you!");  return 0;}
开发者ID:dindon-sournois,项目名称:simgrid,代码行数:50,


示例13: slave

int slave(int argc, char *argv[]){  while (1) {    msg_task_t task = NULL;    int a;    double time1, time2;    time1 = MSG_get_clock();    a = MSG_task_receive( &(task), MSG_host_get_name(MSG_host_self()) );    time2 = MSG_get_clock();    if (a == MSG_OK) {      XBT_INFO("Received /"%s/"", MSG_task_get_name(task));      if (MSG_task_get_data(task) == FINALIZE) {        MSG_task_destroy(task);        break;      }      if (time1 < *((double *) task->data))        time1 = *((double *) task->data);      XBT_INFO("Communication time : /"%f/"", time2 - time1);      XBT_INFO("Processing /"%s/"", MSG_task_get_name(task));      a = MSG_task_execute(task);      if (a == MSG_OK) {        XBT_INFO("/"%s/" done", MSG_task_get_name(task));        free(task->data);        MSG_task_destroy(task);      } else if (a == MSG_HOST_FAILURE) {        XBT_INFO            ("Gloups. The cpu on which I'm running just turned off!. See you!");        return 0;      } else {        XBT_INFO("Hey ?! What's up ? ");        xbt_die("Unexpected behavior");      }    } else if (a == MSG_HOST_FAILURE) {      XBT_INFO          ("Gloups. The cpu on which I'm running just turned off!. See you!");      return 0;    } else if (a == MSG_TRANSFER_FAILURE) {      XBT_INFO("Mmh. Something went wrong. Nevermind. Let's keep going!");    } else if (a == MSG_TIMEOUT) {      XBT_INFO("Mmh. Got a timeout. Nevermind. Let's keep going!");    } else {      XBT_INFO("Hey ?! What's up ? ");      xbt_die("Unexpected behavior");    }  }  XBT_INFO("I'm done. See you!");  return 0;}                               /* end_of_slave */
开发者ID:FlorianPO,项目名称:simgrid,代码行数:49,


示例14: _mc_cfg_cb_reduce

void _mc_cfg_cb_reduce(const char *name){  if (_sg_cfg_init_status && !_sg_do_model_check)    xbt_die        ("You are specifying a reduction strategy after the initialization (through MSG_config?), but model-checking was not activated at config time (through bu the program was not runned under the model-checker (with simgrid-mc)). This won't work, sorry.");  char *val = xbt_cfg_get_string(name);  if (!strcasecmp(val, "none"))    simgrid::mc::reduction_mode = simgrid::mc::ReductionMode::none;  else if (!strcasecmp(val, "dpor"))    simgrid::mc::reduction_mode = simgrid::mc::ReductionMode::dpor;  else    xbt_die("configuration option %s can only take 'none' or 'dpor' as a value",            name);}
开发者ID:R7R8,项目名称:simgrid,代码行数:15,


示例15: receiver

/** Receiver function  */int receiver(int argc, char *argv[]){  double time, time1, sender_time;  msg_task_t task_la = NULL;  msg_task_t task_bw = NULL;  int a;  double communication_time = 0;  XBT_INFO("receiver");  time = MSG_get_clock();  /* Get Latency */  a = MSG_task_receive(&task_la,MSG_host_get_name(MSG_host_self()));  if (a == MSG_OK) {    time1 = MSG_get_clock();    sender_time = *((double *) (task_la->data));    time = sender_time;    communication_time = time1 - time;    XBT_INFO("Task received : %s", task_la->name);    xbt_free(task_la->data);    MSG_task_destroy(task_la);    XBT_INFO("Communic. time %le", communication_time);    XBT_INFO("--- la %f ----", communication_time);  } else {    xbt_die("Unexpected behavior");  }  /* Get Bandwidth */  a = MSG_task_receive(&task_bw,MSG_host_get_name(MSG_host_self()));  if (a == MSG_OK) {    time1 = MSG_get_clock();    sender_time = *((double *) (task_bw->data));    time = sender_time;    communication_time = time1 - time;    XBT_INFO("Task received : %s", task_bw->name);    xbt_free(task_bw->data);    MSG_task_destroy(task_bw);    XBT_INFO("Communic. time %le", communication_time);    XBT_INFO("--- bw %f ----", task_comm_size_bw / communication_time);  } else {    xbt_die("Unexpected behavior");  }  return 0;}                               /* end_of_receiver */
开发者ID:Shurakai,项目名称:SimGrid,代码行数:49,


示例16: xbt_dynar_foreach

 xbt_dynar_foreach(dax, cursor, task) {   int kind = SD_task_get_kind(task);   SD_workstation_t *wsl = SD_task_get_workstation_list(task);   switch (kind) {   case SD_TASK_COMP_SEQ:     fprintf(out, "[%f] %s compute %f # %s/n",             SD_task_get_start_time(task),             SD_workstation_get_name(wsl[0]), SD_task_get_amount(task),             SD_task_get_name(task));     break;   case SD_TASK_COMM_E2E:     fprintf(out, "[%f] %s send %s %f # %s/n",             SD_task_get_start_time(task),             SD_workstation_get_name(wsl[0]),             SD_workstation_get_name(wsl[1]), SD_task_get_amount(task),             SD_task_get_name(task));     fprintf(out, "[%f] %s recv %s %f # %s/n",             SD_task_get_finish_time(task),             SD_workstation_get_name(wsl[1]),             SD_workstation_get_name(wsl[0]), SD_task_get_amount(task),             SD_task_get_name(task));     break;   default:     xbt_die("Task %s is of unknown kind %d", SD_task_get_name(task),             SD_task_get_kind(task));   }   SD_task_destroy(task); }
开发者ID:Julio-Anjos,项目名称:simgrid,代码行数:28,


示例17: MC_region_read_fragmented

/** @brief Read memory from a snapshot region broken across fragmented pages * *  @param addr    Process (non-snapshot) address of the data *  @param region  Snapshot memory region where the data is located *  @param target  Buffer to store the value *  @param size    Size of the data to read in bytes *  @return Pointer where the data is located (target buffer of original location) */const void* MC_region_read_fragmented(mc_mem_region_t region, void* target, const void* addr, size_t size){  // Last byte of the memory area:  void* end = (char*) addr + size - 1;  // Page of the last byte of the memory area:  size_t page_end = mc_page_number(NULL, end);  void* dest = target;  if (dest==NULL) {    xbt_die("Missing destination buffer for fragmented memory access");  }  // Read each page:  while (mc_page_number(NULL, addr) != page_end) {    void* snapshot_addr = mc_translate_address_region_chunked((uintptr_t) addr, region);    void* next_page = mc_page_from_number(NULL, mc_page_number(NULL, addr) + 1);    size_t readable = (char*) next_page - (char*) addr;    memcpy(dest, snapshot_addr, readable);    addr = (char*) addr + readable;    dest = (char*) dest + readable;    size -= readable;  }  // Read the end:  void* snapshot_addr = mc_translate_address_region_chunked((uintptr_t)addr, region);  memcpy(dest, snapshot_addr, size);  return target;}
开发者ID:apargupta,项目名称:simgrid,代码行数:39,


示例18: sg_platf_new_host

/** @brief Add an "host" to the current AS */void sg_platf_new_host(sg_platf_host_cbarg_t host){  xbt_assert(! sg_host_by_name(host->id),      "Refusing to create a second host named '%s'.", host->id);  simgrid::surf::AsImpl* current_routing = routing_get_current();  if (current_routing->hierarchy_ == simgrid::surf::AsImpl::RoutingMode::unset)    current_routing->hierarchy_ = simgrid::surf::AsImpl::RoutingMode::base;  simgrid::surf::NetCard *netcard =      new simgrid::surf::NetCardImpl(host->id, SURF_NETWORK_ELEMENT_HOST, current_routing);  netcard->setId(current_routing->addComponent(netcard));  sg_host_t h = simgrid::s4u::Host::by_name_or_create(host->id);  h->pimpl_netcard = netcard;  simgrid::surf::netcardCreatedCallbacks(netcard);  if(mount_list){    xbt_lib_set(storage_lib, host->id, ROUTING_STORAGE_HOST_LEVEL, (void *) mount_list);    mount_list = NULL;  }  if (host->coord && strcmp(host->coord, "")) {    unsigned int cursor;    char*str;    if (!COORD_HOST_LEVEL)      xbt_die ("To use host coordinates, please add --cfg=network/coordinates:yes to your command line");    /* Pre-parse the host coordinates -- FIXME factorize with routers by overloading the routing->parse_PU function*/    xbt_dynar_t ctn_str = xbt_str_split_str(host->coord, " ");    xbt_dynar_t ctn = xbt_dynar_new(sizeof(double),NULL);    xbt_dynar_foreach(ctn_str,cursor, str) {      double val = xbt_str_parse_double(str, "Invalid coordinate: %s");      xbt_dynar_push(ctn,&val);    }
开发者ID:adegomme,项目名称:simgrid,代码行数:36,


示例19: parse_S_host_link

/** * /brief Add a "host_link" to the network element list */static void parse_S_host_link(sg_platf_host_link_cbarg_t host){  sg_routing_edge_t info = NULL;  info = xbt_lib_get_or_null(host_lib, host->id, ROUTING_HOST_LEVEL);  xbt_assert(info, "Host '%s' not found!",host->id);  xbt_assert(current_routing->model_desc == &routing_models[SURF_MODEL_CLUSTER] ||      current_routing->model_desc == &routing_models[SURF_MODEL_VIVALDI],      "You have to be in model Cluster to use tag host_link!");  s_surf_parsing_link_up_down_t link_up_down;  link_up_down.link_up = xbt_lib_get_or_null(link_lib, host->link_up, SURF_LINK_LEVEL);  link_up_down.link_down = xbt_lib_get_or_null(link_lib, host->link_down, SURF_LINK_LEVEL);  link_up_down.limiter_link = NULL;  link_up_down.loopback_link = NULL;  xbt_assert(link_up_down.link_up, "Link '%s' not found!",host->link_up);  xbt_assert(link_up_down.link_down, "Link '%s' not found!",host->link_down);  if(!current_routing->link_up_down_list)    current_routing->link_up_down_list = xbt_dynar_new(sizeof(s_surf_parsing_link_up_down_t),NULL);  // If dynar is is greater than edge id and if the host_link is already defined  if(xbt_dynar_length(current_routing->link_up_down_list) > info->id &&      xbt_dynar_get_as(current_routing->link_up_down_list,info->id,void*))    xbt_die("Host_link for '%s' is already defined!",host->id);  XBT_DEBUG("Push Host_link for host '%s' to position %d",info->name,info->id);  xbt_dynar_set_as(current_routing->link_up_down_list,info->id,s_surf_parsing_link_up_down_t,link_up_down);}
开发者ID:dhascome,项目名称:simgrid,代码行数:32,


示例20: MSG_get_host_msgload

/** /ingroup m_host_management * /brief Return the number of MSG tasks currently running on a * #msg_host_t. The external load is not taken in account. */int MSG_get_host_msgload(msg_host_t h){  xbt_assert((h != NULL), "Invalid parameters");  xbt_die( "Not implemented yet");  return (0);}
开发者ID:dhascome,项目名称:simgrid,代码行数:11,


示例21: MC_ignore_heap

void MC_ignore_heap(void *address, size_t size){  if (mc_mode != MC_MODE_CLIENT)    return;  xbt_mheap_t heap = mmalloc_get_current_heap();  s_mc_heap_ignore_region_t region;  memset(&region, 0, sizeof(region));  region.address = address;  region.size = size;  region.block =   ((char *) address -    (char *) heap->heapbase) / BLOCKSIZE + 1;  if (heap->heapinfo[region.block].type == 0) {    region.fragment = -1;    heap->heapinfo[region.block].busy_block.ignore++;  } else {    region.fragment =        ((uintptr_t) (ADDR2UINT(address) % (BLOCKSIZE))) >>        heap->heapinfo[region.block].type;    heap->heapinfo[region.block].busy_frag.ignore[region.fragment]++;  }  s_mc_ignore_heap_message_t message;  message.type = MC_MESSAGE_IGNORE_HEAP;  message.region = region;  if (MC_protocol_send(mc_client->fd, &message, sizeof(message)))    xbt_die("Could not send ignored region to MCer");}
开发者ID:congfairy,项目名称:simgrid,代码行数:30,


示例22: slave

/** Receiver function  */int slave(int argc, char *argv[]){  XBT_INFO("I'm a slave");  while (1) {    msg_task_t task = NULL;    int a;    a = MSG_task_receive(&(task), MSG_host_get_name(MSG_host_self()));    if (a == MSG_OK) {      XBT_INFO("Received /"%s/" ", MSG_task_get_name(task));      if (MSG_task_get_data(task) == FINALIZE) {        MSG_task_destroy(task);        break;      }      XBT_INFO("Processing /"%s/" ", MSG_task_get_name(task));      MSG_task_execute(task);      XBT_INFO("/"%s/" done ", MSG_task_get_name(task));      MSG_task_destroy(task);    } else {      XBT_INFO("Hey ?! What's up ? ");      xbt_die("Unexpected behavior");            }  }  XBT_INFO("I'm done. See you!");  return 0;}                               /* end_of_slave */
开发者ID:tempbottle,项目名称:simgrid,代码行数:26,


示例23: surf_parse_error

/* * Helping functions */void surf_parse_error(const char *fmt, ...) {  va_list va;  va_start(va,fmt);  char *msg = bvprintf(fmt,va);  va_end(va);  xbt_die("Parse error at %s:%d: %s", surf_parsed_filename, surf_parse_lineno, msg);}
开发者ID:ricardojrdez,项目名称:simgrid,代码行数:10,


示例24: MC_dwarf_default_lower_bound

/** @brief Find the default lower bound for a given language * *  The default lower bound of an array (when DW_TAG_lower_bound *  is missing) depends on the language of the compilation unit. * *  @param lang Language of the compilation unit (values defined in the DWARF spec) *  @return     Default lower bound of an array in this compilation unit * */static uint64_t MC_dwarf_default_lower_bound(int lang){  switch (lang) {  case DW_LANG_C:  case DW_LANG_C89:  case DW_LANG_C99:  case DW_LANG_C_plus_plus:  case DW_LANG_D:  case DW_LANG_Java:  case DW_LANG_ObjC:  case DW_LANG_ObjC_plus_plus:  case DW_LANG_Python:  case DW_LANG_UPC:    return 0;  case DW_LANG_Ada83:  case DW_LANG_Ada95:  case DW_LANG_Fortran77:  case DW_LANG_Fortran90:  case DW_LANG_Fortran95:  case DW_LANG_Modula2:  case DW_LANG_Pascal83:  case DW_LANG_PL1:  case DW_LANG_Cobol74:  case DW_LANG_Cobol85:    return 1;  default:    xbt_die("No default DW_TAG_lower_bound for language %i and none given",            lang);    return 0;  }}
开发者ID:mpoquet,项目名称:simgrid,代码行数:39,


示例25: parse_S_host

/** * /brief Add a "host" to the network element list */static void parse_S_host(sg_platf_host_cbarg_t host){  if (current_routing->p_hierarchy == SURF_ROUTING_NULL)    current_routing->p_hierarchy = SURF_ROUTING_BASE;  xbt_assert(!sg_host_by_name(host->id),		     "Reading a host, processing unit /"%s/" already exists", host->id);  RoutingEdge *info = new RoutingEdgeImpl(xbt_strdup(host->id),		                                    -1,		                                    SURF_NETWORK_ELEMENT_HOST,		                                    current_routing);  info->setId(current_routing->parsePU(info));  sg_host_edge_set(sg_host_by_name_or_create(host->id), info);  XBT_DEBUG("Having set name '%s' id '%d'", host->id, info->getId());  if(mount_list){    xbt_lib_set(storage_lib, host->id, ROUTING_STORAGE_HOST_LEVEL, (void *) mount_list);    mount_list = NULL;  }  if (host->coord && strcmp(host->coord, "")) {    unsigned int cursor;    char*str;    if (!COORD_HOST_LEVEL)      xbt_die ("To use host coordinates, please add --cfg=network/coordinates:yes to your command line");    /* Pre-parse the host coordinates -- FIXME factorize with routers by overloading the routing->parse_PU function*/    xbt_dynar_t ctn_str = xbt_str_split_str(host->coord, " ");    xbt_dynar_t ctn = xbt_dynar_new(sizeof(double),NULL);    xbt_dynar_foreach(ctn_str,cursor, str) {      double val = atof(str);      xbt_dynar_push(ctn,&val);    }
开发者ID:apargupta,项目名称:simgrid,代码行数:36,


示例26: SIMIX_io_finish

void SIMIX_io_finish(smx_activity_t synchro){  for (smx_simcall_t const& simcall : synchro->simcalls_) {    switch (synchro->state_) {      case SIMIX_DONE:        /* do nothing, synchro done */        break;      case SIMIX_FAILED:        SMX_EXCEPTION(simcall->issuer, io_error, 0, "IO failed");        break;      case SIMIX_CANCELED:        SMX_EXCEPTION(simcall->issuer, cancel_error, 0, "Canceled");        break;      default:        xbt_die("Internal error in SIMIX_io_finish: unexpected synchro state %d", static_cast<int>(synchro->state_));    }    if (simcall->issuer->host->is_off()) {      simcall->issuer->context->iwannadie = 1;    }    simcall->issuer->waiting_synchro = nullptr;    SIMIX_simcall_answer(simcall);  }  /* We no longer need it */  SIMIX_io_destroy(synchro);}
开发者ID:mpoquet,项目名称:simgrid,代码行数:28,


示例27: SIMIX_process_self

Host *Host::current(){	smx_process_t smx_proc = SIMIX_process_self();	if (smx_proc == NULL)		xbt_die("Cannot call Host::current() from the maestro context");	return Host::byName(SIMIX_host_get_name(SIMIX_process_get_host(smx_proc)));}
开发者ID:apargupta,项目名称:simgrid,代码行数:7,



注:本文中的xbt_die函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


C++ xbt_dynar_length函数代码示例
C++ xbt_cfg_get_string函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。