events.h 6.52 KB
Newer Older
Antoine Kaufmann's avatar
Antoine Kaufmann committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
/*
 * Copyright 2021 Max Planck Institute for Software Systems, and
 * National University of Singapore
 *
 * Permission is hereby granted, free of charge, to any person obtaining
 * a copy of this software and associated documentation files (the
 * "Software"), to deal in the Software without restriction, including
 * without limitation the rights to use, copy, modify, merge, publish,
 * distribute, sublicense, and/or sell copies of the Software, and to
 * permit persons to whom the Software is furnished to do so, subject to
 * the following conditions:
 *
 * The above copyright notice and this permission notice shall be
 * included in all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
 * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
 * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 */

Antoine Kaufmann's avatar
Antoine Kaufmann committed
25
26
#pragma once

Antoine Kaufmann's avatar
Antoine Kaufmann committed
27
28
#include <string>

29
30
class log_parser;

31
class event {
32
33
 public:
  uint64_t ts;
34
  log_parser *source;
Antoine Kaufmann's avatar
Antoine Kaufmann committed
35

36
  explicit event(uint64_t ts_) : ts(ts_) {
37
  }
Antoine Kaufmann's avatar
Antoine Kaufmann committed
38

39
40
  virtual ~event() {
  }
41

42
  virtual void dump(std::ostream &out) = 0;
Antoine Kaufmann's avatar
Antoine Kaufmann committed
43
44
};

45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
class EHostInstr : public event {
 public:
  uint64_t pc;

  EHostInstr(uint64_t ts_, uint64_t pc_) : event(ts_), pc(pc_) {
  }

  virtual ~EHostInstr() {
  }

  virtual void dump(std::ostream &out) {
    out << ts << ": H.INSTR pc=" << std::hex << pc << std::dec << std::endl;
  }
};

60
class EHostCall : public event {
61
62
 public:
  const std::string &fun;
Antoine Kaufmann's avatar
Antoine Kaufmann committed
63

64
65
  EHostCall(uint64_t ts_, const std::string &fun_) : event(ts_), fun(fun_) {
  }
Antoine Kaufmann's avatar
Antoine Kaufmann committed
66

67
68
  virtual ~EHostCall() {
  }
69

70
71
72
  virtual void dump(std::ostream &out) {
    out << ts << ": H.CALL " << fun << std::endl;
  }
Antoine Kaufmann's avatar
Antoine Kaufmann committed
73
74
};

75
class EHostMsiX : public event {
76
77
 public:
  uint16_t vec;
Antoine Kaufmann's avatar
Antoine Kaufmann committed
78

79
80
  EHostMsiX(uint64_t ts_, uint16_t vec_) : event(ts_), vec(vec_) {
  }
Antoine Kaufmann's avatar
Antoine Kaufmann committed
81

82
83
  virtual ~EHostMsiX() {
  }
84

85
86
87
  virtual void dump(std::ostream &out) {
    out << ts << ": H.MSIX " << vec << std::endl;
  }
Antoine Kaufmann's avatar
Antoine Kaufmann committed
88
89
};

90
class EHostDmaR : public event {
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
 public:
  uint64_t id;
  uint64_t addr;
  uint64_t size;

  EHostDmaR(uint64_t ts_, uint64_t id_, uint64_t addr_, uint64_t size_)
      : event(ts_), id(id_), addr(addr_), size(size_) {
  }

  virtual ~EHostDmaR() {
  }

  virtual void dump(std::ostream &out) {
    out << ts << ": H.DMAR id=" << id << " addr=" << addr << " size=" << size
        << std::endl;
  }
Antoine Kaufmann's avatar
Antoine Kaufmann committed
107
108
};

109
class EHostDmaW : public event {
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
 public:
  uint64_t id;
  uint64_t addr;
  uint64_t size;

  EHostDmaW(uint64_t ts_, uint64_t id_, uint64_t addr_, uint64_t size_)
      : event(ts_), id(id_), addr(addr_), size(size_) {
  }

  virtual ~EHostDmaW() {
  }

  virtual void dump(std::ostream &out) {
    out << ts << ": H.DMAW id=" << id << " addr=" << addr << " size=" << size
        << std::endl;
  }
Antoine Kaufmann's avatar
Antoine Kaufmann committed
126
127
};

128
class EHostDmaC : public event {
129
130
 public:
  uint64_t id;
Antoine Kaufmann's avatar
Antoine Kaufmann committed
131

132
133
  EHostDmaC(uint64_t ts_, uint64_t id_) : event(ts_), id(id_) {
  }
Antoine Kaufmann's avatar
Antoine Kaufmann committed
134

135
136
  virtual ~EHostDmaC() {
  }
137

138
139
140
  virtual void dump(std::ostream &out) {
    out << ts << ": H.DMAC id=" << id << std::endl;
  }
Antoine Kaufmann's avatar
Antoine Kaufmann committed
141
142
};

143
class EHostMmioR : public event {
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
 public:
  uint64_t id;
  uint64_t addr;
  uint64_t size;

  EHostMmioR(uint64_t ts_, uint64_t id_, uint64_t addr_, uint64_t size_)
      : event(ts_), id(id_), addr(addr_), size(size_) {
  }

  virtual ~EHostMmioR() {
  }

  virtual void dump(std::ostream &out) {
    out << ts << ": H.MMIOR id=" << id << " addr=" << addr << " size=" << size
        << std::endl;
  }
Antoine Kaufmann's avatar
Antoine Kaufmann committed
160
161
};

162
class EHostMmioW : public event {
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
 public:
  uint64_t id;
  uint64_t addr;
  uint64_t size;

  EHostMmioW(uint64_t ts_, uint64_t id_, uint64_t addr_, uint64_t size_)
      : event(ts_), id(id_), addr(addr_), size(size_) {
  }

  virtual ~EHostMmioW() {
  }

  virtual void dump(std::ostream &out) {
    out << ts << ": H.MMIOW id=" << id << " addr=" << addr << " size=" << size
        << std::endl;
  }
Antoine Kaufmann's avatar
Antoine Kaufmann committed
179
180
};

181
class EHostMmioC : public event {
182
183
 public:
  uint64_t id;
Antoine Kaufmann's avatar
Antoine Kaufmann committed
184

185
186
  EHostMmioC(uint64_t ts_, uint64_t id_) : event(ts_), id(id_) {
  }
Antoine Kaufmann's avatar
Antoine Kaufmann committed
187

188
189
  virtual ~EHostMmioC() {
  }
190

191
192
193
  virtual void dump(std::ostream &out) {
    out << ts << ": H.MMIOC id=" << id << std::endl;
  }
Antoine Kaufmann's avatar
Antoine Kaufmann committed
194
};
195
196

class e_nic_msix : public event {
197
198
 public:
  uint16_t vec;
199

200
201
  e_nic_msix(uint64_t ts_, uint16_t vec_) : event(ts_), vec(vec_) {
  }
202

203
204
  virtual ~e_nic_msix() {
  }
205

206
207
208
  virtual void dump(std::ostream &out) {
    out << ts << ": N.MSIX " << vec << std::endl;
  }
209
210
211
};

class e_nic_dma_i : public event {
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
 public:
  uint64_t id;
  uint64_t addr;
  uint64_t size;

  e_nic_dma_i(uint64_t ts_, uint64_t id_, uint64_t addr_, uint64_t size_)
      : event(ts_), id(id_), addr(addr_), size(size_) {
  }

  virtual ~e_nic_dma_i() {
  }

  virtual void dump(std::ostream &out) {
    out << ts << ": N.DMAI id=" << id << " addr=" << addr << " size=" << size
        << std::endl;
  }
228
229
230
};

class e_nic_dma_c : public event {
231
232
 public:
  uint64_t id;
233

234
235
  e_nic_dma_c(uint64_t ts_, uint64_t id_) : event(ts_), id(id_) {
  }
236

237
238
  virtual ~e_nic_dma_c() {
  }
239

240
241
242
  virtual void dump(std::ostream &out) {
    out << ts << ": N.DMAC id=" << id << std::endl;
  }
243
244
245
};

class e_nic_mmio_r : public event {
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
 public:
  uint64_t addr;
  uint64_t size;
  uint64_t val;

  e_nic_mmio_r(uint64_t ts_, uint64_t addr_, uint64_t size_, uint64_t val_)
      : event(ts_), addr(addr_), size(size_), val(val_) {
  }

  virtual ~e_nic_mmio_r() {
  }

  virtual void dump(std::ostream &out) {
    out << ts << ": N.MMIOR addr=" << addr << " size=" << size << " val=" << val
        << std::endl;
  }
262
263
264
};

class e_nic_mmio_w : public event {
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
 public:
  uint64_t addr;
  uint64_t size;
  uint64_t val;

  e_nic_mmio_w(uint64_t ts_, uint64_t addr_, uint64_t size_, uint64_t val_)
      : event(ts_), addr(addr_), size(size_), val(val_) {
  }

  virtual ~e_nic_mmio_w() {
  }

  virtual void dump(std::ostream &out) {
    out << ts << ": N.MMIOW addr=" << addr << " size=" << size << " val=" << val
        << std::endl;
  }
281
282
283
};

class e_nic_tx : public event {
284
285
 public:
  uint16_t len;
286

287
288
  e_nic_tx(uint64_t ts_, uint16_t len_) : event(ts_), len(len_) {
  }
289

290
291
  virtual ~e_nic_tx() {
  }
292

293
294
295
  virtual void dump(std::ostream &out) {
    out << ts << ": N.TX " << len << std::endl;
  }
296
297
298
};

class e_nic_rx : public event {
299
300
 public:
  uint16_t len;
301

302
303
  e_nic_rx(uint64_t ts_, uint16_t len_) : event(ts_), len(len_) {
  }
304

305
306
  virtual ~e_nic_rx() {
  }
307

308
309
310
  virtual void dump(std::ostream &out) {
    out << ts << ": N.RX " << len << std::endl;
  }
311
};