1 /* Copyright (c) 2009 Da SimGrid Team. All rights reserved. */
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. */
6 /* This example replays a trace as produced by examples/simdag/dax, or other means
7 * This is mainly interesting when run on real platforms, to validate the results
8 * given in the simulator when running SimDag.
14 #include "xbt/dynar.h"
17 #include "amok/peermanagement.h"
20 int master(int argc,char *argv[]);
21 int worker(int argc,char *argv[]);
23 XBT_LOG_NEW_DEFAULT_CATEGORY(replay, "Messages specific to this example");
25 static void declare_msg() {
26 gras_datadesc_type_t command_assignment_type;
31 int master(int argc,char *argv[]) {
32 gras_init(&argc,argv);
35 xbt_assert0(argc==3,"usage: replay_master tracefile port");
36 gras_socket_server(atoi(argv[2])); /* open my master socket, even if I don't use it */
37 xbt_dynar_t peers = amok_pm_group_new("replay"); /* group of slaves */
38 xbt_dynar_t cmds = xbt_workload_parse_file(argv[1]);
39 xbt_workload_sort_who_date(cmds);
41 xbt_workload_elm_t cmd;
43 xbt_dynar_foreach(cmds,cursor,cmd) {
44 char *str = xbt_workload_elm_to_string(cmd);
49 /* friends, we're ready. Come and play */
50 INFO0("Wait for peers for 5 sec");
51 gras_msg_handleall(5);
52 INFO1("Got %ld pals", xbt_dynar_length(peers));
56 xbt_dynar_free(&cmds);
61 int worker(int argc,char *argv[]) {
62 gras_init(&argc,argv);