Merge branch 'fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/evalenti/linux...
[linux/fpc-iii.git] / tools / perf / util / jitdump.h
blobb66c1f503d9edbdd939d8f80b720e128abc15620
1 /*
2 * jitdump.h: jitted code info encapsulation file format
4 * Adapted from OProfile GPLv2 support jidump.h:
5 * Copyright 2007 OProfile authors
6 * Jens Wilke
7 * Daniel Hansel
8 * Copyright IBM Corporation 2007
9 */
10 #ifndef JITDUMP_H
11 #define JITDUMP_H
13 #include <sys/time.h>
14 #include <time.h>
15 #include <stdint.h>
17 /* JiTD */
18 #define JITHEADER_MAGIC 0x4A695444
19 #define JITHEADER_MAGIC_SW 0x4454694A
21 #define PADDING_8ALIGNED(x) ((((x) + 7) & 7) ^ 7)
23 #define JITHEADER_VERSION 1
25 enum jitdump_flags_bits {
26 JITDUMP_FLAGS_MAX_BIT,
29 #define JITDUMP_FLAGS_RESERVED (JITDUMP_FLAGS_MAX_BIT < 64 ? \
30 (~((1ULL << JITDUMP_FLAGS_MAX_BIT) - 1)) : 0)
32 struct jitheader {
33 uint32_t magic; /* characters "jItD" */
34 uint32_t version; /* header version */
35 uint32_t total_size; /* total size of header */
36 uint32_t elf_mach; /* elf mach target */
37 uint32_t pad1; /* reserved */
38 uint32_t pid; /* JIT process id */
39 uint64_t timestamp; /* timestamp */
40 uint64_t flags; /* flags */
43 enum jit_record_type {
44 JIT_CODE_LOAD = 0,
45 JIT_CODE_MOVE = 1,
46 JIT_CODE_DEBUG_INFO = 2,
47 JIT_CODE_CLOSE = 3,
49 JIT_CODE_MAX,
52 /* record prefix (mandatory in each record) */
53 struct jr_prefix {
54 uint32_t id;
55 uint32_t total_size;
56 uint64_t timestamp;
59 struct jr_code_load {
60 struct jr_prefix p;
62 uint32_t pid;
63 uint32_t tid;
64 uint64_t vma;
65 uint64_t code_addr;
66 uint64_t code_size;
67 uint64_t code_index;
70 struct jr_code_close {
71 struct jr_prefix p;
74 struct jr_code_move {
75 struct jr_prefix p;
77 uint32_t pid;
78 uint32_t tid;
79 uint64_t vma;
80 uint64_t old_code_addr;
81 uint64_t new_code_addr;
82 uint64_t code_size;
83 uint64_t code_index;
86 struct debug_entry {
87 uint64_t addr;
88 int lineno; /* source line number starting at 1 */
89 int discrim; /* column discriminator, 0 is default */
90 const char name[0]; /* null terminated filename, \xff\0 if same as previous entry */
93 struct jr_code_debug_info {
94 struct jr_prefix p;
96 uint64_t code_addr;
97 uint64_t nr_entry;
98 struct debug_entry entries[0];
101 union jr_entry {
102 struct jr_code_debug_info info;
103 struct jr_code_close close;
104 struct jr_code_load load;
105 struct jr_code_move move;
106 struct jr_prefix prefix;
109 static inline struct debug_entry *
110 debug_entry_next(struct debug_entry *ent)
112 void *a = ent + 1;
113 size_t l = strlen(ent->name) + 1;
114 return a + l;
117 static inline char *
118 debug_entry_file(struct debug_entry *ent)
120 void *a = ent + 1;
121 return a;
124 #endif /* !JITDUMP_H */