mirror of
https://github.com/genodelabs/genode.git
synced 2024-12-20 14:13:09 +00:00
19c13877ca
Issue #5227
41 lines
1.0 KiB
C++
41 lines
1.0 KiB
C++
/*
|
|
* \brief Generic timestamp for CTF traces
|
|
* \author Johannes Schlatow
|
|
* \date 2021-08-04
|
|
*/
|
|
|
|
/*
|
|
* Copyright (C) 2021 Genode Labs GmbH
|
|
*
|
|
* This file is part of the Genode OS framework, which is distributed
|
|
* under the terms of the GNU Affero General Public License version 3.
|
|
*/
|
|
|
|
#ifndef _CTF__TIMESTAMP_H_
|
|
#define _CTF__TIMESTAMP_H_
|
|
|
|
#include <base/fixed_stdint.h>
|
|
#include <util/register.h>
|
|
|
|
namespace Ctf {
|
|
using namespace Genode;
|
|
|
|
/* generic fixed-width timestamp type for different Trace::Timestamp widths */
|
|
template <int PWIDTH>
|
|
struct _Timestamp : Register<64> {
|
|
static constexpr bool extended() { return PWIDTH < 64; }
|
|
|
|
/* define _PWIDTH to get a valid Extension Bitfield even for 64-bit */
|
|
enum { _PWIDTH = PWIDTH < 64 ? PWIDTH : 0 };
|
|
|
|
struct Base : Bitfield<0, PWIDTH> { };
|
|
struct Extension : Bitfield<_PWIDTH, 64-_PWIDTH> { };
|
|
};
|
|
|
|
using Timestamp = _Timestamp<sizeof(Trace::Timestamp)*8>;
|
|
|
|
using Timestamp_base = uint64_t __attribute__((aligned(1)));
|
|
}
|
|
|
|
#endif /* _CTF__TIMESTAMP_H_ */
|