trace_manager.h 2.04 KB
Newer Older
yoogx's avatar
yoogx committed
1
2
3
4
#include <deployment.h>
#include <request.h>
#include <po_hi_time.h>

Antonia Francis's avatar
Antonia Francis committed
5
6
7
8
/**
 * \enum events.
 * \brief Nature of the task traced.
 */
yoogx's avatar
yoogx committed
9
10
11
12
13
14
typedef enum {
	PERIODIC = 1,
	SPORADIC = -1,
        ANY = 0,
} events;

Antonia Francis's avatar
Antonia Francis committed
15
16
17
18
/**
 * \enum steps.
 * \brief Step in which the traced-task is.
 */
yoogx's avatar
yoogx committed
19
20
21
22
23
24
25
26
27
typedef enum {
	/* The task has just been creatd */
	CREATION = 0,
	STORE_OUT = 1,
	TRANSPORT_SEND = 2,
	WAIT_FOR = 3,
	GET_VALUE = 4,
} steps;

Antonia Francis's avatar
Antonia Francis committed
28
29
30
31
/**
 * \struct characteristics.
 * \brief Structure stored when an event is recorded.
 */
yoogx's avatar
yoogx committed
32
33
34
35
36
37
38
39
40
41
42
43
44
45
typedef struct characteristics characteristics;

struct characteristics{
	events event;
	steps status;
	__po_hi_task_id task_id;
	__po_hi_port_t global_port_src;
	__po_hi_port_t global_port_dest;
	__po_hi_local_port_t loc_port_src;
	__po_hi_local_port_t loc_port_dest;
	__po_hi_time_t mytime;
	__po_hi_request_t *p_request;
};

Antonia Francis's avatar
Antonia Francis committed
46
47
48
/**
 * \brief Function initializing the mutex.
 */
yoogx's avatar
yoogx committed
49
50
void trace_initialize();

Antonia Francis's avatar
Antonia Francis committed
51
52
53
54
/**
 * \brief Function used to trace a task.
 * 
 * The stored events (under the form of "characteristics" structures) are sent in an array 
yoogx's avatar
yoogx committed
55
 * and written in the history.txt file.
Antonia Francis's avatar
Antonia Francis committed
56
57
 * 
 * WARNING.
yoogx's avatar
yoogx committed
58
59
 * If an operation is made without movement, that is to say with no source or destination (such as waiting for an event),
 * the concerned port is stored in the "src" port.
Antonia Francis's avatar
Antonia Francis committed
60
61
62
63
64
65
66
67
68
69
70
71
 * 
 * \param event The nature of the task.
 * \param status The step in which the task is.
 * \param task_id Identifier of the task.
 * \param p_src and p_dest, the GLOBAL source and destination ports if they exists / are retrievable.
 * \param port_src and port_dest, the LOCAL source and destination ports if they exists / are retrievable.
 * \param p_req a pointer toward the request if it exists and is retrievable.
 * 
 * \return __PO_HI_SUCCESS if successful.
 * \return __PO_HI_INVALID if there is an error with the txt file.
 * \return __PO_HI_UNAVAILABLE is the time isn't retrievable.
 */
yoogx's avatar
yoogx committed
72
73
74
75
76
77
78
79
80
int record_event
(int event, 
 int status, 
 __po_hi_task_id t_id,
 __po_hi_port_t p_src,
 __po_hi_port_t p_dest,
 __po_hi_local_port_t port_src,
 __po_hi_local_port_t port_dest,
 __po_hi_request_t *p_req);