X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/48296e83ce3ba1fa3658a3a74d10a536e33b3849..3e9453209f1da7deb92fe629428e49f3528217bd:/src/mc/mc_global.cpp diff --git a/src/mc/mc_global.cpp b/src/mc/mc_global.cpp index a3b4a170eb..bc444ffb5a 100644 --- a/src/mc/mc_global.cpp +++ b/src/mc/mc_global.cpp @@ -1,10 +1,10 @@ -/* Copyright (c) 2008-2022. The SimGrid Team. All rights reserved. */ +/* Copyright (c) 2008-2023. The SimGrid Team. All rights reserved. */ /* This program is free software; you can redistribute it and/or modify it * under the terms of the license (GNU LGPL) which comes with this package. */ -#include "mc/mc.h" #include "src/kernel/actor/ActorImpl.hpp" +#include "src/mc/mc.h" #if SIMGRID_HAVE_MC #include "src/mc/api/RemoteApp.hpp" @@ -22,11 +22,9 @@ #include #endif -#ifndef _WIN32 #include #include #include -#endif XBT_LOG_NEW_DEFAULT_SUBCATEGORY(mc_global, mc, "Logging specific to MC (global)"); @@ -73,11 +71,12 @@ void dumpStack(FILE* file, unw_cursor_t* cursor) double MC_process_clock_get(const simgrid::kernel::actor::ActorImpl* process) { - if (simgrid::mc::processes_time.empty()) - return 0; - if (process == nullptr) - return -1; - return simgrid::mc::processes_time.at(process->get_pid()); + if (process) { + auto pid = static_cast(process->get_pid()); + if (pid < simgrid::mc::processes_time.size()) + return simgrid::mc::processes_time[pid]; + } + return 0.0; } void MC_process_clock_add(const simgrid::kernel::actor::ActorImpl* process, double amount)