Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
d8de2e75db82cc06f548d77d164c6d51903bef73
[simgrid.git] / src / include / surf / trace_mgr.h
1 /* Copyright (c) 2004, 2005, 2006, 2007, 2009, 2010. The SimGrid Team.
2  * All rights reserved.                                                     */
3
4 /* This program is free software; you can redistribute it and/or modify it
5  * under the terms of the license (GNU LGPL) which comes with this package. */
6
7 #ifndef _SURF_TMGR_H
8 #define _SURF_TMGR_H
9
10 #include "xbt/heap.h"
11 #include "xbt/dynar.h"
12 #include "surf/maxmin.h"
13 #include "surf/datatypes.h"
14
15 /* Creation functions */
16 XBT_PUBLIC(tmgr_history_t) tmgr_history_new(void);
17 XBT_PUBLIC(void) tmgr_history_free(tmgr_history_t history);
18
19 XBT_PUBLIC(tmgr_trace_t) tmgr_trace_new(const char *filename);
20 XBT_PUBLIC(tmgr_trace_t) tmgr_trace_new_from_string(const char *id,
21                                                     const char *input,
22                                                     double periodicity);
23 XBT_PUBLIC(tmgr_trace_t) tmgr_empty_trace_new(void);
24 XBT_INLINE XBT_PUBLIC(void) tmgr_trace_free(tmgr_trace_t trace);
25 /**
26  * \brief Free a trace event structure
27  *
28  * This function frees a trace_event if it can be freed, ie, if it has the free_me flag set to 1. This flag indicates whether the structure is still used somewhere or not.
29  * \param       trace_event             Trace event structure
30  * \return 1 if the structure was freed, 0 otherwise
31 */
32 XBT_PUBLIC(int) tmgr_trace_event_free(tmgr_trace_event_t trace_event);
33
34 XBT_PUBLIC(tmgr_trace_event_t) tmgr_history_add_trace(tmgr_history_t
35                                                       history,
36                                                       tmgr_trace_t trace,
37                                                       double start_time,
38                                                       unsigned int offset,
39                                                       void *model);
40
41 /* Access functions */
42 XBT_PUBLIC(double) tmgr_history_next_date(tmgr_history_t history);
43 XBT_PUBLIC(tmgr_trace_event_t)
44     tmgr_history_get_next_event_leq(tmgr_history_t history, double date,
45                                 double *value, void **model);
46
47 XBT_PUBLIC(void) tmgr_finalize(void);
48
49 #endif                          /* _SURF_TMGR_H */