Write multiple prv files and add app id view

This commit is contained in:
Rodrigo Arias 2021-08-03 18:42:56 +02:00
parent 60862db890
commit 4e971bceff
10 changed files with 412 additions and 17 deletions

236
cfg/cpu.cfg Normal file
View File

@ -0,0 +1,236 @@
#ParaverCFG
ConfigFile.Version: 3.4
ConfigFile.NumWindows: 6
################################################################################
< NEW DISPLAYING WINDOW CPU: PID >
################################################################################
window_name CPU: PID
window_type single
window_id 1
window_position_x 0
window_position_y 376
window_width 954
window_height 148
window_comm_lines_enabled true
window_flags_enabled true
window_noncolor_mode true
window_logical_filtered true
window_physical_filtered false
window_comm_fromto true
window_comm_tagsize true
window_comm_typeval true
window_units Microseconds
window_maximum_y 426131.000000000000
window_minimum_y 1.000000000000
window_compute_y_max false
window_level thread
window_scale_relative 1.000000000000
window_end_time_relative 1.000000000000
window_object appl { 1, { All } }
window_begin_time_relative 0.000000000000
window_open true
window_drawmode draw_maximum
window_drawmode_rows draw_maximum
window_pixel_size 1
window_labels_to_draw 1
window_selected_functions { 14, { {cpu, Active Thd}, {appl, Adding}, {task, Adding}, {thread, Last Evt Val}, {node, Adding}, {system, Adding}, {workload, Adding}, {from_obj, All}, {to_obj, All}, {tag_msg, All}, {size_msg, All}, {bw_msg, All}, {evt_type, =}, {evt_value, All} } }
window_compose_functions { 9, { {compose_cpu, As Is}, {compose_appl, As Is}, {compose_task, As Is}, {compose_thread, As Is}, {compose_node, As Is}, {compose_system, As Is}, {compose_workload, As Is}, {topcompose1, As Is}, {topcompose2, As Is} } }
window_filter_module evt_type 1 10
window_filter_module evt_type_label 1 "Unknown"
window_synchronize 1
################################################################################
< NEW DISPLAYING WINDOW CPU: Task ID >
################################################################################
window_name CPU: Task ID
window_type single
window_id 2
window_position_x 0
window_position_y 200
window_width 954
window_height 149
window_comm_lines_enabled true
window_flags_enabled true
window_noncolor_mode true
window_logical_filtered true
window_physical_filtered false
window_comm_fromto true
window_comm_tagsize true
window_comm_typeval true
window_units Microseconds
window_maximum_y 21.000000000000
window_minimum_y 1.000000000000
window_compute_y_max false
window_level thread
window_scale_relative 1.000000000000
window_end_time_relative 1.000000000000
window_object appl { 1, { All } }
window_begin_time_relative 0.000000000000
window_open true
window_drawmode draw_maximum
window_drawmode_rows draw_maximum
window_pixel_size 1
window_labels_to_draw 1
window_selected_functions { 14, { {cpu, Active Thd}, {appl, Adding}, {task, Adding}, {thread, Last Evt Val}, {node, Adding}, {system, Adding}, {workload, Adding}, {from_obj, All}, {to_obj, All}, {tag_msg, All}, {size_msg, All}, {bw_msg, All}, {evt_type, =}, {evt_value, All} } }
window_compose_functions { 9, { {compose_cpu, As Is}, {compose_appl, As Is}, {compose_task, As Is}, {compose_thread, As Is}, {compose_node, As Is}, {compose_system, As Is}, {compose_workload, As Is}, {topcompose1, As Is}, {topcompose2, As Is} } }
window_filter_module evt_type 1 20
window_filter_module evt_type_label 1 "Unknown"
window_synchronize 1
################################################################################
< NEW DISPLAYING WINDOW CPU: Task Type ID >
################################################################################
window_name CPU: Task Type ID
window_type single
window_id 3
window_position_x 0
window_position_y 901
window_width 954
window_height 148
window_comm_lines_enabled true
window_flags_enabled true
window_noncolor_mode true
window_color_mode window_in_null_gradient_mode
window_logical_filtered true
window_physical_filtered false
window_comm_fromto true
window_comm_tagsize true
window_comm_typeval true
window_units Microseconds
window_maximum_y 2.000000000000
window_minimum_y 1.000000000000
window_compute_y_max false
window_level thread
window_scale_relative 1.000000000000
window_end_time_relative 1.000000000000
window_object appl { 1, { All } }
window_begin_time_relative 0.000000000000
window_open true
window_drawmode draw_maximum
window_drawmode_rows draw_maximum
window_pixel_size 1
window_labels_to_draw 1
window_selected_functions { 14, { {cpu, Active Thd}, {appl, Adding}, {task, Adding}, {thread, Last Evt Val}, {node, Adding}, {system, Adding}, {workload, Adding}, {from_obj, All}, {to_obj, All}, {tag_msg, All}, {size_msg, All}, {bw_msg, All}, {evt_type, =}, {evt_value, All} } }
window_compose_functions { 9, { {compose_cpu, As Is}, {compose_appl, As Is}, {compose_task, As Is}, {compose_thread, As Is}, {compose_node, As Is}, {compose_system, As Is}, {compose_workload, As Is}, {topcompose1, As Is}, {topcompose2, As Is} } }
window_filter_module evt_type 1 21
window_filter_module evt_type_label 1 "Unknown"
window_synchronize 1
################################################################################
< NEW DISPLAYING WINDOW CPU: Number of threads running per CPU >
################################################################################
window_name CPU: Number of threads running per CPU
window_type single
window_id 4
window_position_x 0
window_position_y 726
window_width 954
window_height 148
window_comm_lines_enabled true
window_flags_enabled true
window_noncolor_mode true
window_color_mode window_in_null_gradient_mode
window_logical_filtered true
window_physical_filtered false
window_comm_fromto true
window_comm_tagsize true
window_comm_typeval true
window_units Microseconds
window_maximum_y 5.000000000000
window_minimum_y 1.000000000000
window_compute_y_max false
window_level thread
window_scale_relative 1.000000000000
window_end_time_relative 1.000000000000
window_object appl { 1, { All } }
window_begin_time_relative 0.000000000000
window_open true
window_drawmode draw_maximum
window_drawmode_rows draw_maximum
window_pixel_size 1
window_labels_to_draw 1
window_selected_functions { 14, { {cpu, Active Thd}, {appl, Adding}, {task, Adding}, {thread, Last Evt Val}, {node, Adding}, {system, Adding}, {workload, Adding}, {from_obj, All}, {to_obj, All}, {tag_msg, All}, {size_msg, All}, {bw_msg, All}, {evt_type, =}, {evt_value, All} } }
window_compose_functions { 9, { {compose_cpu, As Is}, {compose_appl, As Is}, {compose_task, As Is}, {compose_thread, As Is}, {compose_node, As Is}, {compose_system, As Is}, {compose_workload, As Is}, {topcompose1, As Is}, {topcompose2, As Is} } }
window_filter_module evt_type 1 12
window_filter_module evt_type_label 1 "Unknown"
window_synchronize 1
################################################################################
< NEW DISPLAYING WINDOW CPU: Thread TID >
################################################################################
window_name CPU: Thread TID
window_type single
window_id 5
window_position_x 0
window_position_y 551
window_width 954
window_height 148
window_comm_lines_enabled true
window_flags_enabled true
window_noncolor_mode true
window_logical_filtered true
window_physical_filtered false
window_comm_fromto true
window_comm_tagsize true
window_comm_typeval true
window_units Microseconds
window_maximum_y 426239.000000000000
window_minimum_y 1.000000000000
window_compute_y_max false
window_level thread
window_scale_relative 1.000000000000
window_end_time_relative 1.000000000000
window_object appl { 1, { All } }
window_begin_time_relative 0.000000000000
window_open true
window_drawmode draw_maximum
window_drawmode_rows draw_maximum
window_pixel_size 1
window_labels_to_draw 1
window_selected_functions { 14, { {cpu, Active Thd}, {appl, Adding}, {task, Adding}, {thread, Last Evt Val}, {node, Adding}, {system, Adding}, {workload, Adding}, {from_obj, All}, {to_obj, All}, {tag_msg, All}, {size_msg, All}, {bw_msg, All}, {evt_type, =}, {evt_value, All} } }
window_compose_functions { 9, { {compose_cpu, As Is}, {compose_appl, As Is}, {compose_task, As Is}, {compose_thread, As Is}, {compose_node, As Is}, {compose_system, As Is}, {compose_workload, As Is}, {topcompose1, As Is}, {topcompose2, As Is} } }
window_filter_module evt_type 1 11
window_filter_module evt_type_label 1 "Unknown"
window_synchronize 1
################################################################################
< NEW DISPLAYING WINDOW CPU: Application ID >
################################################################################
window_name CPU: Application ID
window_type single
window_id 6
window_position_x 0
window_position_y 24
window_width 954
window_height 149
window_comm_lines_enabled true
window_flags_enabled true
window_noncolor_mode true
window_color_mode window_in_null_gradient_mode
window_logical_filtered true
window_physical_filtered false
window_comm_fromto true
window_comm_tagsize true
window_comm_typeval true
window_units Microseconds
window_maximum_y 20.000000000000
window_minimum_y 1.000000000000
window_compute_y_max false
window_level thread
window_scale_relative 1.000000000000
window_end_time_relative 1.000000000000
window_object appl { 1, { All } }
window_begin_time_relative 0.000000000000
window_open true
window_drawmode draw_maximum
window_drawmode_rows draw_maximum
window_pixel_size 1
window_labels_to_draw 1
window_selected_functions { 14, { {cpu, Active Thd}, {appl, Adding}, {task, Adding}, {thread, Last Evt Val}, {node, Adding}, {system, Adding}, {workload, Adding}, {from_obj, All}, {to_obj, All}, {tag_msg, All}, {size_msg, All}, {bw_msg, All}, {evt_type, =}, {evt_value, All} } }
window_compose_functions { 9, { {compose_cpu, As Is}, {compose_appl, As Is}, {compose_task, As Is}, {compose_thread, As Is}, {compose_node, As Is}, {compose_system, As Is}, {compose_workload, As Is}, {topcompose1, As Is}, {topcompose2, As Is} } }
window_filter_module evt_type 1 30
window_filter_module evt_type_label 1 "Unknown"
window_synchronize 1

81
cfg/thread.cfg Normal file
View File

@ -0,0 +1,81 @@
#ParaverCFG
ConfigFile.Version: 3.4
ConfigFile.NumWindows: 2
################################################################################
< NEW DISPLAYING WINDOW Thread: State >
################################################################################
window_name Thread: State
window_type single
window_id 1
window_position_x 960
window_position_y 24
window_width 954
window_height 499
window_comm_lines_enabled true
window_flags_enabled true
window_noncolor_mode true
window_logical_filtered true
window_physical_filtered false
window_comm_fromto true
window_comm_tagsize true
window_comm_typeval true
window_units Microseconds
window_maximum_y 5.000000000000
window_minimum_y 1.000000000000
window_compute_y_max false
window_level thread
window_scale_relative 1.000000000000
window_end_time_relative 1.000000000000
window_object appl { 1, { All } }
window_begin_time_relative 0.000000000000
window_open true
window_drawmode draw_maximum
window_drawmode_rows draw_maximum
window_pixel_size 1
window_labels_to_draw 1
window_selected_functions { 14, { {cpu, Active Thd}, {appl, Adding}, {task, Adding}, {thread, Last Evt Val}, {node, Adding}, {system, Adding}, {workload, Adding}, {from_obj, All}, {to_obj, All}, {tag_msg, All}, {size_msg, All}, {bw_msg, All}, {evt_type, =}, {evt_value, All} } }
window_compose_functions { 9, { {compose_cpu, As Is}, {compose_appl, As Is}, {compose_task, As Is}, {compose_thread, As Is}, {compose_node, As Is}, {compose_system, As Is}, {compose_workload, As Is}, {topcompose1, As Is}, {topcompose2, As Is} } }
window_filter_module evt_type 1 60
window_filter_module evt_type_label 1 "Unknown"
window_synchronize 1
################################################################################
< NEW DISPLAYING WINDOW Thread: TID >
################################################################################
window_name Thread: TID
window_type single
window_id 2
window_position_x 960
window_position_y 550
window_width 954
window_height 499
window_comm_lines_enabled true
window_flags_enabled true
window_noncolor_mode true
window_logical_filtered true
window_physical_filtered false
window_comm_fromto true
window_comm_tagsize true
window_comm_typeval true
window_units Microseconds
window_maximum_y 426239.000000000000
window_minimum_y 426112.000000000000
window_compute_y_max false
window_level thread
window_scale_relative 1.000000000000
window_end_time_relative 1.000000000000
window_object appl { 1, { All } }
window_begin_time_relative 0.000000000000
window_open true
window_drawmode draw_maximum
window_drawmode_rows draw_maximum
window_pixel_size 1
window_labels_to_draw 1
window_selected_functions { 14, { {cpu, Active Thd}, {appl, Adding}, {task, Adding}, {thread, Last Evt Val}, {node, Adding}, {system, Adding}, {workload, Adding}, {from_obj, All}, {to_obj, All}, {tag_msg, All}, {size_msg, All}, {bw_msg, All}, {evt_type, =}, {evt_value, All} } }
window_compose_functions { 9, { {compose_cpu, As Is}, {compose_appl, As Is}, {compose_task, As Is}, {compose_thread, As Is}, {compose_node, As Is}, {compose_system, As Is}, {compose_workload, As Is}, {topcompose1, As Is}, {topcompose2, As Is} } }
window_filter_module evt_type 1 61
window_filter_module evt_type_label 1 "Unknown"
window_synchronize 1

34
emu.c
View File

@ -12,6 +12,7 @@
#include "ovni.h" #include "ovni.h"
#include "ovni_trace.h" #include "ovni_trace.h"
#include "emu.h" #include "emu.h"
#include "prv.h"
static void static void
emit_ev(struct ovni_stream *stream, struct ovni_ev *ev) emit_ev(struct ovni_stream *stream, struct ovni_ev *ev)
@ -345,6 +346,36 @@ destroy_metadata(struct ovni_emu *emu)
return 0; return 0;
} }
static void
open_prvs(struct ovni_emu *emu, char *tracedir)
{
char path[PATH_MAX];
sprintf(path, "%s/%s", tracedir, "thread.prv");
emu->prv_thread = fopen(path, "w");
if(emu->prv_thread == NULL)
abort();
sprintf(path, "%s/%s", tracedir, "cpu.prv");
emu->prv_cpu = fopen(path, "w");
if(emu->prv_cpu == NULL)
abort();
prv_header(emu->prv_thread, emu->trace.nstreams);
prv_header(emu->prv_cpu, emu->total_cpus + 1);
}
static void
close_prvs(struct ovni_emu *emu)
{
fclose(emu->prv_thread);
fclose(emu->prv_cpu);
}
int int
main(int argc, char *argv[]) main(int argc, char *argv[])
@ -371,11 +402,14 @@ main(int argc, char *argv[])
if(load_metadata(&emu) != 0) if(load_metadata(&emu) != 0)
abort(); abort();
open_prvs(&emu, tracedir);
printf("#Paraver (19/01/38 at 03:14):00000000000000000000_ns:0:1:1(%d:1)\n", emu.total_cpus); printf("#Paraver (19/01/38 at 03:14):00000000000000000000_ns:0:1:1(%d:1)\n", emu.total_cpus);
emulate(&emu); emulate(&emu);
close_prvs(&emu);
destroy_metadata(&emu); destroy_metadata(&emu);
ovni_free_streams(&emu.trace); ovni_free_streams(&emu.trace);

4
emu.h
View File

@ -84,6 +84,7 @@ struct ovni_eproc {
int pid; int pid;
int index; int index;
int gindex; int gindex;
int appid;
/* Path of the process tracedir */ /* Path of the process tracedir */
char dir[PATH_MAX]; char dir[PATH_MAX];
@ -189,6 +190,9 @@ struct ovni_emu {
uint64_t lastclock; uint64_t lastclock;
int64_t delta_time; int64_t delta_time;
FILE *prv_thread;
FILE *prv_cpu;
/* Total counters */ /* Total counters */
int total_thread; int total_thread;
int total_proc; int total_proc;

View File

@ -240,6 +240,7 @@ emit_task_running(struct ovni_emu *emu, struct nosv_task *task)
{ {
prv_ev_autocpu(emu, PTC_TASK_ID, task->id + 1); prv_ev_autocpu(emu, PTC_TASK_ID, task->id + 1);
prv_ev_autocpu(emu, PTC_TASK_TYPE_ID, task->type_id + 1); prv_ev_autocpu(emu, PTC_TASK_TYPE_ID, task->type_id + 1);
prv_ev_autocpu(emu, PTC_APP_ID, emu->cur_proc->appid + 1);
} }
static void static void
@ -247,6 +248,7 @@ emit_task_not_running(struct ovni_emu *emu, struct nosv_task *task)
{ {
prv_ev_autocpu(emu, PTC_TASK_ID, 0); prv_ev_autocpu(emu, PTC_TASK_ID, 0);
prv_ev_autocpu(emu, PTC_TASK_TYPE_ID, 0); prv_ev_autocpu(emu, PTC_TASK_TYPE_ID, 0);
prv_ev_autocpu(emu, PTC_APP_ID, 0);
} }
static void static void

View File

@ -271,12 +271,12 @@ emit_thread_state(struct ovni_emu *emu)
row = emu->cur_thread->gindex + 1; row = emu->cur_thread->gindex + 1;
tid = emu->cur_thread->tid; tid = emu->cur_thread->tid;
prv_ev_row(emu, row, PTT_THREAD_STATE, st); prv_ev_thread(emu, row, PTT_THREAD_STATE, st);
if(st == TH_ST_RUNNING) if(st == TH_ST_RUNNING)
prv_ev_row(emu, row, PTT_THREAD_TID, tid); prv_ev_thread(emu, row, PTT_THREAD_TID, tid);
else else
prv_ev_row(emu, row, PTT_THREAD_TID, 0); prv_ev_thread(emu, row, PTT_THREAD_TID, 0);
} }
static void static void
@ -297,13 +297,13 @@ emit_thread_count(struct ovni_emu *emu)
/* Start at 1 */ /* Start at 1 */
row = i + 1; row = i + 1;
n = loom->cpu[i].nthreads; n = loom->cpu[i].nthreads;
prv_ev_row(emu, row, PTC_NTHREADS, n); prv_ev_cpu(emu, row, PTC_NTHREADS, n);
pid = n == 1 ? loom->cpu[i].thread[0]->proc->pid : 1; pid = n == 1 ? loom->cpu[i].thread[0]->proc->pid : 1;
prv_ev_row(emu, row, PTC_PROC_PID, pid); prv_ev_cpu(emu, row, PTC_PROC_PID, pid);
tid = n == 1 ? loom->cpu[i].thread[0]->tid : 1; tid = n == 1 ? loom->cpu[i].thread[0]->tid : 1;
prv_ev_row(emu, row, PTC_THREAD_TID, tid); prv_ev_cpu(emu, row, PTC_THREAD_TID, tid);
} }
} }
@ -313,13 +313,13 @@ emit_thread_count(struct ovni_emu *emu)
/* Place the virtual CPU after the physical CPUs */ /* Place the virtual CPU after the physical CPUs */
row = loom->ncpus + 1; row = loom->ncpus + 1;
n = loom->vcpu.nthreads; n = loom->vcpu.nthreads;
prv_ev_row(emu, row, PTC_NTHREADS, n); prv_ev_cpu(emu, row, PTC_NTHREADS, n);
pid = n == 1 ? loom->vcpu.thread[0]->proc->pid : 1; pid = n == 1 ? loom->vcpu.thread[0]->proc->pid : 1;
prv_ev_row(emu, row, PTC_PROC_PID, pid); prv_ev_cpu(emu, row, PTC_PROC_PID, pid);
tid = n == 1 ? loom->vcpu.thread[0]->tid : 1; tid = n == 1 ? loom->vcpu.thread[0]->tid : 1;
prv_ev_row(emu, row, PTC_THREAD_TID, tid); prv_ev_cpu(emu, row, PTC_THREAD_TID, tid);
} }
} }

16
ovni.c
View File

@ -617,6 +617,18 @@ load_thread(struct ovni_ethread *thread, struct ovni_eproc *proc, int index, int
return 0; return 0;
} }
static void
load_proc_metadata(struct ovni_eproc *proc)
{
JSON_Object *meta;
meta = json_value_get_object(proc->meta);
assert(meta);
proc->appid = (int) json_object_get_number(meta, "app_id");
}
static int static int
load_proc(struct ovni_eproc *proc, int index, int pid, char *procdir) load_proc(struct ovni_eproc *proc, int index, int pid, char *procdir)
{ {
@ -634,9 +646,11 @@ load_proc(struct ovni_eproc *proc, int index, int pid, char *procdir)
sprintf(path, "%s/%s", procdir, "metadata.json"); sprintf(path, "%s/%s", procdir, "metadata.json");
proc->meta = json_parse_file_with_comments(path); proc->meta = json_parse_file_with_comments(path);
assert(proc->meta); assert(proc->meta);
/* The appid is populated from the metadata */
load_proc_metadata(proc);
if((dir = opendir(procdir)) == NULL) if((dir = opendir(procdir)) == NULL)
{ {
fprintf(stderr, "opendir %s failed: %s\n", fprintf(stderr, "opendir %s failed: %s\n",

View File

@ -124,5 +124,7 @@ int main(int argc, char *argv[])
ovni_free_streams(&trace); ovni_free_streams(&trace);
fflush(stdout);
return 0; return 0;
} }

23
prv.c
View File

@ -5,10 +5,21 @@
#include "emu.h" #include "emu.h"
void void
prv_ev_row(struct ovni_emu *emu, int row, int type, int val) prv_ev(FILE *f, int row, int64_t time, int type, int val)
{ {
printf("2:0:1:1:%d:%ld:%d:%d\n", fprintf(f, "2:0:1:1:%d:%ld:%d:%d\n", row, time, type, val);
row, emu->delta_time, type, val); }
void
prv_ev_thread(struct ovni_emu *emu, int row, int type, int val)
{
prv_ev(emu->prv_thread, row, emu->delta_time, type, val);
}
void
prv_ev_cpu(struct ovni_emu *emu, int row, int type, int val)
{
prv_ev(emu->prv_cpu, row, emu->delta_time, type, val);
} }
void void
@ -27,11 +38,11 @@ prv_ev_autocpu(struct ovni_emu *emu, int type, int val)
/* Begin at 1 */ /* Begin at 1 */
row = cpu->i + 1; row = cpu->i + 1;
prv_ev_row(emu, row, type, val); prv_ev_cpu(emu, row, type, val);
} }
void void
prv_header(struct ovni_emu *emu, int nrows) prv_header(FILE *f, int nrows)
{ {
printf("#Paraver (19/01/38 at 03:14):00000000000000000000_ns:0:1:1(%d:1)\n", nrows); fprintf(f, "#Paraver (19/01/38 at 03:14):00000000000000000000_ns:0:1:1(%d:1)\n", nrows);
} }

13
prv.h
View File

@ -9,16 +9,27 @@ enum prv_type {
PTC_NTHREADS = 12, PTC_NTHREADS = 12,
PTC_TASK_ID = 20, PTC_TASK_ID = 20,
PTC_TASK_TYPE_ID = 21, PTC_TASK_TYPE_ID = 21,
PTC_APP_ID = 30,
/* Rows are threads */ /* Rows are threads */
PTT_THREAD_STATE = 60, PTT_THREAD_STATE = 60,
PTT_THREAD_TID = 61, PTT_THREAD_TID = 61,
}; };
void
prv_ev(FILE *f, int row, int64_t time, int type, int val);
void
prv_ev_thread(struct ovni_emu *emu, int row, int type, int val);
void
prv_ev_cpu(struct ovni_emu *emu, int row, int type, int val);
void void
prv_ev_autocpu(struct ovni_emu *emu, int type, int val); prv_ev_autocpu(struct ovni_emu *emu, int type, int val);
void void
prv_ev_row(struct ovni_emu *emu, int row, int type, int val); prv_header(FILE *f, int nrows);
#endif /* OVNI_PRV_H */ #endif /* OVNI_PRV_H */