Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
[mc] Documentation cleanup
[simgrid.git] / src / mc / mc_record.h
index 08c9af5..ec24b70 100644 (file)
@@ -1,10 +1,11 @@
-/* Copyright (c) 2014. The SimGrid Team.
+/* Copyright (c) 2014-2015. 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. */
 
-/** \file
+/** \file mc_record.h
+ *
  *  This file contains the MC replay/record functionnality.
  *  A MC path may be recorded by using ``-cfg=model-check/record:1`'`.
  *  The path is written in the log output and an be replayed with MC disabled
 #ifndef SIMGRID_MC_RECORD_H
 #define SIMGRID_MC_RECORD_H
 
-#include <stdbool.h>
+#include <string>
+#include <vector>
 
-#include "simgrid_config.h"
+#include <xbt/base.h>
 
-SG_BEGIN_DECL()
+#include "src/mc/Transition.hpp"
 
-/** Whether the MC record mode is enabled
- *
- *  The behaviour is not changed. The only real difference is that
- *  the path is writtent in the log when an interesting path is found.
- */
-#define MC_record_is_active() _sg_do_model_check_record
+namespace simgrid {
+namespace mc {
 
-// **** Data conversion
-
-/** An element in the recorded path
- *
- *  At each decision point, we need to record which process transition
- *  is trigerred and potentially which value is associated with this
- *  transition. The value is used to find which communication is triggerred
- *  in things like waitany and for associating a given value of MC_random()
- *  calls.
- */
-typedef struct s_mc_record_item {
-  int pid;
-  int value;
-} s_mc_record_item_t, *mc_record_item_t;
+typedef std::vector<Transition> RecordTrace;
 
-/** Convert a string representation of the path into a array of `s_mc_record_item_t`
+/** Convert a string representation of the path into a array of `simgrid::mc::Transition`
  */
-XBT_INTERNAL xbt_dynar_t MC_record_from_string(const char* data);
-
-/** Generate a string representation
-*
-* The current format is a ";"-delimited list of pairs:
-* "pid0,value0;pid2,value2;pid3,value3". The value can be
-* omitted is it is null.
-*/
-XBT_INTERNAL char* MC_record_stack_to_string(xbt_fifo_t stack);
+XBT_PRIVATE RecordTrace parseRecordTrace(const char* data);
+XBT_PRIVATE std::string traceToString(simgrid::mc::RecordTrace const& trace);
+XBT_PRIVATE void dumpRecordPath();
 
-/** Dump the path represented by a given stack in the log
- */
-XBT_INTERNAL void MC_record_dump_path(xbt_fifo_t stack);
+XBT_PRIVATE void replay(RecordTrace const& trace);
+XBT_PRIVATE void replay(const char* trace);
 
-// ***** Replay
+}
+}
 
-/** Replay a path represented by the record items
- *
- *  \param start Array of record item
- *  \item  count Number of record items
- */
-XBT_INTERNAL void MC_record_replay(mc_record_item_t start, size_t count);
+SG_BEGIN_DECL()
 
-/** Replay a path represented by a string
+/** Whether the MC record mode is enabled
  *
- *  \param data String representation of the path
+ *  The behaviour is not changed. The only real difference is that
+ *  the path is writtent in the log when an interesting path is found.
  */
-XBT_INTERNAL void MC_record_replay_from_string(const char* data);
+#define MC_record_is_active() _sg_do_model_check_record
 
-XBT_INTERNAL void MC_record_replay_init(void);
+// **** Data conversion
 
 SG_END_DECL()