2 * Copyright (C) 2008 - Mathieu Desnoyers (mathieu.desnoyers@polymtl.ca)
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 #ifndef UST_HEADER_INLINE_H
20 #define UST_HEADER_INLINE_H
27 * Calculate alignment offset to 32-bits. This is the alignment offset of the
31 * The event header must be 32-bits. The total offset calculated here :
33 * Alignment of header struct on 32 bits (min arch size, header size)
34 * + sizeof(header struct) (32-bits)
35 * + (opt) u16 (ext. event id)
36 * + (opt) u16 (event_size) (if event_size == 0xFFFFUL, has ext. event size)
37 * + (opt) u32 (ext. event size)
38 * + (opt) u64 full TSC (aligned on min(64-bits, arch size))
40 * The payload must itself determine its own alignment from the biggest type it
43 static __inline__
unsigned char ust_get_header_size(
44 struct ust_channel
*channel
,
47 size_t *before_hdr_pad
,
50 size_t orig_offset
= offset
;
53 padding
= ltt_align(offset
, sizeof(struct ltt_event_header
));
55 offset
+= sizeof(struct ltt_event_header
);
57 if(unlikely(rflags
)) {
59 case LTT_RFLAG_ID_SIZE_TSC
:
60 offset
+= sizeof(u16
) + sizeof(u16
);
61 if (data_size
>= 0xFFFFU
)
62 offset
+= sizeof(u32
);
63 offset
+= ltt_align(offset
, sizeof(u64
));
64 offset
+= sizeof(u64
);
66 case LTT_RFLAG_ID_SIZE
:
67 offset
+= sizeof(u16
) + sizeof(u16
);
68 if (data_size
>= 0xFFFFU
)
69 offset
+= sizeof(u32
);
72 offset
+= sizeof(u16
);
77 *before_hdr_pad
= padding
;
78 return offset
- orig_offset
;
81 #endif /* UST_HEADER_INLINE_H */
This page took 0.03221 seconds and 4 git commands to generate.