[REFACTOR] move and rename /un/register_us_page_probe()
[kernel/swap-modules.git] / driver / picl.h
1 ////////////////////////////////////////////////////////////////////////////////////
2 //
3 //      FILE:           PICL.h
4 //
5 //      DESCRIPTION:
6 //
7 //      SEE ALSO:       PICL.cpp
8 //      AUTHOR:         L.Komkov
9 //      COMPANY NAME:   Samsung Research Center in Moscow
10 //      DEPT NAME:      Advanced Software Group 
11 //      CREATED:        2008.02.15
12 //      VERSION:        1.0
13 //      REVISION DATE:  2008.12.02
14 //
15 ////////////////////////////////////////////////////////////////////////////////////
16
17 #if !defined(PICL_h)
18 #define PICL_h
19
20 #ifdef SWAP_HOST
21 #include <sys/time.h> // struct timeval
22 #else // SWAP_TARGET
23 #ifdef __KERNEL__
24 #include <linux/time.h>         // struct timeval
25 #else
26 #include <sys/time.h> // struct timeval
27 #endif
28 #endif
29
30 #define MAX_ARGS_DATA 200
31
32 #define EVENT_MAX_SIZE 2048*5
33
34 /* EvenRecord format
35  ______________________________________________________________________________________________________________
36 | Len | RecType | EventType | Time | Pid | Tid | CPU | ArgsCount |  ArgTypes  |    ArgValues       | PreEventLen |
37  __4b_____4b________4b________8b_____4b____4b_____4b______4b________ArgCount___variable-length._______4b_____
38   
39 */
40
41 typedef enum
42 {
43         RECORD_ENTRY = 0,
44         RECORD_RET,
45         RECORD_PROFILE,
46
47         RECORD_TYPE_COUNT       // fictional record type used to count real record types
48 } record_type_t;
49
50 const char *ec_record_type_to_name (record_type_t record_type);
51 int ec_record_type_by_name (record_type_t * p_record_type, const char *record_type_name);
52
53 // old Picl.h
54
55 #define _TRACE_TYPE        0
56 #define _TRACE_STATS_TYPE  2
57
58 typedef union tagArgValueType
59 {
60         char m_char;
61         int m_int;
62         long m_long;
63         float m_float;
64         double m_double;
65         void *m_pointer;
66         char *m_string;
67 } _ARG_VALUE_TYPE;
68
69 /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
70
71 #ifdef __KERNEL__
72 #include <linux/types.h>
73 #else
74 #include <sys/types.h>
75 #include <stdint.h>
76 #endif
77
78 struct common_timeval {
79         uint32_t tv_sec;
80         uint32_t tv_usec;
81 };
82
83 typedef uint32_t TYPEOF_EVENT_LENGTH;
84 typedef uint32_t TYPEOF_EVENT_TYPE;
85 typedef uint32_t TYPEOF_PROBE_ID;
86 typedef struct common_timeval TYPEOF_TIME;
87 typedef uint32_t TYPEOF_PROCESS_ID;
88 typedef uint32_t TYPEOF_THREAD_ID;
89 typedef uint32_t TYPEOF_CPU_NUMBER;
90 typedef uint32_t TYPEOF_NUMBER_OF_ARGS;
91
92 typedef struct tagEventHeader
93 {
94         TYPEOF_EVENT_LENGTH m_nLength;
95         TYPEOF_EVENT_TYPE m_nType;
96         TYPEOF_PROBE_ID m_nProbeID;
97         TYPEOF_TIME m_time;
98         TYPEOF_PROCESS_ID m_nProcessID;
99         TYPEOF_THREAD_ID m_nThreadID;
100         TYPEOF_CPU_NUMBER m_nCPU;
101         TYPEOF_NUMBER_OF_ARGS m_nNumberOfArgs;
102 } SWAP_TYPE_EVENT_HEADER;
103
104 typedef struct tagEvent
105 {
106         SWAP_TYPE_EVENT_HEADER *m_pHeader;
107         char *m_pDescriptor;
108         char *m_pData;
109 } SWAP_TYPE_EVENT;
110
111 /*
112         Argument Descriptors
113
114         c - char
115         h - short
116         d - int
117         x - long
118         p - pointer
119         f - float
120         w - double
121         s - string
122 */
123
124 typedef enum
125 {
126         AT_UNKNOWN,
127         AT_CHAR,
128         AT_SHORT,
129         AT_INT,
130         AT_LONG,
131         AT_PTR,
132         AT_FLOAT,
133         AT_DOUBLE,
134         AT_STRING,
135         AT_ARRAY
136 } TYPE_ARGUMENT;
137
138 #define ALIGN_VALUE(x) ((x) + (4 - ((x) % 4)))
139
140 #endif /* !defined(PICL_h) */