Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
should solve invalid read issues
[simgrid.git] / src / simdag / simdag_private.h
1 /* Copyright (c) 2006-2015. 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 SIMDAG_PRIVATE_H
8 #define SIMDAG_PRIVATE_H
9 #include <set>
10 #include "xbt/dynar.h"
11 #include "simgrid/simdag.h"
12 #include "surf/surf.h"
13 #include "xbt/mallocator.h"
14 #include <stdbool.h>
15
16 SG_BEGIN_DECL()
17
18 /* Global variables */
19
20 typedef struct SD_global {
21   xbt_mallocator_t task_mallocator; /* to not remalloc new tasks */
22
23   bool watch_point_reached;      /* has a task just reached a watch point? */
24
25   std::set<SD_task_t> *initial_tasks;
26   std::set<SD_task_t> *executable_tasks;
27   std::set<SD_task_t> *completed_tasks;
28
29   xbt_dynar_t return_set;
30
31 } s_SD_global_t, *SD_global_t;
32
33 extern XBT_PRIVATE SD_global_t sd_global;
34
35 /* Task */
36 typedef struct SD_task {
37   e_SD_task_state_t state;
38   void *data;                   /* user data */
39   char *name;
40   e_SD_task_kind_t kind;
41   double amount;
42   double alpha;          /* used by typed parallel tasks */
43   double remains;
44   double start_time;
45   double finish_time;
46   surf_action_t surf_action;
47   unsigned short watch_points;  /* bit field xor()ed with masks */
48
49   int marked;                   /* used to check if the task DAG has some cycle*/
50
51   /* dependencies */
52   xbt_dynar_t tasks_before;
53   xbt_dynar_t tasks_after;
54   int unsatisfied_dependencies;
55   unsigned int is_not_ready;
56
57   /* scheduling parameters (only exist in state SD_SCHEDULED) */
58   int host_count;
59   sg_host_t *host_list;
60   double *flops_amount;
61   double *bytes_amount;
62   double rate;
63
64   long long int counter;        /* task unique identifier for instrumentation */
65   char *category;               /* sd task category for instrumentation */
66 } s_SD_task_t;
67
68 /* Task dependencies */
69 typedef struct SD_dependency {
70   char *name;
71   void *data;
72   SD_task_t src;
73   SD_task_t dst;
74   /* src must be finished before dst can start */
75 } s_SD_dependency_t, *SD_dependency_t;
76
77 /* SimDag private functions */
78 XBT_PRIVATE void SD_task_set_state(SD_task_t task, e_SD_task_state_t new_state);
79 XBT_PRIVATE void SD_task_run(SD_task_t task);
80 XBT_PRIVATE bool acyclic_graph_detail(xbt_dynar_t dag);
81 XBT_PRIVATE void uniq_transfer_task_name(SD_task_t task);
82
83 /* Task mallocator functions */
84 XBT_PRIVATE void* SD_task_new_f(void);
85 XBT_PRIVATE void SD_task_recycle_f(void *t);
86 XBT_PRIVATE void SD_task_free_f(void *t);
87
88 SG_END_DECL()
89 #endif