events.h 6.24 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
class EHostCall : public event {
46
47
 public:
  const std::string &fun;
Antoine Kaufmann's avatar
Antoine Kaufmann committed
48

49
50
  EHostCall(uint64_t ts_, const std::string &fun_) : event(ts_), fun(fun_) {
  }
Antoine Kaufmann's avatar
Antoine Kaufmann committed
51

52
53
  virtual ~EHostCall() {
  }
54

55
56
57
  virtual void dump(std::ostream &out) {
    out << ts << ": H.CALL " << fun << std::endl;
  }
Antoine Kaufmann's avatar
Antoine Kaufmann committed
58
59
};

60
class EHostMsiX : public event {
61
62
 public:
  uint16_t vec;
Antoine Kaufmann's avatar
Antoine Kaufmann committed
63

64
65
  EHostMsiX(uint64_t ts_, uint16_t vec_) : event(ts_), vec(vec_) {
  }
Antoine Kaufmann's avatar
Antoine Kaufmann committed
66

67
68
  virtual ~EHostMsiX() {
  }
69

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

75
class EHostDmaR : public event {
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
 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
92
93
};

94
class EHostDmaW : public event {
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
 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
111
112
};

113
class EHostDmaC : public event {
114
115
 public:
  uint64_t id;
Antoine Kaufmann's avatar
Antoine Kaufmann committed
116

117
118
  EHostDmaC(uint64_t ts_, uint64_t id_) : event(ts_), id(id_) {
  }
Antoine Kaufmann's avatar
Antoine Kaufmann committed
119

120
121
  virtual ~EHostDmaC() {
  }
122

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

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

147
class EHostMmioW : public event {
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
 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
164
165
};

166
class EHostMmioC : public event {
167
168
 public:
  uint64_t id;
Antoine Kaufmann's avatar
Antoine Kaufmann committed
169

170
171
  EHostMmioC(uint64_t ts_, uint64_t id_) : event(ts_), id(id_) {
  }
Antoine Kaufmann's avatar
Antoine Kaufmann committed
172

173
174
  virtual ~EHostMmioC() {
  }
175

176
177
178
  virtual void dump(std::ostream &out) {
    out << ts << ": H.MMIOC id=" << id << std::endl;
  }
Antoine Kaufmann's avatar
Antoine Kaufmann committed
179
};
180
181

class e_nic_msix : public event {
182
183
 public:
  uint16_t vec;
184

185
186
  e_nic_msix(uint64_t ts_, uint16_t vec_) : event(ts_), vec(vec_) {
  }
187

188
189
  virtual ~e_nic_msix() {
  }
190

191
192
193
  virtual void dump(std::ostream &out) {
    out << ts << ": N.MSIX " << vec << std::endl;
  }
194
195
196
};

class e_nic_dma_i : public event {
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
 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;
  }
213
214
215
};

class e_nic_dma_c : public event {
216
217
 public:
  uint64_t id;
218

219
220
  e_nic_dma_c(uint64_t ts_, uint64_t id_) : event(ts_), id(id_) {
  }
221

222
223
  virtual ~e_nic_dma_c() {
  }
224

225
226
227
  virtual void dump(std::ostream &out) {
    out << ts << ": N.DMAC id=" << id << std::endl;
  }
228
229
230
};

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

class e_nic_mmio_w : public event {
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
 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;
  }
266
267
268
};

class e_nic_tx : public event {
269
270
 public:
  uint16_t len;
271

272
273
  e_nic_tx(uint64_t ts_, uint16_t len_) : event(ts_), len(len_) {
  }
274

275
276
  virtual ~e_nic_tx() {
  }
277

278
279
280
  virtual void dump(std::ostream &out) {
    out << ts << ": N.TX " << len << std::endl;
  }
281
282
283
};

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

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

290
291
  virtual ~e_nic_rx() {
  }
292

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