-/* Copyright (c) 2007-2014. The SimGrid Team.
+/* Copyright (c) 2007-2015. The SimGrid Team.
* All rights reserved. */
/* This program is free software; you can redistribute it and/or modify it
#include "mc/mc_protocol.h"
#include "mc/mc_client.h"
#endif
+
+#ifdef HAVE_MC
+#include <stdlib.h>
+#include "mc/mc_protocol.h"
+#endif
+
#include "mc/mc_record.h"
#ifdef HAVE_SMPI
*/
void SIMIX_global_init(int *argc, char **argv)
{
+#ifdef HAVE_MC
+ _sg_do_model_check = getenv(MC_ENV_VARIABLE) != NULL;
+#endif
+
s_smx_process_t proc;
if (!simix_global) {
exit(0);
}
+int smx_cleaned = 0;
/**
* \ingroup SIMIX_API
* \brief Clean the SIMIX simulation
*/
void SIMIX_clean(void)
{
- static int cleaned = 0;
#ifdef TIME_BENCH_PER_SR
smx_ctx_raw_new_sr();
#endif
- if (cleaned) return; // to avoid double cleaning by java and C
- cleaned = 1;
- /* Kill everyone (except maestro) */
+ if (smx_cleaned) return; // to avoid double cleaning by java and C
+ smx_cleaned = 1;
+ XBT_DEBUG("SIMIX_clean called. Simulation's over.");
+ if (!xbt_dynar_is_empty(simix_global->process_to_run) && SIMIX_get_clock() == 0.0) {
+ XBT_CRITICAL(" ");
+ XBT_CRITICAL("The time is still 0, and you still have processes ready to run.");
+ XBT_CRITICAL("It seems that you forgot to run the simulation that you setup.");
+ xbt_die("Bailing out to avoid that stop-before-start madness. Please fix your code.");
+ }
+ /* Kill all processes (but maestro) */
SIMIX_process_killall(simix_global->maestro_process, 1);
/* Exit the SIMIX network module */