1 /* Copyright (C) 2021 Free Software Foundation, Inc.
4 This file is part of GNU Binutils.
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 3, or (at your option)
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, 51 Franklin Street - Fifth Floor, Boston,
19 MA 02110-1301, USA. */
25 * This file contains structure definitions for the binary file formats
26 * used in the experiment. It is implemented as C header file so that
27 * it can be processed by both ANSI-C and C++.
37 typedef uint64_t Vaddr_type
; /* process address for 64 bit apps */
38 typedef uint64_t Size_type
; /* size_t for 64 bit apps */
40 typedef uint32_t Vaddr_type
; /* process address */
41 typedef uint32_t Size_type
; /* size_t for 32 bit apps */
44 /* marker to indicate dump of O7 register on stack (support for leaf routines) */
45 #define SP_LEAF_CHECK_MARKER ((uint64_t)(-1))
47 /* marker to indicate truncated stack */
48 #define SP_TRUNC_STACK_MARKER ((uint64_t)(-2))
50 /* marker to indicate failed stack unwind */
51 #define SP_FAILED_UNWIND_MARKER ((uint64_t)(-3))
53 #define PROFILE_BUFFER_CHUNK 16384
64 { /* values for "profpckt kind" stored in log.xml */
85 LAST_PCKT
, /* last data packet type */
86 CLOSED_PCKT
= 65535 /* -1, this packet closes a block */
97 LAST_INFO
/* keep this one last */
100 #define COMPRESSED_INFO 0x80000000
102 #define JAVA_PCKT 0x80
103 #define OMPS_PCKT 0x40 /* packet contains OMP state info */
104 #define PCKT_TYPE(x) ((x) & 0x1f)
106 typedef struct CommonHead_packet
108 unsigned int tsize
: 16;
109 unsigned int type
: 16;
112 // All collector modules record their packets as extensions of CM_Packet
113 typedef struct CM_Packet
115 unsigned int tsize
: 16;
116 unsigned int type
: 16;
119 typedef struct Common_packet
121 unsigned int tsize
: 16; /* packet size */
122 unsigned int type
: 16;
130 /* Definition of values stored in the experiment PROP_MSTATE field */
132 * LWP microstates (copied from msacct.h). Also see PrUsage class.
136 /* Can be used with LMS_STATE_STRINGS (below) */
137 #define LMS_USER 0 /* running in user mode */
138 #define LMS_SYSTEM 1 /* running in sys call or page fault */
139 #define LMS_TRAP 2 /* running in other trap */
140 #define LMS_TFAULT 3 /* asleep in user text page fault */
141 #define LMS_DFAULT 4 /* asleep in user data page fault */
142 #define LMS_KFAULT 5 /* asleep in kernel page fault */
143 #define LMS_USER_LOCK 6 /* asleep waiting for user-mode lock */
144 #define LMS_SLEEP 7 /* asleep for any other reason */
145 #define LMS_WAIT_CPU 8 /* waiting for CPU (latency) */
146 #define LMS_STOPPED 9 /* stopped (/proc, jobcontrol, or lwp_stop) */
147 #define LMS_LINUX_CPU 10 /* LINUX timer_create(CLOCK_THREAD_CPUTIME_ID) */
148 #define LMS_KERNEL_CPU 11 /* LINUX timer_create(CLOCK_THREAD_CPUTIME_ID) */
149 #define LMS_NUM_STATES 12 /* total number of above states */
150 #define LMS_NUM_SOLARIS_MSTATES 10 /* LMS microstates thru LMS_STOPPED */
152 // Magic value stored in experiments that identifies which LMS states are valid
153 #define LMS_MAGIC_ID_SOLARIS 10 // Solaris: LMS_USER thru LMS_STOPPED
154 #define LMS_MAGIC_ID_ERKERNEL_USER 2 // er_kernel user: LMS_USER, LMS_SYSTEM
155 #define LMS_MAGIC_ID_ERKERNEL_KERNEL 3 // er_kernel kernel: LMS_KERNEL_CPU
156 #define LMS_MAGIC_ID_LINUX 1 // Linux: LMS_LINUX_CPU
158 #define LMS_STATE_STRINGS \
160 NTXT("USER"), /* LMS_USER */ \
161 NTXT("SYSTEM"), /* LMS_SYSTEM */ \
162 NTXT("TRAP"), /* LMS_TRAP */ \
163 NTXT("TFAULT"), /* LMS_TFAULT */ \
164 NTXT("DFAULT"), /* LMS_DFAULT */ \
165 NTXT("KFAULT"), /* LMS_KFAULT */ \
166 NTXT("USER_LOCK"), /* LMS_USER_LOCK */ \
167 NTXT("SLEEP"), /* LMS_SLEEP */ \
168 NTXT("WAIT_CPU"), /* LMS_WAIT_CPU */ \
169 NTXT("STOPPED"), /* LMS_STOPPED */ \
170 NTXT("LINUX_CPU"), /* LMS_LINUX_CPU */ \
171 NTXT("KERNEL_CPU") /* LMS_KERNEL_CPU */ \
173 #define LMS_STATE_USTRINGS \
175 GTXT("User CPU"), /* LMS_USER */ \
176 GTXT("System CPU"), /* LMS_SYSTEM */ \
177 GTXT("Trap CPU"), /* LMS_TRAP */ \
178 GTXT("Text Page Fault"), /* LMS_TFAULT */ \
179 GTXT("Data Page Fault"), /* LMS_DFAULT */ \
180 GTXT("Kernel Page Fault"), /* LMS_KFAULT */ \
181 GTXT("User Lock"), /* LMS_USER_LOCK */ \
182 GTXT("Sleep"), /* LMS_SLEEP */ \
183 GTXT("Wait CPU"), /* LMS_WAIT_CPU */ \
184 GTXT("Stopped"), /* LMS_STOPPED */ \
185 GTXT("User+System CPU"), /* LMS_LINUX_CPU */ \
186 GTXT("Kernel CPU") /* LMS_KERNEL_CPU */ \
199 #define HEAPTYPE_STATE_STRINGS \
207 #define HEAPTYPE_STATE_USTRINGS \
261 #define IOTRACETYPE_STATE_STRINGS \
269 NTXT("WRITEERROR"), \
271 NTXT("CLOSEERROR"), \
272 NTXT("OTHERIOERROR") \
274 #define IOTRACETYPE_STATE_USTRINGS \
281 GTXT("Read error"), \
282 GTXT("Write error"), \
283 GTXT("Open error"), \
284 GTXT("Close error"), \
285 GTXT("Other I/O error") \
288 // the type of racing memory access with redundance flag
298 typedef struct Frame_packet
300 unsigned int tsize
: 16; /* packet size */
301 unsigned int type
: 16;
302 uint32_t hsize
; /* header size */
303 uint64_t uid
; /* unique id (experiment wide) */
306 typedef struct Uid_packet
308 unsigned int tsize
: 16; /* packet size */
309 unsigned int type
: 16;
311 uint64_t uid
; /* unique id (experiment wide) */
315 * Components of the variable part of Frame_packet
317 typedef struct Common_info
319 unsigned int hsize
; /* size of this info */
321 uint64_t uid
; /* unique id of this info if any */
324 typedef struct Stack_info
325 { /* Native call stack */
331 typedef struct Java_info
332 { /* Java call stack */
338 typedef struct OMP_info
339 { /* OMP thread state */
346 typedef struct OMP2_info
347 { /* OpenMP user call stack */
355 /* OMP thread states as recorded in the experiment */
356 /* Definition of values stored in the experiment PROP_OMPSTATE field */
358 /* Can be used with OMP_THR_STATE_STRINGS (below) */
361 OMP_NO_STATE
= 0, /* Not initialized */
362 OMP_OVHD_STATE
, /* Overhead */
363 OMP_WORK_STATE
, /* Useful work, excluding reduction, master, single, critical */
364 OMP_IBAR_STATE
, /* In an implicit barrier */
365 OMP_EBAR_STATE
, /* In an explicit barrier */
366 OMP_IDLE_STATE
, /* Slave waiting */
367 OMP_SERL_STATE
, /* User OMPead not in any OMP parallel region */
368 OMP_RDUC_STATE
, /* Reduction */
369 OMP_LKWT_STATE
, /* Waiting for lock */
370 OMP_CTWT_STATE
, /* Waiting to enter critical section */
371 OMP_ODWT_STATE
, /* Waiting to execute an ordered section */
372 OMP_ATWT_STATE
, /* Wait for atomic */
373 OMP_TSKWT_STATE
, /* Task wait */
376 #define OMP_THR_STATE_STRINGS \
378 NTXT("NO"), /* OMP_NO_STATE */ \
379 NTXT("OVHD"), /* OMP_OVHD_STATE */ \
380 NTXT("WORK"), /* OMP_WORK_STATE */ \
381 NTXT("IBAR"), /* OMP_IBAR_STATE */ \
382 NTXT("EBAR"), /* OMP_EBAR_STATE */ \
383 NTXT("IDLE"), /* OMP_IDLE_STATE */ \
384 NTXT("SERL"), /* OMP_SERL_STATE */ \
385 NTXT("RDUC"), /* OMP_RDUC_STATE */ \
386 NTXT("LKWT"), /* OMP_LKWT_STATE */ \
387 NTXT("CTWT"), /* OMP_CTWT_STATE */ \
388 NTXT("ODWT"), /* OMP_ODWT_STATE */ \
389 NTXT("ATWT"), /* OMP_ATWT_STATE */ \
390 NTXT("TSKWT") /* OMP_TSKWT_STATE */ \
392 #define OMP_THR_STATE_USTRINGS \
394 GTXT("None"), /* OMP_NO_STATE */ \
395 GTXT("Overhead"), /* OMP_OVHD_STATE */ \
396 GTXT("Work"), /* OMP_WORK_STATE */ \
397 GTXT("Implicit Barrier"), /* OMP_IBAR_STATE */ \
398 GTXT("Explicit Barrier"), /* OMP_EBAR_STATE */ \
399 GTXT("Idle"), /* OMP_IDLE_STATE */ \
400 GTXT("Serial"), /* OMP_SERL_STATE */ \
401 GTXT("Reduction"), /* OMP_RDUC_STATE */ \
402 GTXT("Lock Wait"), /* OMP_LKWT_STATE */ \
403 GTXT("Critical Section Wait"), /* OMP_CTWT_STATE */ \
404 GTXT("Ordered Section Wait"), /* OMP_ODWT_STATE */ \
405 GTXT("Atomic Wait"), /* OMP_ATWT_STATE */ \
406 GTXT("Task Wait") /* OMP_TSKWT_STATE */ \
409 /* sub-packet for MPI state information */
410 typedef struct MPI_info
411 { /* MPI thread state */
418 /* MPI thread states, as recorded in the experiment */
421 MPI_NO_STATE
= 0, /* Not initialized */
422 MPI_USER
, /* Executing user code, not in MPI */
423 MPI_PROG
, /* Executing in the MPI library (progressing) */
424 MPI_WAIT
/* Waiting in the MPI library */
428 * Dyntext file structure
438 typedef struct DT_common
444 typedef struct DT_header
448 hrtime_t time
; /* time of loading */
452 typedef struct DT_code
458 typedef struct DT_ltable
464 typedef struct DT_lineno
470 typedef struct DT_srcfile
477 * Archive file structure
479 #define ARCH_VERSION 0x100 /* version 1.0 */
481 /* For compatibility with older archives append new types only */
484 ARCH_SEGMENT_TYPE
= 1,
497 ARCH_JCLASS_LOCATION_TYPE
500 #define ARCH_TYPE(x,y) ((ARCH_##x##_TYPE<<8)|y)
504 unsigned int type
: 16;
505 unsigned int size
: 16;
508 /* The maximum value that fits into ARCH_common.size */
509 #define ARCH_MAX_SIZE 0xffff
511 #define ARCH_SEGMENT ARCH_TYPE(SEGMENT, 0)
518 uint32_t textsz
; /* text segment size */
519 uint32_t platform
; /* sparc, intel, etc. */
522 #define ARCH_MSG ARCH_TYPE(MSG, 0)
530 #define ARCH_INF ARCH_TYPE(INF, 0)
537 #define ARCH_MODULE ARCH_TYPE(MODULE, 0)
542 unsigned int lang_code
;
543 unsigned int fragmented
;
546 #define ARCH_FUNCTION ARCH_TYPE(FUNCTION, 0)
556 #define ARCH_LDINSTR ARCH_TYPE(LDINSTR, 0)
557 #define ARCH_STINSTR ARCH_TYPE(STINSTR, 0)
558 #define ARCH_PREFETCH ARCH_TYPE(PREFETCH, 0)
559 #define ARCH_BRTARGET ARCH_TYPE(BRTARGET, 0)
566 #define ARCH_JCLASS_LOCATION ARCH_TYPE(JCLASS_LOCATION, 3)
573 } ARCH_jclass_location
;
575 #define ARCH_JCLASS ARCH_TYPE(JCLASS, 3)
585 #define ARCH_JMETHOD ARCH_TYPE(JMETHOD, 3)
595 #endif /* _DATA_PCKTS_H */