Skip to content
Snippets Groups Projects
Commit a911e01c authored by fu5520tp's avatar fu5520tp
Browse files

return counted instructions in procfs

parent 6bc5a61b
No related branches found
No related tags found
No related merge requests found
......@@ -173,6 +173,7 @@ static struct task_struct * pick_next_task_pb(struct rq *rq,
// see 'perf_event_release_kernel(struct perf_event *event)' in core.c
pb->plan[c_entry_curr].perf_event = NULL;
pb->plan[c_entry_curr].n_instr_counted = perf_counter;
if (perf_counter < pb->plan[c_entry_curr].n_instr) {
u64 under_time = pb->plan[c_entry_curr].n_instr - perf_counter;
......@@ -305,13 +306,16 @@ static int show_pbsched(struct seq_file *seq, void *v)
char mode;
struct rq *rq;
struct pb_rq *pb;
// perf event stuff here is for testing and will be deleted in the future
struct perf_event *event;
int perf_init_res;
u64 perf_counter;
u64 read_error;
int i;
struct plan_entry *plan;
cpu = (unsigned long)(v - 2);
rq = cpu_rq(cpu);
pb = &(rq->pb);
......@@ -344,6 +348,33 @@ static int show_pbsched(struct seq_file *seq, void *v)
pb->count_pb_cycles,
pb->count_admin_cycles
);
/* plan stats */
if(pb->size){
seq_printf(seq, "\ntask_id n_instr n_instr_counted\n");
plan = pb->plan;
for (i=0; i < pb->size; i++){
// only print completed tasks, after completion is_initialized is 0 and we can print the last
if(i<pb->c_entry || !pb->is_initialized){
seq_printf(seq,
"%llu %llu %llu\n",
plan[i].task_id,
plan[i].n_instr,
plan[i].n_instr_counted
);
}else{
seq_printf(seq,
"%llu %llu queued\n",
plan[i].task_id,
plan[i].n_instr
);
}
}
}
}
return 0;
}
......
......@@ -529,6 +529,7 @@ struct plan_entry
u64 task_id;
struct task_struct *task_struct; // linux task struct
struct perf_event *perf_event;
u64 n_instr_counted; // number of instructions we counted for the entry
};
struct pb_init_struct
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment