LTTV_STATE_NAME_TABLES,
LTTV_STATE_TRACE_STATE_USE_COUNT,
LTTV_STATE_RESOURCE_CPUS,
+ LTTV_STATE_RESOURCE_CPUS_COUNT,
LTTV_STATE_RESOURCE_IRQS,
LTTV_STATE_RESOURCE_BLKDEVS;
g_hash_table_destroy(usertraces);
}
-
+gboolean rettrue(gpointer key, gpointer value, gpointer user_data)
+{
+ return TRUE;
+}
static void
restore_init_state(LttvTraceState *self)
/* reset bdev states */
g_hash_table_foreach(self->bdev_states, bdevstate_free_cb, NULL);
- g_hash_table_steal_all(self->bdev_states);
+ //g_hash_table_steal_all(self->bdev_states);
+ g_hash_table_foreach_steal(self->bdev_states, rettrue, NULL);
#if 0
nb_tracefile = self->parent.tracefiles->len;
guint i;
for(i=0; i<n; i++) {
- g_array_free(states[i].mode_stack, FALSE);
+ g_array_free(states[i].mode_stack, TRUE);
}
g_free(states);
guint i;
for(i=0; i<n; i++) {
- g_array_free(states[i].mode_stack, FALSE);
+ g_array_free(states[i].mode_stack, TRUE);
}
g_free(states);
static void bdevstate_free(LttvBdevState *bds)
{
- g_array_free(bds->mode_stack, FALSE);
+ g_array_free(bds->mode_stack, TRUE);
g_free(bds);
}
/* save the cpu state */
{
+ value = lttv_attribute_add(container, LTTV_STATE_RESOURCE_CPUS_COUNT,
+ LTTV_UINT);
+ *(value.v_uint) = nb_cpus;
+
value = lttv_attribute_add(container, LTTV_STATE_RESOURCE_CPUS,
LTTV_POINTER);
*(value.v_pointer) = lttv_state_copy_cpu_states(self->cpu_states, nb_cpus);
lttv_attribute_remove_by_name(container, LTTV_STATE_PROCESSES);
/* Free running processes array */
- nb_cpus = ltt_trace_get_num_cpu(self->parent.t);
type = lttv_attribute_get_by_name(container, LTTV_STATE_RUNNING_PROCESS,
&value);
g_assert(type == LTTV_POINTER);
g_free(running_process);
/* free cpu resource states */
+ type = lttv_attribute_get_by_name(container, LTTV_STATE_RESOURCE_CPUS_COUNT, &value);
+ g_assert(type == LTTV_UINT);
+ nb_cpus = *value.v_uint;
type = lttv_attribute_get_by_name(container, LTTV_STATE_RESOURCE_CPUS, &value);
g_assert(type == LTTV_POINTER);
- lttv_state_free_cpu_states(self->cpu_states, nb_cpus);
+ lttv_state_free_cpu_states(*(value.v_pointer), nb_cpus);
/* free irq resource states */
nb_irqs = self->nb_irqs;
type = lttv_attribute_get_by_name(container, LTTV_STATE_RESOURCE_IRQS, &value);
g_assert(type == LTTV_POINTER);
- lttv_state_free_irq_states(self->irq_states, nb_irqs);
+ lttv_state_free_irq_states(*(value.v_pointer), nb_irqs);
/* free the blkdev states */
type = lttv_attribute_get_by_name(container, LTTV_STATE_RESOURCE_BLKDEVS, &value);
g_assert(type == LTTV_POINTER);
- lttv_state_free_blkdev_hashtable(self->bdev_states);
+ lttv_state_free_blkdev_hashtable(*(value.v_pointer));
nb_tracefile = self->parent.tracefiles->len;
* the parent waits for its child terminaison, but may also happen in special
* cases in the child's exit : when the parent ignores its children SIGCCHLD or
* has the flag SA_NOCLDWAIT. It can also happen when the child is part
- * of a killed thread ground, but isn't the leader.
+ * of a killed thread group, but isn't the leader.
*/
static void exit_process(LttvTracefileState *tfs, LttvProcessState *process)
{
process->state->change = s->parent.timestamp;
}
- if(state_out == 32 || state_out == 128)
+ if(state_out == 32 || state_out == 64)
exit_process(s, process); /* EXIT_DEAD || TASK_DEAD */
/* see sched.h for states */
}
/* update cpu status */
if(pid_in == 0)
+ /* going to idle task */
cpu_set_base_mode(s->cpu_state, LTTV_CPU_IDLE);
- else
+ else {
+ /* scheduling a real task.
+ * we must be careful here:
+ * if we just schedule()'ed to a process that is
+ * in a trap, we must put the cpu in trap mode
+ */
cpu_set_base_mode(s->cpu_state, LTTV_CPU_BUSY);
+ if(process->state->t == LTTV_STATE_TRAP)
+ cpu_push_mode(s->cpu_state, LTTV_CPU_TRAP);
+ }
return FALSE;
}
LTTV_STATE_TRACE_STATE_USE_COUNT =
g_quark_from_string("trace_state_use_count");
LTTV_STATE_RESOURCE_CPUS = g_quark_from_string("cpu resource states");
+ LTTV_STATE_RESOURCE_CPUS = g_quark_from_string("cpu count");
LTTV_STATE_RESOURCE_IRQS = g_quark_from_string("irq resource states");
LTTV_STATE_RESOURCE_BLKDEVS = g_quark_from_string("blkdevs resource states");