[nautilus] Add a bunch of profiling points
- From: William Jon McCann <mccann src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nautilus] Add a bunch of profiling points
- Date: Wed, 8 Aug 2012 19:58:25 +0000 (UTC)
commit 3516a3ac56ef222f3995a49ee429eebb48526408
Author: William Jon McCann <jmccann redhat com>
Date: Tue Aug 7 18:13:07 2012 -0400
Add a bunch of profiling points
libnautilus-private/nautilus-directory-async.c | 26 ++++++++++++++-
libnautilus-private/nautilus-directory.c | 11 ++++++
src/nautilus-application.c | 29 +++++++++++++++-
src/nautilus-view.c | 41 ++++++++++++++++++++++--
src/nautilus-window-manage-views.c | 29 +++++++++++++++--
src/nautilus-window.c | 5 +++
6 files changed, 132 insertions(+), 9 deletions(-)
---
diff --git a/libnautilus-private/nautilus-directory-async.c b/libnautilus-private/nautilus-directory-async.c
index 45c9f02..7fb7272 100644
--- a/libnautilus-private/nautilus-directory-async.c
+++ b/libnautilus-private/nautilus-directory-async.c
@@ -32,6 +32,7 @@
#include "nautilus-signaller.h"
#include "nautilus-global-preferences.h"
#include "nautilus-link.h"
+#include "nautilus-profile.h"
#include <eel/eel-glib-extensions.h>
#include <gtk/gtk.h>
#include <libxml/parser.h>
@@ -743,9 +744,19 @@ nautilus_directory_monitor_add_internal (NautilusDirectory *directory,
{
Monitor *monitor;
GList *file_list;
-
+ char *file_uri = NULL;
+ char *dir_uri = NULL;
+
g_assert (NAUTILUS_IS_DIRECTORY (directory));
+ if (file != NULL)
+ file_uri = nautilus_file_get_uri (file);
+ if (directory != NULL)
+ dir_uri = nautilus_directory_get_uri (directory);
+ nautilus_profile_start ("uri %s file-uri %s client %p", dir_uri, file_uri, client);
+ g_free (dir_uri);
+ g_free (file_uri);
+
/* Replace any current monitor for this client/file pair. */
remove_monitor (directory, file, client);
@@ -797,6 +808,7 @@ nautilus_directory_monitor_add_internal (NautilusDirectory *directory,
/* Kick off I/O. */
nautilus_directory_async_state_changed (directory);
+ nautilus_profile_end (NULL);
}
static void
@@ -874,6 +886,8 @@ dequeue_pending_idle_callback (gpointer callback_data)
nautilus_directory_ref (directory);
+ nautilus_profile_start ("nitems %d", g_list_length (directory->details->pending_file_info));
+
directory->details->dequeue_pending_idle_id = 0;
/* Handle the files in the order we saw them. */
@@ -1000,6 +1014,8 @@ dequeue_pending_idle_callback (gpointer callback_data)
/* Get the state machine running again. */
nautilus_directory_async_state_changed (directory);
+ nautilus_profile_end (NULL);
+
nautilus_directory_unref (directory);
return FALSE;
}
@@ -1091,6 +1107,8 @@ directory_load_done (NautilusDirectory *directory,
{
GList *node;
+ nautilus_profile_start (NULL);
+
directory->details->directory_loaded = TRUE;
directory->details->directory_loaded_sent_notification = FALSE;
@@ -1116,6 +1134,8 @@ directory_load_done (NautilusDirectory *directory,
dequeue_pending_idle_callback (directory);
directory_load_cancel (directory);
+
+ nautilus_profile_end (NULL);
}
void
@@ -2298,6 +2318,8 @@ void
nautilus_directory_force_reload_internal (NautilusDirectory *directory,
NautilusFileAttributes file_attributes)
{
+ nautilus_profile_start (NULL);
+
/* invalidate attributes that are getting reloaded for all files */
nautilus_directory_invalidate_file_attributes (directory, file_attributes);
@@ -2310,6 +2332,8 @@ nautilus_directory_force_reload_internal (NautilusDirectory *directory,
add_all_files_to_work_queue (directory);
nautilus_directory_async_state_changed (directory);
+
+ nautilus_profile_end (NULL);
}
static gboolean
diff --git a/libnautilus-private/nautilus-directory.c b/libnautilus-private/nautilus-directory.c
index 6dcb8e0..801ce47 100644
--- a/libnautilus-private/nautilus-directory.c
+++ b/libnautilus-private/nautilus-directory.c
@@ -33,6 +33,7 @@
#include "nautilus-global-preferences.h"
#include "nautilus-lib-self-check-functions.h"
#include "nautilus-metadata.h"
+#include "nautilus-profile.h"
#include "nautilus-desktop-directory.h"
#include "nautilus-vfs-directory.h"
#include <eel/eel-glib-extensions.h>
@@ -712,22 +713,26 @@ void
nautilus_directory_emit_files_added (NautilusDirectory *directory,
GList *added_files)
{
+ nautilus_profile_start (NULL);
if (added_files != NULL) {
g_signal_emit (directory,
signals[FILES_ADDED], 0,
added_files);
}
+ nautilus_profile_end (NULL);
}
void
nautilus_directory_emit_files_changed (NautilusDirectory *directory,
GList *changed_files)
{
+ nautilus_profile_start (NULL);
if (changed_files != NULL) {
g_signal_emit (directory,
signals[FILES_CHANGED], 0,
changed_files);
}
+ nautilus_profile_end (NULL);
}
void
@@ -736,10 +741,12 @@ nautilus_directory_emit_change_signals (NautilusDirectory *directory,
{
GList *p;
+ nautilus_profile_start (NULL);
for (p = changed_files; p != NULL; p = p->next) {
nautilus_file_emit_changed (p->data);
}
nautilus_directory_emit_files_changed (directory, changed_files);
+ nautilus_profile_end (NULL);
}
void
@@ -903,6 +910,8 @@ nautilus_directory_notify_files_added (GList *files)
NautilusFile *file;
GFile *location, *parent;
+ nautilus_profile_start (NULL);
+
/* Make a list of added files in each directory. */
added_lists = g_hash_table_new (NULL, NULL);
@@ -972,6 +981,8 @@ nautilus_directory_notify_files_added (GList *files)
/* Invalidate count for each parent directory. */
g_hash_table_foreach (parent_directories, invalidate_count_and_unref, NULL);
g_hash_table_destroy (parent_directories);
+
+ nautilus_profile_end (NULL);
}
static void
diff --git a/src/nautilus-application.c b/src/nautilus-application.c
index 4676530..272b585 100644
--- a/src/nautilus-application.c
+++ b/src/nautilus-application.c
@@ -59,6 +59,7 @@
#include <libnautilus-private/nautilus-global-preferences.h>
#include <libnautilus-private/nautilus-lib-self-check-functions.h>
#include <libnautilus-private/nautilus-module.h>
+#include <libnautilus-private/nautilus-profile.h>
#include <libnautilus-private/nautilus-signaller.h>
#include <libnautilus-private/nautilus-ui-utilities.h>
#include <libnautilus-extension/nautilus-menu-provider.h>
@@ -202,6 +203,8 @@ check_required_directories (NautilusApplication *application)
g_assert (NAUTILUS_IS_APPLICATION (application));
+ nautilus_profile_start (NULL);
+
ret = TRUE;
user_directory = nautilus_get_user_directory ();
@@ -258,6 +261,7 @@ check_required_directories (NautilusApplication *application)
g_slist_free (directories);
g_free (user_directory);
g_free (desktop_directory);
+ nautilus_profile_end (NULL);
return ret;
}
@@ -546,6 +550,7 @@ nautilus_application_create_window (NautilusApplication *application,
gboolean maximized;
g_return_val_if_fail (NAUTILUS_IS_APPLICATION (application), NULL);
+ nautilus_profile_start (NULL);
window = nautilus_window_new (GTK_APPLICATION (application), screen);
@@ -575,7 +580,8 @@ nautilus_application_create_window (NautilusApplication *application,
g_free (geometry_string);
DEBUG ("Creating a new navigation window");
-
+ nautilus_profile_end (NULL);
+
return window;
}
@@ -695,7 +701,7 @@ open_window (NautilusApplication *application,
uri = g_file_get_uri (location);
DEBUG ("Opening new window at uri %s", uri);
-
+ nautilus_profile_start (NULL);
window = nautilus_application_create_window (application,
screen);
nautilus_window_go_to (window, location);
@@ -712,6 +718,8 @@ open_window (NautilusApplication *application,
FALSE);
}
+ nautilus_profile_end (NULL);
+
g_free (uri);
}
@@ -744,6 +752,8 @@ nautilus_application_open_location (NautilusApplication *application,
NautilusWindow *window;
GList *sel_list = NULL;
+ nautilus_profile_start (NULL);
+
window = nautilus_application_create_window (application, gdk_screen_get_default ());
gtk_window_set_startup_id (GTK_WINDOW (window), startup_id);
@@ -757,6 +767,8 @@ nautilus_application_open_location (NautilusApplication *application,
if (sel_list != NULL) {
nautilus_file_list_free (sel_list);
}
+
+ nautilus_profile_end (NULL);
}
static void
@@ -1009,6 +1021,7 @@ static void
do_perform_self_checks (gint *exit_status)
{
#ifndef NAUTILUS_OMIT_SELF_CHECK
+ nautilus_profile_start (NULL);
/* Run the checks (each twice) for nautilus and libnautilus-private. */
nautilus_run_self_checks ();
@@ -1018,6 +1031,7 @@ do_perform_self_checks (gint *exit_status)
nautilus_run_self_checks ();
nautilus_run_lib_self_checks ();
eel_exit_if_self_checks_failed ();
+ nautilus_profile_end (NULL);
#endif
*exit_status = EXIT_SUCCESS;
@@ -1065,6 +1079,8 @@ nautilus_application_local_command_line (GApplication *application,
*exit_status = EXIT_SUCCESS;
+ nautilus_profile_start (NULL);
+
context = g_option_context_new (_("\n\nBrowse the file system with the file manager"));
g_option_context_add_main_entries (context, options, NULL);
g_option_context_add_group (context, gtk_get_option_group (TRUE));
@@ -1162,6 +1178,7 @@ nautilus_application_local_command_line (GApplication *application,
out:
g_option_context_free (context);
+ nautilus_profile_end (NULL);
return TRUE;
}
@@ -1346,6 +1363,8 @@ nautilus_application_startup (GApplication *app)
{
NautilusApplication *self = NAUTILUS_APPLICATION (app);
+ nautilus_profile_start (NULL);
+
/* chain up to the GTK+ implementation early, so gtk_init()
* is called for us.
*/
@@ -1362,12 +1381,14 @@ nautilus_application_startup (GApplication *app)
nautilus_global_preferences_init ();
/* register views */
+ nautilus_profile_start ("Register views");
nautilus_canvas_view_register ();
nautilus_desktop_canvas_view_register ();
nautilus_list_view_register ();
#if ENABLE_EMPTY_VIEW
nautilus_empty_view_register ();
#endif
+ nautilus_profile_end ("Register views");
/* register property pages */
nautilus_image_properties_page_register ();
@@ -1377,7 +1398,9 @@ nautilus_application_startup (GApplication *app)
init_gtk_accels ();
/* initialize nautilus modules */
+ nautilus_profile_start ("Modules");
nautilus_module_setup ();
+ nautilus_profile_end ("Modules");
/* attach menu-provider module callback */
menu_provider_init_callback ();
@@ -1405,6 +1428,8 @@ nautilus_application_startup (GApplication *app)
do_upgrades_once (self);
nautilus_application_init_actions (self);
+
+ nautilus_profile_end (NULL);
}
static void
diff --git a/src/nautilus-view.c b/src/nautilus-view.c
index 1a7f091..5d2823f 100644
--- a/src/nautilus-view.c
+++ b/src/nautilus-view.c
@@ -76,6 +76,7 @@
#include <libnautilus-private/nautilus-metadata.h>
#include <libnautilus-private/nautilus-recent.h>
#include <libnautilus-private/nautilus-module.h>
+#include <libnautilus-private/nautilus-profile.h>
#include <libnautilus-private/nautilus-program-choosing.h>
#include <libnautilus-private/nautilus-trash-monitor.h>
#include <libnautilus-private/nautilus-ui-utilities.h>
@@ -2636,6 +2637,8 @@ nautilus_view_init (NautilusView *view)
NautilusDirectory *templates_directory;
char *templates_uri;
+ nautilus_profile_start (NULL);
+
view->details = G_TYPE_INSTANCE_GET_PRIVATE (view, NAUTILUS_TYPE_VIEW,
NautilusViewDetails);
@@ -2715,6 +2718,8 @@ nautilus_view_init (NautilusView *view)
atk_object = gtk_widget_get_accessible (GTK_WIDGET (view));
atk_object_set_name (atk_object, _("Content View"));
atk_object_set_description (atk_object, _("View of the current folder"));
+
+ nautilus_profile_end (NULL);
}
static void
@@ -3104,10 +3109,11 @@ nautilus_view_load_location (NautilusView *nautilus_view,
NautilusView *directory_view;
directory_view = NAUTILUS_VIEW (nautilus_view);
-
+ nautilus_profile_start (NULL);
directory = nautilus_directory_get (location);
load_directory (directory_view, directory);
nautilus_directory_unref (directory);
+ nautilus_profile_end (NULL);
}
static gboolean
@@ -3134,6 +3140,8 @@ done_loading (NautilusView *view,
return;
}
+ nautilus_profile_start (NULL);
+
/* This can be called during destruction, in which case there
* is no NautilusWindow any more.
*/
@@ -3186,6 +3194,7 @@ done_loading (NautilusView *view,
g_signal_emit (view, signals[END_LOADING], 0, all_files_seen);
view->details->loading = FALSE;
+ nautilus_profile_end (NULL);
}
@@ -3214,6 +3223,8 @@ debuting_files_add_file_callback (NautilusView *view,
{
GFile *location;
+ nautilus_profile_start (NULL);
+
location = nautilus_file_get_location (new_file);
if (g_hash_table_remove (data->debuting_files, location)) {
@@ -3228,7 +3239,9 @@ debuting_files_add_file_callback (NautilusView *view,
data);
}
}
-
+
+ nautilus_profile_end (NULL);
+
g_object_unref (location);
}
@@ -3861,6 +3874,8 @@ files_added_callback (NautilusDirectory *directory,
view = NAUTILUS_VIEW (callback_data);
+ nautilus_profile_start (NULL);
+
window = nautilus_view_get_containing_window (view);
uri = nautilus_view_get_uri (view);
DEBUG_FILES (files, "Files added in window %p: %s",
@@ -3873,6 +3888,8 @@ files_added_callback (NautilusDirectory *directory,
/* The number of items could have changed */
schedule_update_status (view);
+
+ nautilus_profile_end (NULL);
}
static void
@@ -3912,7 +3929,8 @@ done_loading_callback (NautilusDirectory *directory,
NautilusView *view;
view = NAUTILUS_VIEW (callback_data);
-
+
+ nautilus_profile_start (NULL);
process_new_files (view);
if (g_hash_table_size (view->details->non_ready_files) == 0) {
/* Unschedule a pending update and schedule a new one with the minimal
@@ -3922,6 +3940,7 @@ done_loading_callback (NautilusDirectory *directory,
unschedule_display_of_pending_files (view);
schedule_timeout_display_of_pending_files (view, UPDATE_INTERVAL_MIN);
}
+ nautilus_profile_end (NULL);
}
static void
@@ -9278,6 +9297,8 @@ load_directory (NautilusView *view,
g_assert (NAUTILUS_IS_VIEW (view));
g_assert (NAUTILUS_IS_DIRECTORY (directory));
+ nautilus_profile_start (NULL);
+
nautilus_view_stop_loading (view);
g_signal_emit (view, signals[CLEAR], 0);
@@ -9341,6 +9362,8 @@ load_directory (NautilusView *view,
view->details->file_changed_handler_id = g_signal_connect
(view->details->directory_as_file, "changed",
G_CALLBACK (file_changed_callback), view);
+
+ nautilus_profile_end (NULL);
}
static void
@@ -9348,13 +9371,17 @@ finish_loading (NautilusView *view)
{
NautilusFileAttributes attributes;
+ nautilus_profile_start (NULL);
+
nautilus_window_report_load_underway (view->details->window,
NAUTILUS_VIEW (view));
/* Tell interested parties that we've begun loading this directory now.
* Subclasses use this to know that the new metadata is now available.
*/
+ nautilus_profile_start ("BEGIN_LOADING");
g_signal_emit (view, signals[BEGIN_LOADING], 0);
+ nautilus_profile_end ("BEGIN_LOADING");
/* Assume we have now all information to show window */
nautilus_window_view_visible (view->details->window, NAUTILUS_VIEW (view));
@@ -9403,6 +9430,8 @@ finish_loading (NautilusView *view)
view->details->files_changed_handler_id = g_signal_connect
(view->details->model, "files_changed",
G_CALLBACK (files_changed_callback), view);
+
+ nautilus_profile_end (NULL);
}
static void
@@ -9426,9 +9455,12 @@ metadata_for_directory_as_file_ready_callback (NautilusFile *file,
g_assert (view->details->directory_as_file == file);
g_assert (view->details->metadata_for_directory_as_file_pending);
+ nautilus_profile_start (NULL);
+
view->details->metadata_for_directory_as_file_pending = FALSE;
finish_loading_if_all_metadata_loaded (view);
+ nautilus_profile_end (NULL);
}
static void
@@ -9444,9 +9476,12 @@ metadata_for_files_in_directory_ready_callback (NautilusDirectory *directory,
g_assert (view->details->model == directory);
g_assert (view->details->metadata_for_files_in_directory_pending);
+ nautilus_profile_start (NULL);
+
view->details->metadata_for_files_in_directory_pending = FALSE;
finish_loading_if_all_metadata_loaded (view);
+ nautilus_profile_end (NULL);
}
static void
diff --git a/src/nautilus-window-manage-views.c b/src/nautilus-window-manage-views.c
index 4eb0300..099e9ef 100644
--- a/src/nautilus-window-manage-views.c
+++ b/src/nautilus-window-manage-views.c
@@ -55,6 +55,7 @@
#include <libnautilus-private/nautilus-metadata.h>
#include <libnautilus-private/nautilus-module.h>
#include <libnautilus-private/nautilus-monitor.h>
+#include <libnautilus-private/nautilus-profile.h>
#include <libnautilus-private/nautilus-search-directory.h>
#define DEBUG_FLAG NAUTILUS_DEBUG_WINDOW
@@ -435,6 +436,7 @@ nautilus_window_slot_open_location_full (NautilusWindowSlot *slot,
new_uri = g_file_get_uri (location);
DEBUG ("Opening location, old: %s, new: %s", old_uri, new_uri);
+ nautilus_profile_start ("Opening location, old: %s, new: %s", old_uri, new_uri);
g_free (old_uri);
g_free (new_uri);
@@ -522,14 +524,16 @@ nautilus_window_slot_open_location_full (NautilusWindowSlot *slot,
callback (window, NULL, user_data);
}
- g_object_unref (old_location);
- return;
+ goto done;
}
begin_location_change (target_slot, location, old_location, new_selection,
NAUTILUS_LOCATION_CHANGE_STANDARD, 0, NULL, callback, user_data);
+ done:
g_clear_object (&old_location);
+
+ nautilus_profile_end (NULL);
}
const char *
@@ -610,6 +614,8 @@ begin_location_change (NautilusWindowSlot *slot,
|| type == NAUTILUS_LOCATION_CHANGE_FORWARD
|| distance == 0);
+ nautilus_profile_start (NULL);
+
/* If there is no new selection and the new location is
* a (grand)parent of the old location then we automatically
* select the folder the previous location was in */
@@ -700,6 +706,8 @@ begin_location_change (NautilusWindowSlot *slot,
NAUTILUS_FILE_ATTRIBUTE_MOUNT,
got_file_info_for_view_selection_callback,
slot);
+
+ nautilus_profile_end (NULL);
}
typedef struct {
@@ -770,6 +778,8 @@ got_file_info_for_view_selection_callback (NautilusFile *file,
g_assert (slot->determine_view_file == file);
slot->determine_view_file = NULL;
+ nautilus_profile_start (NULL);
+
if (slot->mount_error) {
error = g_error_copy (slot->mount_error);
} else if (nautilus_file_get_file_info_error (file) != NULL) {
@@ -942,6 +952,8 @@ got_file_info_for_view_selection_callback (NautilusFile *file,
g_clear_error (&error);
nautilus_file_unref (file);
+
+ nautilus_profile_end (NULL);
}
/* Load a view into the window, either reusing the old one or creating
@@ -964,6 +976,8 @@ create_content_view (NautilusWindowSlot *slot,
window = nautilus_window_slot_get_window (slot);
+ nautilus_profile_start (NULL);
+
/* FIXME bugzilla.gnome.org 41243:
* We should use inheritance instead of these special cases
* for the desktop window.
@@ -1022,6 +1036,8 @@ create_content_view (NautilusWindowSlot *slot,
g_propagate_error (error_out, error);
}
+ nautilus_profile_end (NULL);
+
return ret;
}
@@ -1040,7 +1056,8 @@ load_new_location (NautilusWindowSlot *slot,
selection_copy = eel_g_object_list_copy (selection);
view = NULL;
-
+
+ nautilus_profile_start (NULL);
/* Note, these may recurse into report_load_underway */
if (slot->content_view != NULL && tell_current_content_view) {
view = slot->content_view;
@@ -1060,6 +1077,8 @@ load_new_location (NautilusWindowSlot *slot,
}
g_list_free_full (selection_copy, g_object_unref);
+
+ nautilus_profile_end (NULL);
}
/* A view started to load the location its viewing, either due to
@@ -1074,6 +1093,8 @@ nautilus_window_report_load_underway (NautilusWindow *window,
g_assert (NAUTILUS_IS_WINDOW (window));
+ nautilus_profile_start (NULL);
+
if (window->details->temporarily_ignore_view_signals) {
return;
}
@@ -1086,6 +1107,8 @@ nautilus_window_report_load_underway (NautilusWindow *window,
} else {
nautilus_window_slot_set_allow_stop (slot, TRUE);
}
+
+ nautilus_profile_end (NULL);
}
static void
diff --git a/src/nautilus-window.c b/src/nautilus-window.c
index 994a09e..555fae0 100644
--- a/src/nautilus-window.c
+++ b/src/nautilus-window.c
@@ -58,6 +58,7 @@
#include <libnautilus-private/nautilus-file-attributes.h>
#include <libnautilus-private/nautilus-global-preferences.h>
#include <libnautilus-private/nautilus-metadata.h>
+#include <libnautilus-private/nautilus-profile.h>
#include <libnautilus-private/nautilus-clipboard.h>
#include <libnautilus-private/nautilus-search-directory.h>
#include <libnautilus-private/nautilus-signaller.h>
@@ -1080,6 +1081,8 @@ nautilus_window_constructed (GObject *self)
window = NAUTILUS_WINDOW (self);
+ nautilus_profile_start (NULL);
+
G_OBJECT_CLASS (nautilus_window_parent_class)->constructed (self);
/* disable automatic menubar handling, since we show our regular
@@ -1121,6 +1124,8 @@ nautilus_window_constructed (GObject *self)
slot = nautilus_window_open_slot (window, 0);
nautilus_window_set_active_slot (window, slot);
+
+ nautilus_profile_end (NULL);
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]