added some commented-out debug output that can be used to get an idea of

2005-11-05  Sven Neumann  <sven@gimp.org>

	* app/gui/splash.c: added some commented-out debug output that can
	be used to get an idea of where the startup time is being spent.

	* app/core/gimp.c
	* app/pdb/internal_procs.c
	* app/pdb/procedural_db.c
	* app/plug-in/plug-ins.c
	* tools/pdbgen/app.pl: cosmetic changes.
This commit is contained in:
Sven Neumann 2005-11-05 12:18:56 +00:00 committed by Sven Neumann
parent bff081e6cb
commit 20a653a542
11 changed files with 163 additions and 90 deletions

View File

@ -1,3 +1,14 @@
2005-11-05 Sven Neumann <sven@gimp.org>
* app/gui/splash.c: added some commented-out debug output that can
be used to get an idea of where the startup time is being spent.
* app/core/gimp.c
* app/pdb/internal_procs.c
* app/pdb/procedural_db.c
* app/plug-in/plug-ins.c
* tools/pdbgen/app.pl: cosmetic changes.
2005-11-05 Sven Neumann <sven@gimp.org>
* app/gui/splash.c (splash_area_expose): set the clip region

View File

@ -629,16 +629,16 @@ gimp_real_initialize (Gimp *gimp,
gimp_gradients_init (gimp);
/* register all internal procedures */
(* status_callback) (_("Procedural Database"), NULL, -1);
status_callback (_("Procedural Database"), NULL, 0.0);
procedural_db_init_procs (gimp, status_callback);
(* status_callback) (_("Plug-In Interpreters"), "", -1);
status_callback (_("Plug-In Interpreters"), "", 0.0);
path = gimp_config_path_expand (gimp->config->interpreter_path, TRUE, NULL);
gimp_interpreter_db_load (gimp->interpreter_db, path);
g_free (path);
(* status_callback) (_("Plug-In Environment"), "", -1);
status_callback (_("Plug-In Environment"), "", 0.0);
path = gimp_config_path_expand (gimp->config->environ_path, TRUE, NULL);
gimp_environ_table_load (gimp->environ_table, path);
@ -852,40 +852,40 @@ gimp_restore (Gimp *gimp,
g_print ("INIT: gimp_restore\n");
/* initialize the global parasite table */
(* status_callback) (_("Looking for data files"), _("Parasites"), 0.0);
status_callback (_("Looking for data files"), _("Parasites"), 0.0);
gimp_parasiterc_load (gimp);
/* initialize the list of gimp brushes */
(* status_callback) (NULL, _("Brushes"), 0.1);
status_callback (NULL, _("Brushes"), 0.1);
gimp_data_factory_data_init (gimp->brush_factory, gimp->no_data);
/* initialize the list of gimp patterns */
(* status_callback) (NULL, _("Patterns"), 0.2);
status_callback (NULL, _("Patterns"), 0.2);
gimp_data_factory_data_init (gimp->pattern_factory, gimp->no_data);
/* initialize the list of gimp palettes */
(* status_callback) (NULL, _("Palettes"), 0.3);
status_callback (NULL, _("Palettes"), 0.3);
gimp_data_factory_data_init (gimp->palette_factory, gimp->no_data);
/* initialize the list of gimp gradients */
(* status_callback) (NULL, _("Gradients"), 0.4);
status_callback (NULL, _("Gradients"), 0.4);
gimp_data_factory_data_init (gimp->gradient_factory, gimp->no_data);
/* initialize the list of gimp fonts */
(* status_callback) (NULL, _("Fonts"), 0.5);
status_callback (NULL, _("Fonts"), 0.5);
if (! gimp->no_fonts)
gimp_fonts_load (gimp);
/* initialize the document history */
(* status_callback) (NULL, _("Documents"), 0.6);
status_callback (NULL, _("Documents"), 0.6);
gimp_documents_load (gimp);
/* initialize the template list */
(* status_callback) (NULL, _("Templates"), 0.7);
status_callback (NULL, _("Templates"), 0.7);
gimp_templates_load (gimp);
/* initialize the module list */
(* status_callback) (NULL, _("Modules"), 0.8);
status_callback (NULL, _("Modules"), 0.8);
gimp_modules_load (gimp);
g_signal_emit (gimp, gimp_signals[RESTORE], 0, status_callback);

View File

@ -32,6 +32,9 @@
#include "gimp-intl.h"
/* #define STARTUP_TIMER 1 */
typedef struct
{
GtkWidget *window;
@ -44,6 +47,12 @@ typedef struct
gint upper_x, upper_y;
PangoLayout *lower;
gint lower_x, lower_y;
#ifdef STARTUP_TIMER
GTimer *timer;
gdouble last_time;
gchar *text1;
gchar *text2;
#endif
} GimpSplash;
static GimpSplash *splash = NULL;
@ -64,6 +73,12 @@ static gboolean splash_average_bottom (GtkWidget *widget,
static GdkPixbuf * splash_image_load (void);
static GdkPixbuf * splash_image_pick_from_dir (const gchar *dirname);
#ifdef STARTUP_TIMER
static void splash_timer_elapsed (const gchar *text1,
const gchar *text2,
gdouble percentage);
#endif
/* public functions */
@ -170,6 +185,10 @@ splash_create (void)
gtk_widget_show (splash->progress);
gtk_widget_show_now (splash->window);
#ifdef STARTUP_TIMER
splash->timer = g_timer_new ();
#endif
}
void
@ -184,6 +203,12 @@ splash_destroy (void)
g_object_unref (splash->upper);
g_object_unref (splash->lower);
#ifdef STARTUP_TIMER
g_timer_destroy (splash->timer);
g_free (splash->text1);
g_free (splash->text2);
#endif
g_free (splash);
splash = NULL;
}
@ -199,9 +224,15 @@ splash_update (const gchar *text1,
gint width;
gint height;
g_return_if_fail (percentage >= 0.0 && percentage <= 1.0);
if (! splash)
return;
#ifdef STARTUP_TIMER
splash_timer_elapsed (text1, text2, percentage);
#endif
width = splash->area->allocation.width;
height = splash->area->allocation.height;
@ -239,7 +270,7 @@ splash_update (const gchar *text1,
expose.width, expose.height);
gtk_progress_bar_set_fraction (GTK_PROGRESS_BAR (splash->progress),
CLAMP (percentage, 0.0, 1.0));
percentage);
while (gtk_events_pending ())
gtk_main_iteration ();
@ -419,3 +450,34 @@ splash_image_pick_from_dir (const gchar *dirname)
return pixbuf;
}
#ifdef STARTUP_TIMER
static void
splash_timer_elapsed (const gchar *text1,
const gchar *text2,
gdouble percentage)
{
gdouble elapsed = g_timer_elapsed (splash->timer, NULL);
if (text1)
{
g_free (splash->text1);
splash->text1 = g_strdup (text1);
}
if (text2)
{
g_free (splash->text2);
splash->text2 = g_strdup (text2);
}
g_printerr ("%8g %8g - %s %g%% - %s\n",
elapsed,
elapsed - splash->last_time,
splash->text1 ? splash->text1 : "",
percentage * 100.0,
splash->text2 ? splash->text2 : "");
splash->last_time = elapsed;
}
#endif

View File

@ -199,11 +199,10 @@ procedural_db_register (Gimp *gimp,
g_return_if_fail (procedure != NULL);
list = g_hash_table_lookup (gimp->procedural_ht, procedure->name);
list = g_list_prepend (list, (gpointer) procedure);
g_hash_table_insert (gimp->procedural_ht,
(gpointer) procedure->name,
(gpointer) list);
procedure->name,
g_list_prepend (list, procedure));
}
void
@ -240,7 +239,7 @@ procedural_db_lookup (Gimp *gimp,
list = g_hash_table_lookup (gimp->procedural_ht, name);
if (list)
return (ProcRecord *) list->data;
return list->data;
else
return NULL;
}
@ -341,7 +340,8 @@ procedural_db_execute (Gimp *gimp,
return_args[0].value.pdb_int != GIMP_PDB_PASS_THROUGH &&
procedure->num_values > 0)
{
memset (&return_args[1], 0, sizeof (Argument) * procedure->num_values);
memset (&return_args[1],
0, sizeof (Argument) * procedure->num_values);
}
if (return_args[0].value.pdb_int == GIMP_PDB_PASS_THROUGH)
@ -572,7 +572,7 @@ procedural_db_destroy_args (Argument *args,
break;
case GIMP_PDB_PARASITE:
gimp_parasite_free ((GimpParasite *) (args[i].value.pdb_pointer));
gimp_parasite_free (args[i].value.pdb_pointer);
break;
case GIMP_PDB_STATUS:
@ -625,7 +625,7 @@ procedural_db_set_data (Gimp *gimp,
for (list = gimp->procedural_db_data_list; list; list = g_list_next (list))
{
pdb_data = (PDBData *) list->data;
pdb_data = list->data;
if (! strcmp (pdb_data->identifier, identifier))
break;

View File

@ -199,11 +199,10 @@ procedural_db_register (Gimp *gimp,
g_return_if_fail (procedure != NULL);
list = g_hash_table_lookup (gimp->procedural_ht, procedure->name);
list = g_list_prepend (list, (gpointer) procedure);
g_hash_table_insert (gimp->procedural_ht,
(gpointer) procedure->name,
(gpointer) list);
procedure->name,
g_list_prepend (list, procedure));
}
void
@ -240,7 +239,7 @@ procedural_db_lookup (Gimp *gimp,
list = g_hash_table_lookup (gimp->procedural_ht, name);
if (list)
return (ProcRecord *) list->data;
return list->data;
else
return NULL;
}
@ -341,7 +340,8 @@ procedural_db_execute (Gimp *gimp,
return_args[0].value.pdb_int != GIMP_PDB_PASS_THROUGH &&
procedure->num_values > 0)
{
memset (&return_args[1], 0, sizeof (Argument) * procedure->num_values);
memset (&return_args[1],
0, sizeof (Argument) * procedure->num_values);
}
if (return_args[0].value.pdb_int == GIMP_PDB_PASS_THROUGH)
@ -572,7 +572,7 @@ procedural_db_destroy_args (Argument *args,
break;
case GIMP_PDB_PARASITE:
gimp_parasite_free ((GimpParasite *) (args[i].value.pdb_pointer));
gimp_parasite_free (args[i].value.pdb_pointer);
break;
case GIMP_PDB_STATUS:
@ -625,7 +625,7 @@ procedural_db_set_data (Gimp *gimp,
for (list = gimp->procedural_db_data_list; list; list = g_list_next (list))
{
pdb_data = (PDBData *) list->data;
pdb_data = list->data;
if (! strcmp (pdb_data->identifier, identifier))
break;

View File

@ -199,11 +199,10 @@ procedural_db_register (Gimp *gimp,
g_return_if_fail (procedure != NULL);
list = g_hash_table_lookup (gimp->procedural_ht, procedure->name);
list = g_list_prepend (list, (gpointer) procedure);
g_hash_table_insert (gimp->procedural_ht,
(gpointer) procedure->name,
(gpointer) list);
procedure->name,
g_list_prepend (list, procedure));
}
void
@ -240,7 +239,7 @@ procedural_db_lookup (Gimp *gimp,
list = g_hash_table_lookup (gimp->procedural_ht, name);
if (list)
return (ProcRecord *) list->data;
return list->data;
else
return NULL;
}
@ -341,7 +340,8 @@ procedural_db_execute (Gimp *gimp,
return_args[0].value.pdb_int != GIMP_PDB_PASS_THROUGH &&
procedure->num_values > 0)
{
memset (&return_args[1], 0, sizeof (Argument) * procedure->num_values);
memset (&return_args[1],
0, sizeof (Argument) * procedure->num_values);
}
if (return_args[0].value.pdb_int == GIMP_PDB_PASS_THROUGH)
@ -572,7 +572,7 @@ procedural_db_destroy_args (Argument *args,
break;
case GIMP_PDB_PARASITE:
gimp_parasite_free ((GimpParasite *) (args[i].value.pdb_pointer));
gimp_parasite_free (args[i].value.pdb_pointer);
break;
case GIMP_PDB_STATUS:
@ -625,7 +625,7 @@ procedural_db_set_data (Gimp *gimp,
for (list = gimp->procedural_db_data_list; list; list = g_list_next (list))
{
pdb_data = (PDBData *) list->data;
pdb_data = list->data;
if (! strcmp (pdb_data->identifier, identifier))
break;

View File

@ -86,142 +86,142 @@ internal_procs_init (Gimp *gimp,
g_return_if_fail (GIMP_IS_GIMP (gimp));
g_return_if_fail (status_callback != NULL);
(* status_callback) (_("Internal Procedures"), _("Brush"), 0.0);
status_callback (_("Internal Procedures"), _("Brush"), 0.0);
register_brush_procs (gimp);
(* status_callback) (NULL, _("Brush UI"), 0.045);
status_callback (NULL, _("Brush UI"), 0.045);
register_brush_select_procs (gimp);
(* status_callback) (NULL, _("Brushes"), 0.051);
status_callback (NULL, _("Brushes"), 0.051);
register_brushes_procs (gimp);
(* status_callback) (NULL, _("Buffer procedures"), 0.063);
status_callback (NULL, _("Buffer procedures"), 0.063);
register_buffer_procs (gimp);
(* status_callback) (NULL, _("Channel"), 0.077);
status_callback (NULL, _("Channel"), 0.077);
register_channel_procs (gimp);
(* status_callback) (NULL, _("Color"), 0.097);
status_callback (NULL, _("Color"), 0.097);
register_color_procs (gimp);
(* status_callback) (NULL, _("Context"), 0.13);
status_callback (NULL, _("Context"), 0.13);
register_context_procs (gimp);
(* status_callback) (NULL, _("Convert"), 0.174);
status_callback (NULL, _("Convert"), 0.174);
register_convert_procs (gimp);
(* status_callback) (NULL, _("Display procedures"), 0.181);
status_callback (NULL, _("Display procedures"), 0.181);
register_display_procs (gimp);
(* status_callback) (NULL, _("Drawable procedures"), 0.191);
status_callback (NULL, _("Drawable procedures"), 0.191);
register_drawable_procs (gimp);
(* status_callback) (NULL, _("Transformation procedures"), 0.262);
status_callback (NULL, _("Transformation procedures"), 0.262);
register_drawable_transform_procs (gimp);
(* status_callback) (NULL, _("Edit procedures"), 0.294);
status_callback (NULL, _("Edit procedures"), 0.294);
register_edit_procs (gimp);
(* status_callback) (NULL, _("File Operations"), 0.325);
status_callback (NULL, _("File Operations"), 0.325);
register_fileops_procs (gimp);
(* status_callback) (NULL, _("Floating selections"), 0.347);
status_callback (NULL, _("Floating selections"), 0.347);
register_floating_sel_procs (gimp);
(* status_callback) (NULL, _("Font UI"), 0.359);
status_callback (NULL, _("Font UI"), 0.359);
register_font_select_procs (gimp);
(* status_callback) (NULL, _("Fonts"), 0.365);
status_callback (NULL, _("Fonts"), 0.365);
register_fonts_procs (gimp);
(* status_callback) (NULL, _("Gimprc procedures"), 0.369);
status_callback (NULL, _("Gimprc procedures"), 0.369);
register_gimprc_procs (gimp);
(* status_callback) (NULL, _("Gradient"), 0.383);
status_callback (NULL, _("Gradient"), 0.383);
register_gradient_procs (gimp);
(* status_callback) (NULL, _("Gradient UI"), 0.444);
status_callback (NULL, _("Gradient UI"), 0.444);
register_gradient_select_procs (gimp);
(* status_callback) (NULL, _("Gradients"), 0.45);
status_callback (NULL, _("Gradients"), 0.45);
register_gradients_procs (gimp);
(* status_callback) (NULL, _("Image grid procedures"), 0.46);
status_callback (NULL, _("Image grid procedures"), 0.46);
register_grid_procs (gimp);
(* status_callback) (NULL, _("Guide procedures"), 0.481);
status_callback (NULL, _("Guide procedures"), 0.481);
register_guides_procs (gimp);
(* status_callback) (NULL, _("Help procedures"), 0.493);
status_callback (NULL, _("Help procedures"), 0.493);
register_help_procs (gimp);
(* status_callback) (NULL, _("Image"), 0.495);
status_callback (NULL, _("Image"), 0.495);
register_image_procs (gimp);
(* status_callback) (NULL, _("Layer"), 0.623);
status_callback (NULL, _("Layer"), 0.623);
register_layer_procs (gimp);
(* status_callback) (NULL, _("Message procedures"), 0.677);
status_callback (NULL, _("Message procedures"), 0.677);
register_message_procs (gimp);
(* status_callback) (NULL, _("Miscellaneous"), 0.684);
status_callback (NULL, _("Miscellaneous"), 0.684);
register_misc_procs (gimp);
(* status_callback) (NULL, _("Paint Tool procedures"), 0.69);
status_callback (NULL, _("Paint Tool procedures"), 0.69);
register_paint_tools_procs (gimp);
(* status_callback) (NULL, _("Palette"), 0.72);
status_callback (NULL, _("Palette"), 0.72);
register_palette_procs (gimp);
(* status_callback) (NULL, _("Palette UI"), 0.748);
status_callback (NULL, _("Palette UI"), 0.748);
register_palette_select_procs (gimp);
(* status_callback) (NULL, _("Palettes"), 0.755);
status_callback (NULL, _("Palettes"), 0.755);
register_palettes_procs (gimp);
(* status_callback) (NULL, _("Parasite procedures"), 0.763);
status_callback (NULL, _("Parasite procedures"), 0.763);
register_parasite_procs (gimp);
(* status_callback) (NULL, _("Paths"), 0.787);
status_callback (NULL, _("Paths"), 0.787);
register_paths_procs (gimp);
(* status_callback) (NULL, _("Pattern"), 0.824);
status_callback (NULL, _("Pattern"), 0.824);
register_pattern_procs (gimp);
(* status_callback) (NULL, _("Pattern UI"), 0.828);
status_callback (NULL, _("Pattern UI"), 0.828);
register_pattern_select_procs (gimp);
(* status_callback) (NULL, _("Patterns"), 0.834);
status_callback (NULL, _("Patterns"), 0.834);
register_patterns_procs (gimp);
(* status_callback) (NULL, _("Plug-in"), 0.842);
status_callback (NULL, _("Plug-in"), 0.842);
register_plug_in_procs (gimp);
(* status_callback) (NULL, _("Procedural database"), 0.854);
status_callback (NULL, _("Procedural database"), 0.854);
register_procedural_db_procs (gimp);
(* status_callback) (NULL, _("Progress"), 0.872);
status_callback (NULL, _("Progress"), 0.872);
register_progress_procs (gimp);
(* status_callback) (NULL, _("Image mask"), 0.888);
status_callback (NULL, _("Image mask"), 0.888);
register_selection_procs (gimp);
(* status_callback) (NULL, _("Selection Tool procedures"), 0.923);
status_callback (NULL, _("Selection Tool procedures"), 0.923);
register_selection_tools_procs (gimp);
(* status_callback) (NULL, _("Text procedures"), 0.933);
status_callback (NULL, _("Text procedures"), 0.933);
register_text_tool_procs (gimp);
(* status_callback) (NULL, _("Transform Tool procedures"), 0.941);
status_callback (NULL, _("Transform Tool procedures"), 0.941);
register_transform_tools_procs (gimp);
(* status_callback) (NULL, _("Undo"), 0.953);
status_callback (NULL, _("Undo"), 0.953);
register_undo_procs (gimp);
(* status_callback) (NULL, _("Units"), 0.968);
status_callback (NULL, _("Units"), 0.968);
register_unit_procs (gimp);
(* status_callback) (NULL, _("Paths"), 0.992);
status_callback (NULL, _("Paths"), 0.992);
register_vectors_procs (gimp);
}

View File

@ -199,11 +199,10 @@ procedural_db_register (Gimp *gimp,
g_return_if_fail (procedure != NULL);
list = g_hash_table_lookup (gimp->procedural_ht, procedure->name);
list = g_list_prepend (list, (gpointer) procedure);
g_hash_table_insert (gimp->procedural_ht,
(gpointer) procedure->name,
(gpointer) list);
procedure->name,
g_list_prepend (list, procedure));
}
void
@ -240,7 +239,7 @@ procedural_db_lookup (Gimp *gimp,
list = g_hash_table_lookup (gimp->procedural_ht, name);
if (list)
return (ProcRecord *) list->data;
return list->data;
else
return NULL;
}
@ -341,7 +340,8 @@ procedural_db_execute (Gimp *gimp,
return_args[0].value.pdb_int != GIMP_PDB_PASS_THROUGH &&
procedure->num_values > 0)
{
memset (&return_args[1], 0, sizeof (Argument) * procedure->num_values);
memset (&return_args[1],
0, sizeof (Argument) * procedure->num_values);
}
if (return_args[0].value.pdb_int == GIMP_PDB_PASS_THROUGH)
@ -572,7 +572,7 @@ procedural_db_destroy_args (Argument *args,
break;
case GIMP_PDB_PARASITE:
gimp_parasite_free ((GimpParasite *) (args[i].value.pdb_pointer));
gimp_parasite_free (args[i].value.pdb_pointer);
break;
case GIMP_PDB_STATUS:
@ -625,7 +625,7 @@ procedural_db_set_data (Gimp *gimp,
for (list = gimp->procedural_db_data_list; list; list = g_list_next (list))
{
pdb_data = (PDBData *) list->data;
pdb_data = list->data;
if (! strcmp (pdb_data->identifier, identifier))
break;

View File

@ -135,7 +135,7 @@ plug_ins_init (Gimp *gimp,
}
status_callback (_("Resource configuration"),
gimp_filename_to_utf8 (filename), -1);
gimp_filename_to_utf8 (filename), 0.0);
if (! plug_in_rc_parse (gimp, filename, &error))
{

View File

@ -135,7 +135,7 @@ plug_ins_init (Gimp *gimp,
}
status_callback (_("Resource configuration"),
gimp_filename_to_utf8 (filename), -1);
gimp_filename_to_utf8 (filename), 0.0);
if (! plug_in_rc_parse (gimp, filename, &error))
{

View File

@ -820,7 +820,7 @@ GPL
push @group_decls, $decl;
$longest = length $decl if $longest < length $decl;
$group_procs .= ' ' x 2 . "(* status_callback) (";
$group_procs .= ' ' x 2 . "status_callback (";
$group_procs .= q/_("Internal Procedures")/ unless $once;
$group_procs .= 'NULL' if $once++;
$group_procs .= qq/, _("$main::grp{$group}->{desc}"), /;