Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
46dcd8345f3ae19e473200e544e52f1bd0bd4c75
[simgrid.git] / examples / gras / replay / workload.h
1 /* Copyright (c) 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 /* This datatype stores a a trace as produced by examples/simdag/dax, or other means
8  * It can be replayed in simulation with examples/msg/actions or on a real platform with
9  * examples/gras/replay.
10  */
11
12 #ifndef XBT_WORKLOAD_H_
13 #define XBT_WORKLOAD_H_
14
15 #include "xbt/misc.h"
16 #include "xbt/dynar.h"
17
18 /* kind of elements */
19 #define XBT_WORKLOAD_COMPUTE 0
20 #define XBT_WORKLOAD_SEND 1
21 #define XBT_WORKLOAD_RECV 2
22
23 /* one command to do */
24 typedef struct {
25   /* keep it in sync with function xbt_workload_declare_datadesc() */
26
27   char *who;      /* the slave who should do it */
28   char *comment;  /* a comment placed at the end of the line, if any */
29   int action;     /* 0: compute(darg flops); 1: send darg bytes to strarg; 2: recv darg bytes from strarg */
30   double date;    /* when it occured when the trace was captured */
31   double d_arg;   /* double argument, if any */
32   char * str_arg; /* string argument, if any */
33 } s_xbt_workload_elm_t, *xbt_workload_elm_t;
34
35 XBT_PUBLIC(xbt_workload_elm_t) xbt_workload_elm_parse(char *line);
36 XBT_PUBLIC(void) xbt_workload_elm_free(xbt_workload_elm_t cmd);
37 XBT_PUBLIC(void) xbt_workload_elm_free_voidp(void*cmd);
38 XBT_PUBLIC(char *)xbt_workload_elm_to_string(xbt_workload_elm_t cmd);
39 XBT_PUBLIC(int) xbt_workload_elm_cmp_who_date(const void* _c1, const void* _c2);
40 XBT_PUBLIC(void) xbt_workload_sort_who_date(xbt_dynar_t c);
41 XBT_PUBLIC(xbt_dynar_t) xbt_workload_parse_file(char *filename);
42
43 XBT_PUBLIC(void) xbt_workload_declare_datadesc(void);
44
45
46 typedef struct {
47   int size;
48   char *chunk;
49 } s_xbt_workload_data_chunk_t,*xbt_workload_data_chunk_t;
50 XBT_PUBLIC(xbt_workload_data_chunk_t) xbt_workload_data_chunk_new(int size);
51 XBT_PUBLIC(void) xbt_workload_data_chunk_free(xbt_workload_data_chunk_t c);
52
53 #endif /* XBT_WORKLOAD_H_ */