Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Remove the stateful model-checking from the archive. It's not working anymore
[simgrid.git] / src / mc / mc_global.cpp
1 /* Copyright (c) 2008-2023. The SimGrid Team. All rights reserved.          */
2
3 /* This program is free software; you can redistribute it and/or modify it
4  * under the terms of the license (GNU LGPL) which comes with this package. */
5
6 #include "src/kernel/actor/ActorImpl.hpp"
7 #include "src/mc/mc.h"
8
9 #include <sys/time.h>
10 #include <sys/wait.h>
11 #include <unistd.h>
12
13 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(mc_global, mc, "Logging specific to MC (global)");
14
15 namespace simgrid::mc {
16
17 std::vector<double> processes_time;
18
19 }
20
21 double MC_process_clock_get(const simgrid::kernel::actor::ActorImpl* process)
22 {
23   if (process) {
24     auto pid = static_cast<size_t>(process->get_pid());
25     if (pid < simgrid::mc::processes_time.size())
26       return simgrid::mc::processes_time[pid];
27   }
28   return 0.0;
29 }
30
31 void MC_process_clock_add(const simgrid::kernel::actor::ActorImpl* process, double amount)
32 {
33   simgrid::mc::processes_time.at(process->get_pid()) += amount;
34 }