| 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 | |
| 14 | #include <vendor/optional.hpp> |
| 15 | |
| 16 | #include <stddef.h> |
| 17 | #include <stdint.h> |
| 18 | #include <stdio.h> |
| 19 | #include <string> |
| 20 | #include <sys/time.h> |
| 21 | #include <urcu/arch.h> |
| 22 | #include <urcu/system.h> |
| 23 | |
| 24 | namespace lttng { |
| 25 | namespace sessiond { |
| 26 | namespace trace { |
| 27 | |
| 28 | class trace_class_visitor; |
| 29 | |
| 30 | class clock_class { |
| 31 | public: |
| 32 | using cycles_t = uint64_t; |
| 33 | using scycles_t = int64_t; |
| 34 | using cuptr = std::unique_ptr<const clock_class>; |
| 35 | |
| 36 | virtual ~clock_class() = default; |
| 37 | clock_class(const clock_class&) = delete; |
| 38 | clock_class(clock_class&&) = delete; |
| 39 | clock_class& operator=(clock_class&&) = delete; |
| 40 | clock_class& operator=(const clock_class&) = delete; |
| 41 | |
| 42 | virtual void accept(trace_class_visitor& visitor) const; |
| 43 | |
| 44 | const std::string name; |
| 45 | const std::string description; |
| 46 | const nonstd::optional<lttng_uuid> uuid; |
| 47 | const scycles_t offset; |
| 48 | const cycles_t frequency; |
| 49 | |
| 50 | protected: |
| 51 | clock_class(std::string name, |
| 52 | std::string description, |
| 53 | nonstd::optional<lttng_uuid> uuid, |
| 54 | scycles_t offset, |
| 55 | cycles_t frequency); |
| 56 | }; |
| 57 | |
| 58 | } /* namespace trace */ |
| 59 | } /* namespace sessiond */ |
| 60 | } /* namespace lttng */ |
| 61 | |
| 62 | #endif /* LTTNG_CLOCK_CLASS_H */ |