strange performance numbers
- From: Tim Flechtner <timf trdlnk com>
- To: gtk-list gnome org
- Subject: strange performance numbers
- Date: Tue, 18 Feb 2003 17:08:01 -0600
we have been seeing some very odd differences in cpu utilization for a
simple test application (code attached) on different solaris 8 x86 hosts.
we have two boxes with identical modeled graphics cards:
red -
a 2.53 Ghz P4, 533 Mhz front side bus with 512 MB DDR RAM running
solaris 8 (x86)
protea -
a 2.0 Ghz P4, 400 Mhz front side bus with 512 MB SDRAM running
solaris 8 (x86)
the test application performs screen updates every time a timeout signal
of the specified interval fires.
a screen update consists of updating four text cells of a tree view.
interval is the time in miliseconds between screen updates.
interval red protea
1000 0.02 0.02
100 0.05 0.05
10 0.07 1.50
can anyone suggest why protea's (admittedly a lower power machine) cpu
usage would shoot up so dramatically under the heavier load?
thanks!
-tim
#include <gtk/gtk.h>
enum {
FIRST_COLUMN,
SECOND_COLUMN,
NUM_COLUMNS
};
GtkTreeIter row1, row2;
GValue v11, v12, v21, v22;
GtkTreeStore* model;
int sleepytime;
int on_timeout(gpointer data)
{
static int i = 0;
/* need to schedule another callback and return */
g_value_set_int(&v11, i++);
gtk_tree_store_set_value(model, &row1, 0, &v11);
g_value_set_int(&v12, i++);
gtk_tree_store_set_value(model, &row1, 1, &v12);
g_value_set_int(&v21, i++);
gtk_tree_store_set_value(model, &row2, 0, &v21);
g_value_set_int(&v22, i++);
gtk_tree_store_set_value(model, &row2, 1, &v22);
return TRUE;
}
void callback(GtkWidget* widget, gpointer data)
{
gtk_timeout_add(sleepytime, on_timeout, NULL);
return;
}
main(int argc, char** argv)
{
GtkWidget* view;
GtkTreeViewColumn* column;
GtkCellRenderer* cell_renderer;
GtkWidget* window;
GtkWidget* vbox;
GtkWidget* button;
int i, j;
if(argc < 2) {
sleepytime = 1000;
} else {
sleepytime = atoi(argv[1]);
}
gtk_init(&argc, &argv);
window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
vbox = gtk_vbox_new(FALSE, 0);
g_signal_connect(G_OBJECT(window), "destroy",
G_CALLBACK(gtk_main_quit),
NULL);
model = gtk_tree_store_new(NUM_COLUMNS, G_TYPE_INT, G_TYPE_INT);
// custom_populate_model_function(model);
view = gtk_tree_view_new_with_model(GTK_TREE_MODEL(model));
cell_renderer = gtk_cell_renderer_text_new();
g_object_set(G_OBJECT (cell_renderer),
"foreground", "dodger blue",
NULL);
column = gtk_tree_view_column_new_with_attributes(
"Column 1", cell_renderer, "text", FIRST_COLUMN, NULL);
gtk_tree_view_append_column(GTK_TREE_VIEW(view), column);
cell_renderer = gtk_cell_renderer_text_new();
g_object_set(G_OBJECT (cell_renderer),
"weight", "bold",
NULL);
column = gtk_tree_view_column_new_with_attributes(
"Column 2", cell_renderer, "text", SECOND_COLUMN, NULL);
gtk_tree_view_append_column(GTK_TREE_VIEW(view), column);
g_object_unref(G_OBJECT(model));
// Build the button
// ----------------
button = gtk_button_new_with_label("Thump CPU");
g_signal_connect(G_OBJECT(button), "clicked",
G_CALLBACK(callback), (gpointer) "Thump CPU");
gtk_box_pack_start(GTK_BOX(vbox), view, TRUE, TRUE, 0);
gtk_box_pack_start(GTK_BOX(vbox), button, TRUE, TRUE, 0);
gtk_container_add(GTK_CONTAINER(window), vbox);
// Add some rows
// -------------
gtk_tree_store_append(model, &row1, NULL);
gtk_tree_store_append(model, &row2, NULL);
memset(&v11, 0, sizeof(GValue));
g_value_init(&v11, G_TYPE_INT);
memset(&v12, 0, sizeof(GValue));
g_value_init(&v12, G_TYPE_INT);
memset(&v21, 0, sizeof(GValue));
g_value_init(&v21, G_TYPE_INT);
memset(&v22, 0, sizeof(GValue));
g_value_init(&v22, G_TYPE_INT);
gtk_widget_show_all(window);
gtk_main();
return 0;
}
CC = gcc
#CFLAGS = -Wall \
# -DG_DISABLE_DEPRECATED \
# -DGDK_DISABLE_DEPRECATED \
# -DGDK_PIXBUF_DISABLE_DEPRECATED \
# -DGTK_DISABLE_DEPRECATED
CFLAGS =
tree: tree.c
$(CC) tree.c -o tree $(CFLAGS) `pkg-config gtk+-2.0 --cflags --libs`
clean:
rm -f *.o tree
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]