Skip to content

Commit

Permalink
share sample kinds definition between sampler and dump utility code
Browse files Browse the repository at this point in the history
  • Loading branch information
jmalak committed Nov 16, 2018
1 parent a8dd19c commit f2236ab
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 21 deletions.
13 changes: 3 additions & 10 deletions bld/wsample/dump/smpdump.c
Original file line number Diff line number Diff line change
Expand Up @@ -53,16 +53,9 @@
#define COND_SWAP_32( a ) if( byte_swap ) SWAP_32( a );

char *Types[] = {
"INFO:",
"SAMPLES:",
"MARK:",
"OVL_LOAD:",
"CODE_LOAD:",
"ADDR_MAP:",
"MAIN_LOAD:",
"LAST:",
"REMAP_SECTIONS:",
"CALLGRAPH:",
#define pick(k) # k ":",
SAMPLEKINDS()
#undef pick
""
};

Expand Down
27 changes: 16 additions & 11 deletions bld/wsample/h/sample.h
Original file line number Diff line number Diff line change
Expand Up @@ -88,18 +88,23 @@ typedef struct samp_header {
} samp_header;
#define SIZE_HEADER (sizeof( samp_header ))

#define SAMPLEKINDS() \
pick( INFO ) /* statistics for sample file */ \
pick( SAMPLES ) /* actual CS:EIP samples */ \
pick( MARK ) /* a character string occurring at a certain time */ \
pick( OVL_LOAD ) /* an overlay section was loaded */ \
pick( CODE_LOAD ) /* executable file loaded */ \
pick( ADDR_MAP ) /* translation from map addr's to loaded code addr' */ \
pick( MAIN_LOAD ) /* main executable file loaded */ \
pick( LAST ) /* always the last block */ \
pick( REMAP_SECTION ) /* overlay section(s) have moved in memory */ \
pick( CALLGRAPH ) /* callgraph information for samples */

typedef enum samp_block_kinds {
SAMP_INFO = 0, /* statistics for sample file */
SAMP_SAMPLES = 1, /* actual CS:EIP samples */
SAMP_MARK = 2, /* a character string occurring at a certain time */
SAMP_OVL_LOAD = 3, /* an overlay section was loaded */
SAMP_CODE_LOAD = 4, /* executable file loaded */
SAMP_ADDR_MAP = 5, /* translation from map addr's to loaded code addr' */
SAMP_MAIN_LOAD = 6, /* main executable file loaded */
SAMP_LAST = 7, /* always the last block */
SAMP_REMAP_SECTION = 8, /* overlay section(s) have moved in memory */
SAMP_CALLGRAPH = 9, /* callgraph information for samples */
NUM_BLOCK_KINDS = 10
#define pick(k) SAMP_ ## k,
SAMPLEKINDS()
#undef pick
NUM_BLOCK_KINDS
} samp_block_kinds;


Expand Down

0 comments on commit f2236ab

Please sign in to comment.