#include <ltt/event.h>
#include <ltt/time.h>
-#include <ltt/type.h>
#include <ltt/trace.h>
#include <lttv/lttv.h>
static void cpu_set_line_color(PropertiesLine *prop_line, LttvCPUState *s)
{
- GQuark present_state = ((GQuark*)s->mode_stack->data)[s->mode_stack->len-1];
+ GQuark present_state;
+
+ if(s->mode_stack->len == 0)
+ present_state = LTTV_CPU_UNKNOWN;
+ else
+ present_state = ((GQuark*)s->mode_stack->data)[s->mode_stack->len-1];
if(present_state == LTTV_CPU_IDLE) {
prop_line->color = drawing_colors_cpu[COL_CPU_IDLE];
static void irq_set_line_color(PropertiesLine *prop_line, LttvIRQState *s)
{
- GQuark present_state = ((GQuark*)s->mode_stack->data)[s->mode_stack->len-1];
+ GQuark present_state;
+ if(s->mode_stack->len == 0)
+ present_state = LTTV_IRQ_UNKNOWN;
+ else
+ present_state = ((GQuark*)s->mode_stack->data)[s->mode_stack->len-1];
- if(present_state == LTTV_IRQ_UNKNOWN) {
- prop_line->color = drawing_colors_irq[COL_IRQ_UNKNOWN];
- }
- else if(present_state == LTTV_IRQ_IDLE) {
+ if(present_state == LTTV_IRQ_IDLE) {
prop_line->color = drawing_colors_irq[COL_IRQ_IDLE];
}
else if(present_state == LTTV_IRQ_BUSY) {
prop_line->color = drawing_colors_irq[COL_IRQ_BUSY];
}
+ else {
+ prop_line->color = drawing_colors_irq[COL_IRQ_UNKNOWN];
+ }
}
static void bdev_set_line_color(PropertiesLine *prop_line, LttvBdevState *s)
{
- GQuark present_state = ((GQuark*)s->mode_stack->data)[s->mode_stack->len-1];
+ GQuark present_state;
+ if(s == 0 || s->mode_stack->len == 0)
+ present_state = LTTV_BDEV_UNKNOWN;
+ else
+ present_state = ((GQuark*)s->mode_stack->data)[s->mode_stack->len-1];
- if(present_state == LTTV_BDEV_UNKNOWN) {
- prop_line->color = drawing_colors_bdev[COL_BDEV_UNKNOWN];
- }
- else if(present_state == LTTV_BDEV_IDLE) {
+ if(present_state == LTTV_BDEV_IDLE) {
prop_line->color = drawing_colors_bdev[COL_BDEV_IDLE];
}
else if(present_state == LTTV_BDEV_BUSY_READING) {
else if(present_state == LTTV_BDEV_BUSY_WRITING) {
prop_line->color = drawing_colors_bdev[COL_BDEV_BUSY_WRITING];
}
+ else {
+ prop_line->color = drawing_colors_bdev[COL_BDEV_UNKNOWN];
+ }
}
/* before_schedchange_hook
int before_schedchange_hook(void *hook_data, void *call_data)
{
- LttvTraceHookByFacility *thf = (LttvTraceHookByFacility*)hook_data;
- EventsRequest *events_request = (EventsRequest*)thf->hook_data;
+ LttvTraceHook *th = (LttvTraceHook*)hook_data;
+ EventsRequest *events_request = (EventsRequest*)th->hook_data;
ControlFlowData *control_flow_data = events_request->viewer_data;
LttvTracefileContext *tfc = (LttvTracefileContext *)call_data;
guint pid_out;
guint pid_in;
- pid_out = ltt_event_get_long_unsigned(e, thf->f1);
- pid_in = ltt_event_get_long_unsigned(e, thf->f2);
+ pid_out = ltt_event_get_long_unsigned(e, th->f1);
+ pid_in = ltt_event_get_long_unsigned(e, th->f2);
// if(pid_in != 0 && pid_out != 0) {
// /* not a transition to/from idle */
// return 0;
width,
&x);
-
/* Jump over draw if we are at the same x position */
if(x == hashed_process_data->x.middle &&
hashed_process_data->x.middle_used)
*/
int after_schedchange_hook(void *hook_data, void *call_data)
{
- LttvTraceHookByFacility *thf = (LttvTraceHookByFacility*)hook_data;
- EventsRequest *events_request = (EventsRequest*)thf->hook_data;
+ LttvTraceHook *th = (LttvTraceHook*)hook_data;
+ EventsRequest *events_request = (EventsRequest*)th->hook_data;
ControlFlowData *control_flow_data = events_request->viewer_data;
LttvTracefileContext *tfc = (LttvTracefileContext *)call_data;
guint pid_in;
{
guint pid_out;
- pid_out = ltt_event_get_long_unsigned(e, thf->f1);
- pid_in = ltt_event_get_long_unsigned(e, thf->f2);
+ pid_out = ltt_event_get_long_unsigned(e, th->f1);
+ pid_in = ltt_event_get_long_unsigned(e, th->f2);
}
int before_execmode_hook(void *hook_data, void *call_data)
{
- LttvTraceHookByFacility *thf = (LttvTraceHookByFacility*)hook_data;
- EventsRequest *events_request = (EventsRequest*)thf->hook_data;
+ LttvTraceHook *th = (LttvTraceHook*)hook_data;
+ EventsRequest *events_request = (EventsRequest*)th->hook_data;
ControlFlowData *control_flow_data = events_request->viewer_data;
LttvTracefileContext *tfc = (LttvTracefileContext *)call_data;
int before_execmode_hook_irq(void *hook_data, void *call_data)
{
- LttvTraceHookByFacility *thf = (LttvTraceHookByFacility*)hook_data;
- EventsRequest *events_request = (EventsRequest*)thf->hook_data;
+ LttvTraceHook *th = (LttvTraceHook*)hook_data;
+ EventsRequest *events_request = (EventsRequest*)th->hook_data;
ControlFlowData *control_flow_data = events_request->viewer_data;
LttvTracefileContext *tfc = (LttvTracefileContext *)call_data;
guint8 ev_id_exit = ltt_eventtype_id(ltt_facility_eventtype_get_by_name(ev_facility, LTT_EVENT_IRQ_EXIT));
if(ltt_facility_name(ev_facility) == LTT_FACILITY_KERNEL &&
ev_id_entry == ltt_event_eventtype_id(e)) {
- irq = ltt_event_get_long_unsigned(e, thf->f1);
+ irq = ltt_event_get_long_unsigned(e, th->f1);
}
else if(ltt_facility_name(ev_facility) == LTT_FACILITY_KERNEL &&
ev_id_exit == ltt_event_eventtype_id(e)) {
{
gchar *irqstr;
- irqstr = g_strdup_printf("IRQ %u", irq);
+ irqstr = g_strdup_printf("IRQ %llu [%s]", irq, g_quark_to_string(ts->irq_names[irq]));
resourceq = g_quark_from_string(irqstr);
g_free(irqstr);
}
int before_bdev_event_hook(void *hook_data, void *call_data)
{
- LttvTraceHookByFacility *thf = (LttvTraceHookByFacility*)hook_data;
- EventsRequest *events_request = (EventsRequest*)thf->hook_data;
+ LttvTraceHook *th = (LttvTraceHook*)hook_data;
+ EventsRequest *events_request = (EventsRequest*)th->hook_data;
ControlFlowData *control_flow_data = events_request->viewer_data;
LttvTracefileContext *tfc = (LttvTracefileContext *)call_data;
/* For the pid */
guint cpu = tfs->cpu;
- guint8 major = ltt_event_get_long_unsigned(e, thf->f1);
- guint8 minor = ltt_event_get_long_unsigned(e, thf->f2);
- guint oper = ltt_event_get_long_unsigned(e, thf->f3);
+ guint8 major = ltt_event_get_long_unsigned(e, th->f1);
+ guint8 minor = ltt_event_get_long_unsigned(e, th->f2);
+ guint oper = ltt_event_get_long_unsigned(e, th->f3);
gint devcode_gint = MKDEV(major,minor);
{
guint trace_num = ts->parent.index;
LttvBdevState *bdev = g_hash_table_lookup(ts->bdev_states, &devcode_gint);
- g_assert(bdev != NULL);
+ /* the result of the lookup might be NULL. that's ok, the rest of the function
+ should understand it was not found and that its state is unknown */
// guint pid = process->pid;
irq_set_line_color(&prop_line, &ts->irq_states[process_info->id]);
else if(process_info->type == 2) {
gint devcode_gint = process_info->id;
- LttvBdevState *bdev = g_hash_table_lookup(ts->bdev_states, &devcode_gint);
+ LttvBdevState *bdev = g_hash_table_lookup(ts->bdev_states, &devcode_gint);
+ // the lookup may return null; bdev_set_line_color must act appropriately
bdev_set_line_color(&prop_line, bdev);
}
*/
int before_statedump_end(void *hook_data, void *call_data)
{
- LttvTraceHookByFacility *thf = (LttvTraceHookByFacility*)hook_data;
- EventsRequest *events_request = (EventsRequest*)thf->hook_data;
+ LttvTraceHook *th = (LttvTraceHook*)hook_data;
+ EventsRequest *events_request = (EventsRequest*)th->hook_data;
ControlFlowData *control_flow_data = events_request->viewer_data;
LttvTracefileContext *tfc = (LttvTracefileContext *)call_data;