| 1 |
#ifndef __ANALYZE_H |
| 2 |
# define __ANALYZE_H |
| 3 |
|
| 4 |
#include <stdint.h> |
| 5 |
|
| 6 |
#include <xen-tools/common-macros.h> |
| 7 |
|
| 8 |
#define TRC_GEN_MAIN 0 |
| 9 |
#define TRC_SCHED_MAIN 1 |
| 10 |
#define TRC_DOM0OP_MAIN 2 |
| 11 |
#define TRC_HVM_MAIN 3 |
| 12 |
#define TRC_MEM_MAIN 4 |
| 13 |
#define TRC_PV_MAIN 5 |
| 14 |
#define TRC_SHADOW_MAIN 6 |
| 15 |
#define TRC_HW_MAIN 7 |
| 16 |
|
| 17 |
#define TRC_LOST_RECORDS_END (TRC_GEN + 50) |
| 18 |
|
| 19 |
enum { |
| 20 |
TRCE_SFLAG_SET_AD, |
| 21 |
TRCE_SFLAG_SET_A, |
| 22 |
TRCE_SFLAG_SHADOW_L1_GET_REF, |
| 23 |
TRCE_SFLAG_SHADOW_L1_PUT_REF, |
| 24 |
TRCE_SFLAG_L2_PROPAGATE, |
| 25 |
TRCE_SFLAG_SET_CHANGED, |
| 26 |
TRCE_SFLAG_SET_FLUSH, |
| 27 |
TRCE_SFLAG_SET_ERROR, |
| 28 |
TRCE_SFLAG_DEMOTE, |
| 29 |
TRCE_SFLAG_PROMOTE, |
| 30 |
TRCE_SFLAG_WRMAP, |
| 31 |
TRCE_SFLAG_WRMAP_GUESS_FOUND, |
| 32 |
TRCE_SFLAG_WRMAP_BRUTE_FORCE, |
| 33 |
TRCE_SFLAG_EARLY_UNSHADOW, |
| 34 |
TRCE_SFLAG_EMULATION_2ND_PT_WRITTEN, |
| 35 |
TRCE_SFLAG_EMULATION_LAST_FAILED, |
| 36 |
TRCE_SFLAG_EMULATE_FULL_PT, |
| 37 |
TRCE_SFLAG_PREALLOC_UNPIN, |
| 38 |
TRCE_SFLAG_PREALLOC_UNHOOK |
| 39 |
}; |
| 40 |
|
| 41 |
#define TRC_HVM_OP_DESTROY_PROC (TRC_HVM_HANDLER + 0x100) |
| 42 |
|
| 43 |
typedef unsigned long long tsc_t; |
| 44 |
|
| 45 |
/* -- on-disk trace buffer definitions -- */ |
| 46 |
struct trace_record { |
| 47 |
union { |
| 48 |
struct { |
| 49 |
unsigned event:28, |
| 50 |
extra_words:3, |
| 51 |
cycle_flag:1; |
| 52 |
union { |
| 53 |
struct { |
| 54 |
uint32_t tsc_lo, tsc_hi; |
| 55 |
uint32_t data[7]; |
| 56 |
} tsc; |
| 57 |
struct { |
| 58 |
uint32_t data[7]; |
| 59 |
} notsc; |
| 60 |
} u; |
| 61 |
}; |
| 62 |
uint32_t raw[8]; |
| 63 |
}; |
| 64 |
}; |
| 65 |
|
| 66 |
/* -- General info about a current record -- */ |
| 67 |
struct time_struct { |
| 68 |
unsigned long long time; |
| 69 |
unsigned int s, ns; |
| 70 |
}; |
| 71 |
|
| 72 |
#define DUMP_HEADER_MAX 256 |
| 73 |
|
| 74 |
struct record_info { |
| 75 |
int cpu; |
| 76 |
tsc_t tsc; |
| 77 |
union { |
| 78 |
unsigned event; |
| 79 |
struct { |
| 80 |
unsigned minor:12, |
| 81 |
sub:4, |
| 82 |
main:12, |
| 83 |
unused:4; |
| 84 |
} evt; |
| 85 |
}; |
| 86 |
int extra_words; |
| 87 |
int size; |
| 88 |
uint32_t *d; |
| 89 |
char dump_header[DUMP_HEADER_MAX]; |
| 90 |
struct time_struct t; |
| 91 |
struct trace_record rec; |
| 92 |
}; |
| 93 |
|
| 94 |
#endif |