events.h 6.2 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
class event {
30
31
 public:
  uint64_t ts;
Antoine Kaufmann's avatar
Antoine Kaufmann committed
32

33
  explicit event(uint64_t ts_) : ts(ts_) {
34
  }
Antoine Kaufmann's avatar
Antoine Kaufmann committed
35

36
37
  virtual ~event() {
  }
38

39
  virtual void dump(std::ostream &out) = 0;
Antoine Kaufmann's avatar
Antoine Kaufmann committed
40
41
};

42
class EHostCall : public event {
43
44
 public:
  const std::string &fun;
Antoine Kaufmann's avatar
Antoine Kaufmann committed
45

46
47
  EHostCall(uint64_t ts_, const std::string &fun_) : event(ts_), fun(fun_) {
  }
Antoine Kaufmann's avatar
Antoine Kaufmann committed
48

49
50
  virtual ~EHostCall() {
  }
51

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

57
class EHostMsiX : public event {
58
59
 public:
  uint16_t vec;
Antoine Kaufmann's avatar
Antoine Kaufmann committed
60

61
62
  EHostMsiX(uint64_t ts_, uint16_t vec_) : event(ts_), vec(vec_) {
  }
Antoine Kaufmann's avatar
Antoine Kaufmann committed
63

64
65
  virtual ~EHostMsiX() {
  }
66

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

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

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

110
class EHostDmaC : public event {
111
112
 public:
  uint64_t id;
Antoine Kaufmann's avatar
Antoine Kaufmann committed
113

114
115
  EHostDmaC(uint64_t ts_, uint64_t id_) : event(ts_), id(id_) {
  }
Antoine Kaufmann's avatar
Antoine Kaufmann committed
116

117
118
  virtual ~EHostDmaC() {
  }
119

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

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

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

163
class EHostMmioC : public event {
164
165
 public:
  uint64_t id;
Antoine Kaufmann's avatar
Antoine Kaufmann committed
166

167
168
  EHostMmioC(uint64_t ts_, uint64_t id_) : event(ts_), id(id_) {
  }
Antoine Kaufmann's avatar
Antoine Kaufmann committed
169

170
171
  virtual ~EHostMmioC() {
  }
172

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

class e_nic_msix : public event {
179
180
 public:
  uint16_t vec;
181

182
183
  e_nic_msix(uint64_t ts_, uint16_t vec_) : event(ts_), vec(vec_) {
  }
184

185
186
  virtual ~e_nic_msix() {
  }
187

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

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

class e_nic_dma_c : public event {
213
214
 public:
  uint64_t id;
215

216
217
  e_nic_dma_c(uint64_t ts_, uint64_t id_) : event(ts_), id(id_) {
  }
218

219
220
  virtual ~e_nic_dma_c() {
  }
221

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

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

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

class e_nic_tx : public event {
266
267
 public:
  uint16_t len;
268

269
270
  e_nic_tx(uint64_t ts_, uint16_t len_) : event(ts_), len(len_) {
  }
271

272
273
  virtual ~e_nic_tx() {
  }
274

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

class e_nic_rx : public event {
281
282
 public:
  uint16_t len;
283

284
285
  e_nic_rx(uint64_t ts_, uint16_t len_) : event(ts_), len(len_) {
  }
286

287
288
  virtual ~e_nic_rx() {
  }
289

290
291
292
  virtual void dump(std::ostream &out) {
    out << ts << ": N.RX " << len << std::endl;
  }
293
};