1 | /* |
2 | * Copyright (c) Meta Platforms, Inc. and affiliates. |
3 | * All rights reserved. |
4 | * |
5 | * This source code is licensed under the BSD-style license found in the |
6 | * LICENSE file in the root directory of this source tree. |
7 | */ |
8 | |
9 | #pragma once |
10 | |
11 | #include <atomic> |
12 | #include <string> |
13 | #include <thread> |
14 | |
15 | namespace libkineto { |
16 | |
17 | struct TraceSpan { |
18 | TraceSpan() = delete; |
19 | TraceSpan( |
20 | int64_t startTime, int64_t endTime, std::string name) |
21 | : startTime(startTime), endTime(endTime), name(std::move(name)) { |
22 | } |
23 | TraceSpan( |
24 | int opCount, int it, std::string name, std::string prefix) |
25 | : opCount(opCount), |
26 | iteration(it), |
27 | name(std::move(name)), |
28 | prefix(std::move(prefix)) { |
29 | } |
30 | |
31 | // FIXME: change to duration? |
32 | int64_t startTime{0}; |
33 | int64_t endTime{0}; |
34 | int opCount{0}; |
35 | int iteration{-1}; |
36 | // Name is used to identify timeline |
37 | std::string name; |
38 | // Prefix used to distinguish trace spans on the same timeline |
39 | std::string prefix; |
40 | }; |
41 | |
42 | } // namespace libkineto |
43 | |