Mike Dodd | 8cfa702 | 2010-11-17 11:12:26 -0800 | [diff] [blame] | 1 | /** |
| 2 | * @file jitdump.h |
| 3 | * Header structure of a JIT-dump file. |
| 4 | * |
| 5 | * @remark Copyright 2007 OProfile authors |
| 6 | * @remark Read the file COPYING |
| 7 | * |
| 8 | * @author Jens Wilke |
| 9 | * @Modifications Daniel Hansel |
| 10 | * |
| 11 | * Copyright IBM Corporation 2007 |
| 12 | * |
| 13 | */ |
| 14 | |
| 15 | #include <sys/time.h> |
| 16 | #include <time.h> |
| 17 | #include <stdint.h> |
| 18 | |
| 19 | #include "op_types.h" |
| 20 | |
| 21 | #ifndef JITDUMP_H |
| 22 | #define JITDUMP_H |
| 23 | |
| 24 | /** |
| 25 | * Magic to do a sanity check that this is a dump file |
| 26 | * characters "jItO" */ |
| 27 | #define JITHEADER_MAGIC 0x4F74496A |
| 28 | |
| 29 | /** |
| 30 | * Macro to calculate count of padding bytes |
| 31 | * to extend a size to be 8-byte aligned. */ |
| 32 | #define PADDING_8ALIGNED(x) ((((x) + 7) & 7) ^ 7) |
| 33 | |
| 34 | /** |
| 35 | * Version number to avoid conflicts, increase |
| 36 | * this whenever the header is changed */ |
| 37 | #define JITHEADER_VERSION 1 |
| 38 | |
| 39 | struct jitheader { |
| 40 | /* characters "jItO" */ |
| 41 | u32 magic; |
| 42 | /* version of the dump */ |
| 43 | u32 version; |
| 44 | u32 totalsize; |
| 45 | u32 bfd_arch; |
| 46 | u32 bfd_mach; |
| 47 | u64 timestamp; |
| 48 | char bfd_target[0]; |
| 49 | }; |
| 50 | |
| 51 | enum jit_record_type { |
| 52 | JIT_CODE_LOAD=0, |
| 53 | JIT_CODE_UNLOAD=1, |
| 54 | JIT_CODE_CLOSE=2, |
| 55 | JIT_CODE_DEBUG_INFO=3 |
| 56 | }; |
| 57 | |
| 58 | /* each record starts always with a id and a total_size */ |
| 59 | struct jr_prefix { |
| 60 | u32 id; |
| 61 | u32 total_size; |
| 62 | }; |
| 63 | |
| 64 | /* record0 (id=0) logs a jitted code */ |
| 65 | struct jr_code_load { |
| 66 | u32 id; |
| 67 | u32 total_size; |
| 68 | u64 timestamp; |
| 69 | u64 vma; |
| 70 | u64 code_addr; |
| 71 | u32 code_size; |
| 72 | u32 align; |
| 73 | }; |
| 74 | |
| 75 | /* record1 (id=1) logs a code unload */ |
| 76 | struct jr_code_unload { |
| 77 | u32 id; |
| 78 | u32 total_size; |
| 79 | u64 timestamp; |
| 80 | u64 vma; |
| 81 | }; |
| 82 | |
| 83 | /* record2 (id=2) logs end of JVM livetime */ |
| 84 | struct jr_code_close { |
| 85 | u32 id; |
| 86 | u32 total_size; |
| 87 | u64 timestamp; |
| 88 | }; |
| 89 | |
| 90 | /* record3 (id=3) logs debug line information. */ |
| 91 | struct jr_code_debug_info { |
| 92 | u32 id; |
| 93 | u32 total_size; |
| 94 | u64 timestamp; |
| 95 | u64 code_addr; |
| 96 | u32 nr_entry; |
| 97 | u32 align; |
| 98 | }; |
| 99 | |
| 100 | #endif /* !JITDUMP_H */ |
| 101 | |