+/* This file is part of the Linux Trace Toolkit viewer
+ * Copyright (C) 2003-2004 Mathieu Desnoyers
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License Version 2 as
+ * published by the Free Software Foundation;
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston,
+ * MA 02111-1307, USA.
+ */
#include <gtk/gtk.h>
#include <glib.h>
#include "processlist.h"
#include "drawitem.h"
+#define g_info(format...) g_log (G_LOG_DOMAIN, G_LOG_LEVEL_INFO, format)
+#define g_debug(format...) g_log (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, format)
+
+
/*****************************************************************************
* Methods to synchronize process list *
*****************************************************************************/
PID_COLUMN,
BIRTH_S_COLUMN,
BIRTH_NS_COLUMN,
+ TRACE_COLUMN,
N_COLUMNS
};
g_value_unset(&a);
g_value_unset(&b);
+ /* Order by trace_num */
+ gtk_tree_model_get_value( model,
+ it_a,
+ TRACE_COLUMN,
+ &a);
+
+ gtk_tree_model_get_value( model,
+ it_b,
+ TRACE_COLUMN,
+ &b);
+
+ if(G_VALUE_TYPE(&a) == G_TYPE_ULONG
+ && G_VALUE_TYPE(&b) == G_TYPE_ULONG )
+ {
+ if(g_value_get_ulong(&a) > g_value_get_ulong(&b))
+ {
+ g_value_unset(&a);
+ g_value_unset(&b);
+ return 1;
+ }
+ if(g_value_get_ulong(&a) < g_value_get_ulong(&b))
+ {
+ g_value_unset(&a);
+ g_value_unset(&b);
+ return 0;
+ }
+
+ }
+
+
+
return 0;
}
return 0;
// g_critical("compare %u and %u",((ProcessInfo*)a)->birth.tv_nsec,((ProcessInfo*)b)->birth.tv_nsec);
+ if(((ProcessInfo*)a)->trace_num != ((ProcessInfo*)b)->trace_num)
+ return 0;
+
return 1;
}
G_TYPE_STRING,
G_TYPE_UINT,
G_TYPE_ULONG,
+ G_TYPE_ULONG,
G_TYPE_ULONG);
process_list->process_list_widget =
gtk_tree_view_new_with_model
(GTK_TREE_MODEL (process_list->list_store));
-
g_object_unref (G_OBJECT (process_list->list_store));
gtk_tree_sortable_set_sort_func(
gtk_tree_view_set_headers_visible(
- GTK_TREE_VIEW(process_list->process_list_widget), FALSE);
+ GTK_TREE_VIEW(process_list->process_list_widget), TRUE);
/* Create a column, associating the "text" attribute of the
* cell_renderer to the first column of the model */
gtk_tree_view_append_column (
GTK_TREE_VIEW (process_list->process_list_widget), column);
+ column = gtk_tree_view_column_new_with_attributes ( "TRACE",
+ renderer,
+ "text",
+ TRACE_COLUMN,
+ NULL);
+ gtk_tree_view_append_column (
+ GTK_TREE_VIEW (process_list->process_list_widget), column);
+
+
//gtk_tree_view_column_set_visible(column, 0);
g_object_set_data_full(
}
void processlist_destroy(ProcessList *process_list)
{
+ g_info("processlist_destroy %p", process_list);
g_hash_table_destroy(process_list->process_hash);
process_list->process_hash = NULL;
g_free(process_list);
+ g_info("processlist_destroy end");
}
GtkWidget *processlist_get_widget(ProcessList *process_list)
int processlist_add( ProcessList *process_list,
guint pid,
LttTime *birth,
- gchar *name,
+ guint trace_num,
+ const gchar *name,
guint *height,
HashedProcessData **pm_hashed_process_data)
{
Process_Info->pid = pid;
Process_Info->birth = *birth;
+ Process_Info->trace_num = trace_num;
hashed_process_data->draw_context = g_new(DrawContext, 1);
hashed_process_data->draw_context->drawable = NULL;
PID_COLUMN, pid,
BIRTH_S_COLUMN, birth->tv_sec,
BIRTH_NS_COLUMN, birth->tv_nsec,
+ TRACE_COLUMN, trace_num,
-1);
hashed_process_data->row_ref = gtk_tree_row_reference_new (
GTK_TREE_MODEL(process_list->list_store),
int processlist_remove( ProcessList *process_list,
guint pid,
- LttTime *birth)
+ LttTime *birth,
+ guint trace_num)
{
ProcessInfo Process_Info;
gint *path_indices;
Process_Info.pid = pid;
Process_Info.birth = *birth;
+ Process_Info.trace_num = trace_num;
if(hashed_process_data =
process_list->process_hash,
&Process_Info))
{
+ GtkTreePath *tree_path;
+
+ tree_path = gtk_tree_row_reference_get_path(
+ hashed_process_data->row_ref);
+
gtk_tree_model_get_iter (
GTK_TREE_MODEL(process_list->list_store),
- &iter,
- gtk_tree_row_reference_get_path(
- (GtkTreeRowReference*)hashed_process_data->row_ref)
- );
+ &iter, tree_path);
+
+ gtk_tree_path_free(tree_path);
gtk_list_store_remove (process_list->list_store, &iter);
gint processlist_get_process_pixels( ProcessList *process_list,
- guint pid, LttTime *birth,
+ guint pid, LttTime *birth, guint trace_num,
guint *y,
guint *height,
HashedProcessData **pm_hashed_process_data)
Process_Info.pid = pid;
Process_Info.birth = *birth;
+ Process_Info.trace_num = trace_num;
if(hashed_process_data =
(HashedProcessData*)g_hash_table_lookup(
GTK_TREE_VIEW(process_list->process_list_widget));
*y = *height * path_indices[0];
*pm_hashed_process_data = hashed_process_data;
+ gtk_tree_path_free(tree_path);
+
return 0;
} else {
*pm_hashed_process_data = hashed_process_data;
*height = get_cell_height(
GTK_TREE_VIEW(process_list->process_list_widget));
*y = *height * path_indices[0];
+ gtk_tree_path_free(tree_path);
return 0;