Esempio n. 1
0
/**
 * ppg_visualizer_set_property:
 * @object: (in): A #GObject.
 * @prop_id: (in): The property identifier.
 * @value: (in): The given property.
 * @pspec: (in): A #ParamSpec.
 *
 * Set a given #GObject property.
 */
static void
ppg_visualizer_set_property (GObject      *object,
                             guint         prop_id,
                             const GValue *value,
                             GParamSpec   *pspec)
{
	PpgVisualizer *visualizer = PPG_VISUALIZER(object);

	switch (prop_id) {
	case PROP_BEGIN_TIME:
		ppg_visualizer_set_begin_time(visualizer, g_value_get_double(value));
		break;
	case PROP_END_TIME:
		ppg_visualizer_set_end_time(visualizer, g_value_get_double(value));
		break;
	case PROP_FRAME_LIMIT:
		visualizer->priv->frame_limit = g_value_get_int(value);
		break;
	case PROP_IS_IMPORTANT:
		ppg_visualizer_set_is_important(visualizer, g_value_get_boolean(value));
		break;
	case PROP_NAME:
		ppg_visualizer_set_name(visualizer, g_value_get_string(value));
		break;
	case PROP_NATURAL_HEIGHT:
		ppg_visualizer_set_natural_height(visualizer, g_value_get_double(value));
		break;
	case PROP_TITLE:
		ppg_visualizer_set_title(visualizer, g_value_get_string(value));
		break;
	default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
	}
}
Esempio n. 2
0
/**
 * ppg_visualizer_set_property:
 * @object: (in): A #GObject.
 * @prop_id: (in): The property identifier.
 * @value: (out): The given property.
 * @pspec: (in): A #ParamSpec.
 *
 * Get a given #GObject property.
 */
static void
ppg_visualizer_get_property (GObject    *object,
                             guint       prop_id,
                             GValue     *value,
                             GParamSpec *pspec)
{
	PpgVisualizer *visualizer = PPG_VISUALIZER(object);

	switch (prop_id) {
	case PROP_BEGIN_TIME:
		g_value_set_double(value, visualizer->priv->begin_time);
		break;
	case PROP_END_TIME:
		g_value_set_double(value, visualizer->priv->end_time);
		break;
	case PROP_IS_IMPORTANT:
		g_value_set_boolean(value, visualizer->priv->important);
		break;
	case PROP_NAME:
		g_value_set_string(value, ppg_visualizer_get_name(visualizer));
		break;
	case PROP_NATURAL_HEIGHT:
		g_value_set_double(value, visualizer->priv->natural_height);
		break;
	case PROP_TITLE:
		g_value_set_string(value, visualizer->priv->title);
		break;
	default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
	}
}
Esempio n. 3
0
/**
 * ppg_visualizer_finalize:
 * @object: (in): A #PpgVisualizer.
 *
 * Finalizer for a #PpgVisualizer instance.  Frees any resources held by
 * the instance.
 *
 * Returns: None.
 * Side effects: None.
 */
static void
ppg_visualizer_finalize (GObject *object)
{
	PpgVisualizerPrivate *priv = PPG_VISUALIZER(object)->priv;

	if (priv->surface) {
		cairo_surface_destroy(priv->surface);
		priv->surface = NULL;
	}

	g_free(priv->title);
	g_free(priv->name);

	G_OBJECT_CLASS(ppg_visualizer_parent_class)->finalize(object);
}
Esempio n. 4
0
static PpgVisualizer*
ppg_gtk_instrument_events_cb (PpgGtkInstrument *instrument)
{
	PpgGtkInstrumentPrivate *priv;
	PpgTimeVisualizer *visualizer;

	ENTRY;

	g_return_val_if_fail(PPG_IS_GTK_INSTRUMENT(instrument), NULL);

	priv = instrument->priv;

	visualizer = g_object_new(PPG_TYPE_TIME_VISUALIZER,
	                          "name", "events",
	                          "title", _("Gtk+ Events"),
	                          NULL);
	priv->visualizers = g_list_prepend(priv->visualizers, visualizer);
	if (priv->model) {
		ppg_time_visualizer_set_model(visualizer, priv->model);
	}
	RETURN(PPG_VISUALIZER(visualizer));
}
Esempio n. 5
0
/**
 * ppg_memory_instrument_process_cb:
 * @instrument: A #PpgMemoryInstrument.
 *
 * Creates the process memory usage visualizer to be embedded in the
 * instrument view.
 *
 * Returns: A PpgVisualizer.
 */
static PpgVisualizer*
ppg_memory_instrument_process_cb (PpgMemoryInstrument *instrument)
{
	PpgMemoryInstrumentPrivate *priv;
	PpgLineVisualizer *visualizer;
	PpgColorIter iter;

	g_return_val_if_fail(PPG_IS_MEMORY_INSTRUMENT(instrument), NULL);

	priv = instrument->priv;

	visualizer = g_object_new(PPG_TYPE_LINE_VISUALIZER,
	                          "name", "process",
	                          "title", _("Process Memory Usage"),
	                          NULL);

	ppg_color_iter_init(&iter);
	ppg_line_visualizer_append(visualizer, _("Size"), &iter.color,
	                           FALSE, priv->model, COLUMN_SIZE);

	ppg_color_iter_next(&iter);
	ppg_line_visualizer_append(visualizer, _("Resident"), &iter.color,
	                           FALSE, priv->model, COLUMN_RESIDENT);

	ppg_color_iter_next(&iter);
	ppg_line_visualizer_append(visualizer, _("Share"), &iter.color,
	                           FALSE, priv->model, COLUMN_SHARE);

	ppg_color_iter_next(&iter);
	ppg_line_visualizer_append(visualizer, _("Text"), &iter.color,
	                           FALSE, priv->model, COLUMN_TEXT);

	ppg_color_iter_next(&iter);
	ppg_line_visualizer_append(visualizer, _("Data"), &iter.color,
	                           FALSE, priv->model, COLUMN_DATA);

	return PPG_VISUALIZER(visualizer);
}
Esempio n. 6
0
static PpgVisualizer*
ppg_gtk_instrument_delay_cb (PpgGtkInstrument *instrument)
{
	PpgGtkInstrumentPrivate *priv;
	PpgTimeSpanVisualizer *visualizer;

	ENTRY;

	g_return_val_if_fail(PPG_IS_GTK_INSTRUMENT(instrument), NULL);

	priv = instrument->priv;

	visualizer = g_object_new(PPG_TYPE_TIME_SPAN_VISUALIZER,
	                          "span-begin-key", COLUMN_BEGIN,
	                          "span-end-key", COLUMN_END,
	                          "name", "delay",
	                          "title", _("Gtk+ Main Loop Delays"),
	                          NULL);
	priv->visualizers = g_list_prepend(priv->visualizers, visualizer);
	if (priv->model) {
		g_object_set(visualizer, "model", priv->model, NULL);
	}
	RETURN(PPG_VISUALIZER(visualizer));
}