1 /* synchro_crashtest -- tries to crash the logging mechanism by doing parallel logs*/
3 /* Copyright (c) 2007-2020. The SimGrid Team. All rights reserved. */
5 /* This program is free software; you can redistribute it and/or modify it
6 * under the terms of the license (GNU LGPL) which comes with this package. */
8 #include "simgrid/s4u/Engine.hpp"
11 XBT_LOG_NEW_DEFAULT_CATEGORY(synchro_crashtest, "Logs of this example");
13 const int test_amount = 99; /* Up to 99 to not break the logs (and thus the testing mechanism) */
14 const int crasher_amount = 99; /* Up to 99 to not break the logs (and thus the testing mechanism) */
16 int more_info = 0; /* SET IT TO TRUE TO GET MORE INFO */
18 /* Code ran by each thread */
19 static void crasher_thread(int id)
21 for (int i = 0; i < test_amount; i++) {
23 XBT_INFO("%03d (%02d|%02d|%02d|%02d|%02d|%02d|%02d|%02d|%02d)", test_amount - i, id, id, id, id, id, id, id, id,
26 XBT_INFO("XXX (XX|XX|XX|XX|XX|XX|XX|XX|XX)");
30 int main(int argc, char* argv[])
32 simgrid::s4u::Engine e(&argc, argv);
34 std::thread crashers[crasher_amount];
37 for (int i = 0; i < crasher_amount; i++) {
38 crashers[i] = std::thread(crasher_thread, i);
42 for (int i = 0; i < crasher_amount; i++)