| 1 | /* |
| 2 | * Copyright (C) 2022 Jérémie Galarneau <jeremie.galarneau@efficios.com> |
| 3 | * |
| 4 | * SPDX-License-Identifier: GPL-2.0-only |
| 5 | * |
| 6 | */ |
| 7 | |
| 8 | #ifndef LTTNG_CLOCK_CLASS_H |
| 9 | #define LTTNG_CLOCK_CLASS_H |
| 10 | |
| 11 | #include <common/compat/time.hpp> |
| 12 | #include <common/uuid.hpp> |
| 13 | #include <vendor/optional.hpp> |
| 14 | |
| 15 | #include <stddef.h> |
| 16 | #include <stdint.h> |
| 17 | #include <stdio.h> |
| 18 | #include <string> |
| 19 | #include <sys/time.h> |
| 20 | #include <urcu/arch.h> |
| 21 | #include <urcu/system.h> |
| 22 | |
| 23 | namespace lttng { |
| 24 | namespace sessiond { |
| 25 | namespace trace { |
| 26 | |
| 27 | class trace_class_visitor; |
| 28 | |
| 29 | class clock_class { |
| 30 | public: |
| 31 | using cycles_t = uint64_t; |
| 32 | using scycles_t = int64_t; |
| 33 | using cuptr = std::unique_ptr<const clock_class>; |
| 34 | |
| 35 | const std::string name; |
| 36 | const std::string description; |
| 37 | const nonstd::optional<lttng_uuid> uuid; |
| 38 | const scycles_t offset; |
| 39 | const cycles_t frequency; |
| 40 | |
| 41 | virtual void accept(trace_class_visitor& visitor) const; |
| 42 | virtual ~clock_class() = default; |
| 43 | |
| 44 | protected: |
| 45 | clock_class(std::string name, |
| 46 | std::string description, |
| 47 | nonstd::optional<lttng_uuid> uuid, |
| 48 | scycles_t offset, |
| 49 | cycles_t frequency); |
| 50 | }; |
| 51 | |
| 52 | } /* namespace trace */ |
| 53 | } /* namespace sessiond */ |
| 54 | } /* namespace lttng */ |
| 55 | |
| 56 | #endif /* LTTNG_CLOCK_CLASS_H */ |