Skip to content

Commit

Permalink
sched_switch added
Browse files Browse the repository at this point in the history
  • Loading branch information
rmeena840 committed Jul 23, 2019
1 parent a9e7c34 commit fac8736
Showing 1 changed file with 14 additions and 16 deletions.
30 changes: 14 additions & 16 deletions misc/record/record-main.c
Expand Up @@ -190,8 +190,20 @@ const char *input_file, bool input_file_flag )

static void print_item( client_context *cctx, const client_item *item )
{

if( cctx->event_counter % 2 == 0 ){
// getting prev_* values
char item_data_str[256];
snprintf( item_data_str, sizeof( item_data_str ), "%08"PRIx64, item->data );
memcpy( cctx->sched_switch[ item->cpu ].prev_comm, item_data_str,
sizeof( cctx->sched_switch[ item->cpu ].prev_comm ) );
cctx->sched_switch[ item->cpu ].prev_tid = item->data;
cctx->sched_switch[ item->cpu ].prev_prio = 0;
cctx->sched_switch[ item->cpu ].prev_state = 0;

cctx->cpu_id = item->cpu;
cctx->ns = item->ns;

}else {
event_header_extended event_header_extended;
char item_data_str[256];
FILE **f = cctx->event_streams;
Expand All @@ -217,30 +229,16 @@ static void print_item( client_context *cctx, const client_item *item )
fwrite( &cctx->sched_switch[ cctx->cpu_id ], sizeof( cctx->sched_switch[ cctx->cpu_id ] ),
1, f[ cctx->cpu_id ] );

// adding current data of record item
snprintf( item_data_str, sizeof( item_data_str ), "%08"PRIx64, item->data );
memcpy( cctx->sched_switch[ item->cpu ].prev_comm, item_data_str,
sizeof( cctx->sched_switch[ item->cpu ].prev_comm ) );
sizeof( cctx->sched_switch[ item->cpu ].prev_comm ) );
cctx->sched_switch[ item->cpu ].prev_tid = item->data;
cctx->sched_switch[ item->cpu ].prev_prio = 0;
cctx->sched_switch[ item->cpu ].prev_state = 0;

cctx->cpu_id = item->cpu;
cctx->ns = item->ns;

}else if( cctx->event_counter == 1 ){

// first record item received
char item_data_str[256];
snprintf( item_data_str, sizeof( item_data_str ), "%08"PRIx64, item->data );
memcpy( cctx->sched_switch[ item->cpu ].prev_comm, item_data_str,
sizeof( cctx->sched_switch[ item->cpu ].prev_comm ) );
cctx->sched_switch[ item->cpu ].prev_tid = item->data;
cctx->sched_switch[ item->cpu ].prev_prio = 0;
cctx->sched_switch[ item->cpu ].prev_state = 0;

cctx->cpu_id = item->cpu;
cctx->ns = item->ns;
}

cctx->event_counter++;
Expand Down

0 comments on commit fac8736

Please sign in to comment.