"lightx2v/common/vscode:/vscode.git/clone" did not exist on "5c241f869fe0a02201f90ff603bb8db9e1518f91"
events.h 6.86 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
class EHostInstr : public event {
 public:
  uint64_t pc;
48
49
  bool fMemR;
  bool fMemW;
50

Antoine Kaufmann's avatar
Antoine Kaufmann committed
51
52
  EHostInstr(uint64_t ts_, uint64_t pc_)
      : event(ts_), pc(pc_), fMemR(false), fMemW(false) {
53
54
55
56
57
58
59
60
61
62
  }

  virtual ~EHostInstr() {
  }

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

63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
class EHostHalt : public event {
 public:
  uint64_t pc;

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

  virtual ~EHostHalt() {
  }

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

78
class EHostCall : public event {
79
80
 public:
  const std::string &fun;
Antoine Kaufmann's avatar
Antoine Kaufmann committed
81

82
83
  EHostCall(uint64_t ts_, const std::string &fun_) : event(ts_), fun(fun_) {
  }
Antoine Kaufmann's avatar
Antoine Kaufmann committed
84

85
86
  virtual ~EHostCall() {
  }
87

88
89
90
  virtual void dump(std::ostream &out) {
    out << ts << ": H.CALL " << fun << std::endl;
  }
Antoine Kaufmann's avatar
Antoine Kaufmann committed
91
92
};

93
class EHostMsiX : public event {
94
95
 public:
  uint16_t vec;
Antoine Kaufmann's avatar
Antoine Kaufmann committed
96

97
98
  EHostMsiX(uint64_t ts_, uint16_t vec_) : event(ts_), vec(vec_) {
  }
Antoine Kaufmann's avatar
Antoine Kaufmann committed
99

100
101
  virtual ~EHostMsiX() {
  }
102

103
104
105
  virtual void dump(std::ostream &out) {
    out << ts << ": H.MSIX " << vec << std::endl;
  }
Antoine Kaufmann's avatar
Antoine Kaufmann committed
106
107
};

108
class EHostDmaR : public event {
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
 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
125
126
};

127
class EHostDmaW : public event {
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
 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
144
145
};

146
class EHostDmaC : public event {
147
148
 public:
  uint64_t id;
Antoine Kaufmann's avatar
Antoine Kaufmann committed
149

150
151
  EHostDmaC(uint64_t ts_, uint64_t id_) : event(ts_), id(id_) {
  }
Antoine Kaufmann's avatar
Antoine Kaufmann committed
152

153
154
  virtual ~EHostDmaC() {
  }
155

156
157
158
  virtual void dump(std::ostream &out) {
    out << ts << ": H.DMAC id=" << id << std::endl;
  }
Antoine Kaufmann's avatar
Antoine Kaufmann committed
159
160
};

161
class EHostMmioR : public event {
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
 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
178
179
};

180
class EHostMmioW : public event {
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
 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
197
198
};

199
class EHostMmioC : public event {
200
201
 public:
  uint64_t id;
Antoine Kaufmann's avatar
Antoine Kaufmann committed
202

203
204
  EHostMmioC(uint64_t ts_, uint64_t id_) : event(ts_), id(id_) {
  }
Antoine Kaufmann's avatar
Antoine Kaufmann committed
205

206
207
  virtual ~EHostMmioC() {
  }
208

209
210
211
  virtual void dump(std::ostream &out) {
    out << ts << ": H.MMIOC id=" << id << std::endl;
  }
Antoine Kaufmann's avatar
Antoine Kaufmann committed
212
};
213
214

class e_nic_msix : public event {
215
216
 public:
  uint16_t vec;
217

218
219
  e_nic_msix(uint64_t ts_, uint16_t vec_) : event(ts_), vec(vec_) {
  }
220

221
222
  virtual ~e_nic_msix() {
  }
223

224
225
226
  virtual void dump(std::ostream &out) {
    out << ts << ": N.MSIX " << vec << std::endl;
  }
227
228
229
};

class e_nic_dma_i : public event {
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
 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;
  }
246
247
248
};

class e_nic_dma_c : public event {
249
250
 public:
  uint64_t id;
251

252
253
  e_nic_dma_c(uint64_t ts_, uint64_t id_) : event(ts_), id(id_) {
  }
254

255
256
  virtual ~e_nic_dma_c() {
  }
257

258
259
260
  virtual void dump(std::ostream &out) {
    out << ts << ": N.DMAC id=" << id << std::endl;
  }
261
262
263
};

class e_nic_mmio_r : public event {
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
 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;
  }
280
281
282
};

class e_nic_mmio_w : public event {
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
 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;
  }
299
300
301
};

class e_nic_tx : public event {
302
303
 public:
  uint16_t len;
304

305
306
  e_nic_tx(uint64_t ts_, uint16_t len_) : event(ts_), len(len_) {
  }
307

308
309
  virtual ~e_nic_tx() {
  }
310

311
312
313
  virtual void dump(std::ostream &out) {
    out << ts << ": N.TX " << len << std::endl;
  }
314
315
316
};

class e_nic_rx : public event {
317
318
 public:
  uint16_t len;
319

320
321
  e_nic_rx(uint64_t ts_, uint16_t len_) : event(ts_), len(len_) {
  }
322

323
324
  virtual ~e_nic_rx() {
  }
325

326
327
328
  virtual void dump(std::ostream &out) {
    out << ts << ": N.RX " << len << std::endl;
  }
329
};