1 /* synchro_crashtest -- tries to crash the logging mechanism by doing parallel logs*/
3 /* Copyright (c) 2007-2018. 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/msg.h"
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(void* arg)
23 for (int i = 0; i < test_amount; i++) {
25 XBT_INFO("%03d (%02d|%02d|%02d|%02d|%02d|%02d|%02d|%02d|%02d)", test_amount - i, id, id, id, id, id, id, id, id,
28 XBT_INFO("XXX (XX|XX|XX|XX|XX|XX|XX|XX|XX)");
33 int main(int argc, char* argv[])
35 MSG_init(&argc, argv);
37 int id[crasher_amount];
38 std::thread crashers[crasher_amount];
41 for (int i = 0; i < crasher_amount; i++) {
43 crashers[i] = std::thread(crasher_thread, &id[i]);
47 for (int i = 0; i < crasher_amount; i++)