1
0
mirror of https://gitlab.gnome.org/GNOME/nautilus synced 2024-06-30 23:46:35 +00:00

general: Remove nautilus-profile

With tools like sysprof that use the kernels perf functionality, there
is no need to maintain an in-tree profiling solution.
This commit is contained in:
Peter Eisenmann 2023-09-24 21:06:08 +00:00 committed by António Fernandes
parent 250853856d
commit 5cf288a93e
9 changed files with 6 additions and 252 deletions

View File

@ -205,8 +205,6 @@ libnautilus_sources = [
'nautilus-module.h',
'nautilus-monitor.c',
'nautilus-monitor.h',
'nautilus-profile.c',
'nautilus-profile.h',
'nautilus-progress-info.c',
'nautilus-progress-info.h',
'nautilus-progress-info-manager.c',

View File

@ -57,7 +57,6 @@
#include "nautilus-module.h"
#include "nautilus-preferences-window.h"
#include "nautilus-previewer.h"
#include "nautilus-profile.h"
#include "nautilus-progress-persistence-handler.h"
#include "nautilus-scheme.h"
#include "nautilus-self-check-functions.h"
@ -149,8 +148,6 @@ check_required_directories (NautilusApplication *self)
g_assert (NAUTILUS_IS_APPLICATION (self));
nautilus_profile_start (NULL);
ret = TRUE;
user_directory = nautilus_get_user_directory ();
@ -207,7 +204,6 @@ check_required_directories (NautilusApplication *self)
g_slist_free (directories);
g_free (user_directory);
nautilus_profile_end (NULL);
return ret;
}
@ -251,7 +247,6 @@ nautilus_application_create_window (NautilusApplication *self)
gint default_height = 0;
g_return_val_if_fail (NAUTILUS_IS_APPLICATION (self), NULL);
nautilus_profile_start (NULL);
window = nautilus_window_new ();
@ -280,7 +275,6 @@ nautilus_application_create_window (NautilusApplication *self)
}
DEBUG ("Creating a new navigation window");
nautilus_profile_end (NULL);
return window;
}
@ -389,7 +383,6 @@ real_open_location_full (NautilusApplication *self,
new_uri = g_file_get_uri (location);
DEBUG ("Application opening location, old: %s, new: %s", old_uri, new_uri);
nautilus_profile_start ("Application opening location, old: %s, new: %s", old_uri, new_uri);
g_free (old_uri);
g_free (new_uri);
@ -451,10 +444,7 @@ static NautilusWindow *
open_window (NautilusApplication *self,
GFile *location)
{
NautilusWindow *window;
nautilus_profile_start (NULL);
window = nautilus_application_create_window (self);
NautilusWindow *window = nautilus_application_create_window (self);
if (location != NULL)
{
@ -469,8 +459,6 @@ open_window (NautilusApplication *self,
g_object_unref (home);
}
nautilus_profile_end (NULL);
return window;
}
@ -484,8 +472,6 @@ nautilus_application_open_location (NautilusApplication *self,
NautilusWindowSlot *slot;
GList *sel_list = NULL;
nautilus_profile_start (NULL);
if (selection != NULL)
{
sel_list = g_list_prepend (sel_list, nautilus_file_get (selection));
@ -508,8 +494,6 @@ nautilus_application_open_location (NautilusApplication *self,
{
nautilus_file_list_free (sel_list);
}
nautilus_profile_end (NULL);
}
/* Note: when launched from command line we do not reach this method
@ -623,7 +607,6 @@ do_perform_self_checks (void)
#ifndef NAUTILUS_OMIT_SELF_CHECK
gtk_init ();
nautilus_profile_start (NULL);
/* Run the checks (each twice) for nautilus and libnautilus-private. */
nautilus_run_self_checks ();
@ -633,7 +616,6 @@ do_perform_self_checks (void)
nautilus_run_self_checks ();
nautilus_run_lib_self_checks ();
eel_exit_if_self_checks_failed ();
nautilus_profile_end (NULL);
#endif
return EXIT_SUCCESS;
@ -932,8 +914,6 @@ nautilus_application_command_line (GApplication *application,
gint retval = -1;
GVariantDict *options;
nautilus_profile_start (NULL);
options = g_application_command_line_get_options_dict (command_line);
if (g_variant_dict_contains (options, "version"))
@ -967,8 +947,6 @@ nautilus_application_command_line (GApplication *application,
retval = nautilus_application_handle_file_args (self, options);
out:
nautilus_profile_end (NULL);
return retval;
}
@ -1142,10 +1120,7 @@ static void
nautilus_application_startup (GApplication *app)
{
NautilusApplication *self = NAUTILUS_APPLICATION (app);
NautilusApplicationPrivate *priv;
nautilus_profile_start (NULL);
priv = nautilus_application_get_instance_private (self);
NautilusApplicationPrivate *priv = nautilus_application_get_instance_private (self);
g_application_set_resource_base_path (G_APPLICATION (self), "/org/gnome/nautilus");
@ -1160,9 +1135,7 @@ nautilus_application_startup (GApplication *app)
nautilus_global_preferences_init ();
/* initialize nautilus modules */
nautilus_profile_start ("Modules");
nautilus_module_setup ();
nautilus_profile_end ("Modules");
/* attach menu-provider module callback */
menu_provider_init_callback ();
@ -1183,8 +1156,6 @@ nautilus_application_startup (GApplication *app)
nautilus_tag_manager_maybe_migrate_tracker2_data (priv->tag_manager);
}
nautilus_profile_end (NULL);
g_signal_connect (self, "shutdown", G_CALLBACK (on_application_shutdown), NULL);
g_signal_connect_object (gtk_icon_theme_get_for_display (gdk_display_get_default ()),

View File

@ -33,7 +33,6 @@
#include "nautilus-file-queue.h"
#include "nautilus-global-preferences.h"
#include "nautilus-metadata.h"
#include "nautilus-profile.h"
#include "nautilus-signaller.h"
/* turn this on to check if async. job calls are balanced */
@ -804,7 +803,6 @@ nautilus_directory_monitor_add_internal (NautilusDirectory *directory,
{
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);
@ -864,7 +862,6 @@ nautilus_directory_monitor_add_internal (NautilusDirectory *directory,
/* Kick off I/O. */
nautilus_directory_async_state_changed (directory);
nautilus_profile_end (NULL);
}
static void
@ -966,8 +963,6 @@ 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. */
@ -1120,8 +1115,6 @@ drain:
/* Get the state machine running again. */
nautilus_directory_async_state_changed (directory);
nautilus_profile_end (NULL);
nautilus_directory_unref (directory);
return FALSE;
}
@ -1210,7 +1203,6 @@ directory_load_done (NautilusDirectory *directory,
{
GList *node;
nautilus_profile_start (NULL);
g_object_ref (directory);
directory->details->directory_loaded = TRUE;
@ -1243,7 +1235,6 @@ directory_load_done (NautilusDirectory *directory,
directory_load_cancel (directory);
g_object_unref (directory);
nautilus_profile_end (NULL);
}
void
@ -2409,8 +2400,6 @@ 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);
@ -2423,8 +2412,6 @@ 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

View File

@ -34,7 +34,6 @@
#include "nautilus-global-preferences.h"
#include "nautilus-lib-self-check-functions.h"
#include "nautilus-metadata.h"
#include "nautilus-profile.h"
#include "nautilus-scheme.h"
#include "nautilus-search-directory-file.h"
#include "nautilus-search-directory.h"
@ -1013,43 +1012,35 @@ 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
nautilus_directory_emit_change_signals (NautilusDirectory *directory,
GList *changed_files)
{
GList *p;
nautilus_profile_start (NULL);
for (p = changed_files; p != NULL; p = p->next)
for (GList *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
@ -1235,8 +1226,6 @@ 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);
@ -1314,8 +1303,6 @@ 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);
}
void

View File

@ -76,7 +76,6 @@
#include "nautilus-module.h"
#include "nautilus-new-folder-dialog-controller.h"
#include "nautilus-previewer.h"
#include "nautilus-profile.h"
#include "nautilus-program-choosing.h"
#include "nautilus-properties-window.h"
#include "nautilus-rename-file-popover-controller.h"
@ -3794,14 +3793,9 @@ static void
nautilus_files_view_set_location (NautilusView *view,
GFile *location)
{
NautilusDirectory *directory;
nautilus_profile_start (NULL);
directory = nautilus_directory_get (location);
g_autoptr (NautilusDirectory) directory = nautilus_directory_get (location);
load_directory (NAUTILUS_FILES_VIEW (view), directory);
nautilus_directory_unref (directory);
nautilus_profile_end (NULL);
}
static gboolean
@ -3974,8 +3968,6 @@ done_loading (NautilusFilesView *view,
return;
}
nautilus_profile_start (NULL);
if (!priv->in_destruction)
{
remove_loading_floating_bar (view);
@ -4039,8 +4031,6 @@ done_loading (NautilusFilesView *view,
nautilus_files_view_check_empty_states (view);
update_extend_search_revealer (view);
}
nautilus_profile_end (NULL);
}
@ -4070,8 +4060,6 @@ debuting_files_add_files_callback (NautilusFilesView *view,
GFile *location;
GList *l;
nautilus_profile_start (NULL);
for (l = new_files; l != NULL; l = l->next)
{
location = nautilus_file_get_location (NAUTILUS_FILE (l->data));
@ -4092,8 +4080,6 @@ debuting_files_add_files_callback (NautilusFilesView *view,
G_CALLBACK (debuting_files_add_files_callback),
data);
}
nautilus_profile_end (NULL);
}
static void
@ -4904,8 +4890,6 @@ files_added_callback (NautilusDirectory *directory,
view = NAUTILUS_FILES_VIEW (callback_data);
priv = nautilus_files_view_get_instance_private (view);
nautilus_profile_start (NULL);
window = nautilus_files_view_get_containing_window (view);
uri = nautilus_files_view_get_uri (view);
DEBUG_FILES (files, "Files added in window %p: %s",
@ -4918,8 +4902,6 @@ files_added_callback (NautilusDirectory *directory,
/* The number of items could have changed */
schedule_update_status (view);
nautilus_profile_end (NULL);
}
static void
@ -4964,7 +4946,6 @@ done_loading_callback (NautilusDirectory *directory,
view = NAUTILUS_FILES_VIEW (callback_data);
priv = nautilus_files_view_get_instance_private (view);
nautilus_profile_start (NULL);
process_new_files (view);
if (g_hash_table_size (priv->non_ready_files) == 0)
{
@ -4977,7 +4958,6 @@ done_loading_callback (NautilusDirectory *directory,
remove_loading_floating_bar (view);
}
nautilus_profile_end (NULL);
}
static void
@ -8868,9 +8848,7 @@ emit_begin_loading (NautilusFilesView *self)
/* 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 (self, signals[BEGIN_LOADING], 0);
nautilus_profile_end ("BEGIN_LOADING");
}
static void
@ -8937,8 +8915,6 @@ load_directory (NautilusFilesView *view,
priv = nautilus_files_view_get_instance_private (view);
nautilus_profile_start (NULL);
nautilus_files_view_stop_loading (view);
if (NAUTILUS_IS_SEARCH_DIRECTORY (directory) || NAUTILUS_IS_SEARCH_DIRECTORY (priv->directory))
{
@ -9035,8 +9011,6 @@ load_directory (NautilusFilesView *view,
priv->file_changed_handler_id = g_signal_connect
(priv->directory_as_file, "changed",
G_CALLBACK (file_changed_callback), view);
nautilus_profile_end (NULL);
}
static void
@ -9047,8 +9021,6 @@ finish_loading (NautilusFilesView *view)
priv = nautilus_files_view_get_instance_private (view);
nautilus_profile_start (NULL);
emit_begin_loading (view);
nautilus_files_view_check_empty_states (view);
@ -9100,8 +9072,6 @@ finish_loading (NautilusFilesView *view)
/* If escaping search we can release the search directory now that the view
* is now monitoring the base directory directly. */
g_clear_object (&priv->outgoing_search);
nautilus_profile_end (NULL);
}
static void
@ -9132,12 +9102,9 @@ metadata_for_directory_as_file_ready_callback (NautilusFile *file,
g_assert (priv->directory_as_file == file);
g_assert (priv->metadata_for_directory_as_file_pending);
nautilus_profile_start (NULL);
priv->metadata_for_directory_as_file_pending = FALSE;
finish_loading_if_all_metadata_loaded (view);
nautilus_profile_end (NULL);
}
static void
@ -9155,12 +9122,9 @@ metadata_for_files_in_directory_ready_callback (NautilusDirectory *directory,
g_assert (priv->directory == directory);
g_assert (priv->metadata_for_files_in_directory_pending);
nautilus_profile_start (NULL);
priv->metadata_for_files_in_directory_pending = FALSE;
finish_loading_if_all_metadata_loaded (view);
nautilus_profile_end (NULL);
}
static void
@ -9965,8 +9929,6 @@ nautilus_files_view_init (NautilusFilesView *view)
NULL
};
nautilus_profile_start (NULL);
priv = nautilus_files_view_get_instance_private (view);
/* Toolbar menu */
@ -10139,8 +10101,6 @@ nautilus_files_view_init (NautilusFilesView *view)
priv->clipboard_cancellable = g_cancellable_new ();
priv->rename_file_controller = nautilus_rename_file_popover_controller_new (GTK_WIDGET (view));
nautilus_profile_end (NULL);
}
NautilusFilesView *

View File

@ -1,69 +0,0 @@
/*
* Copyright (C) 2005 William Jon McCann <mccann@jhu.edu>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* 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, see <http://www.gnu.org/licenses/>.
*
* Authors: William Jon McCann <mccann@jhu.edu>
*
*/
#include "config.h"
#include <stdio.h>
#include <string.h>
#include <stdarg.h>
#include <signal.h>
#include <time.h>
#include <unistd.h>
#include <glib.h>
#include <glib/gstdio.h>
#include "nautilus-profile.h"
void
_nautilus_profile_log (const char *func,
const char *note,
const char *format,
...)
{
va_list args;
char *str;
char *formatted;
if (format == NULL)
{
formatted = g_strdup ("");
}
else
{
va_start (args, format);
formatted = g_strdup_vprintf (format, args);
va_end (args);
}
if (func != NULL)
{
str = g_strdup_printf ("MARK: %s %s: %s %s", g_get_prgname (), func, note ? note : "", formatted);
}
else
{
str = g_strdup_printf ("MARK: %s: %s %s", g_get_prgname (), note ? note : "", formatted);
}
g_free (formatted);
g_access (str, F_OK);
g_free (str);
}

View File

@ -1,53 +0,0 @@
/*
* Copyright (C) 2005 William Jon McCann <mccann@jhu.edu>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* 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, see <http://www.gnu.org/licenses/>.
*
* Authors: William Jon McCann <mccann@jhu.edu>
*
* Can be profiled like so:
* strace -ttt -f -o /tmp/logfile.strace nautilus
* python plot-timeline.py -o prettygraph.png /tmp/logfile.strace
*
* See: http://www.gnome.org/~federico/news-2006-03.html#09
*/
#pragma once
#include <glib.h>
G_BEGIN_DECLS
#ifdef ENABLE_PROFILING
#ifdef G_HAVE_ISO_VARARGS
#define nautilus_profile_start(...) _nautilus_profile_log (G_STRFUNC, "start", __VA_ARGS__)
#define nautilus_profile_end(...) _nautilus_profile_log (G_STRFUNC, "end", __VA_ARGS__)
#define nautilus_profile_msg(...) _nautilus_profile_log (NULL, NULL, __VA_ARGS__)
#elif defined(G_HAVE_GNUC_VARARGS)
#define nautilus_profile_start(format...) _nautilus_profile_log (G_STRFUNC, "start", format)
#define nautilus_profile_end(format...) _nautilus_profile_log (G_STRFUNC, "end", format)
#define nautilus_profile_msg(format...) _nautilus_profile_log (NULL, NULL, format)
#endif
#else
#define nautilus_profile_start(...)
#define nautilus_profile_end(...)
#define nautilus_profile_msg(...)
#endif
void _nautilus_profile_log (const char *func,
const char *note,
const char *format,
...) G_GNUC_PRINTF (3, 4);
G_END_DECLS

View File

@ -44,7 +44,6 @@
#include "nautilus-global-preferences.h"
#include "nautilus-module.h"
#include "nautilus-monitor.h"
#include "nautilus-profile.h"
#include "nautilus-ui-utilities.h"
enum
@ -1188,14 +1187,11 @@ nautilus_window_slot_open_location_full (NautilusWindowSlot *self,
if (old_location && g_file_equal (old_location, location) &&
nautilus_file_selection_equal (old_selection, new_selection))
{
goto done;
return;
}
begin_location_change (self, location, old_location, new_selection,
NAUTILUS_LOCATION_CHANGE_STANDARD, 0, NULL);
done:
nautilus_profile_end (NULL);
}
static GList *
@ -1316,8 +1312,6 @@ begin_location_change (NautilusWindowSlot *self,
|| type == NAUTILUS_LOCATION_CHANGE_FORWARD
|| distance == 0);
nautilus_profile_start (NULL);
/* Avoid to update status from the current view in our async calls */
nautilus_window_slot_disconnect_content_view (self);
/* We are going to change the location, so make sure we stop any loading
@ -1352,8 +1346,6 @@ begin_location_change (NautilusWindowSlot *self,
NAUTILUS_FILE_ATTRIBUTE_MOUNT,
got_file_info_for_view_selection_callback,
self);
nautilus_profile_end (NULL);
}
static void
@ -1813,8 +1805,6 @@ got_file_info_for_view_selection_callback (NautilusFile *file,
g_assert (self->determine_view_file == file);
self->determine_view_file = NULL;
nautilus_profile_start (NULL);
if (handle_mount_if_needed (self, file))
{
goto done;
@ -1952,7 +1942,6 @@ done:
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
@ -1968,7 +1957,6 @@ setup_view (NautilusWindowSlot *self,
{
gboolean ret = TRUE;
GFile *old_location;
nautilus_profile_start (NULL);
nautilus_window_slot_disconnect_content_view (self);
@ -2014,8 +2002,6 @@ setup_view (NautilusWindowSlot *self,
change_view (self);
out:
nautilus_profile_end (NULL);
return ret;
}
@ -2027,12 +2013,10 @@ load_new_location (NautilusWindowSlot *self,
gboolean tell_current_content_view,
gboolean tell_new_content_view)
{
NautilusView *view;
NautilusView *view = NULL;
g_assert (self != NULL);
g_assert (location != NULL);
view = NULL;
nautilus_profile_start (NULL);
/* Note, these may recurse into report_load_underway */
if (self->content_view != NULL && tell_current_content_view)
{
@ -2065,8 +2049,6 @@ load_new_location (NautilusWindowSlot *self,
}
}
}
nautilus_profile_end (NULL);
}
static void
@ -2647,8 +2629,6 @@ view_is_loading_changed_cb (GObject *object,
view = NAUTILUS_VIEW (object);
nautilus_profile_start (NULL);
if (nautilus_view_is_loading (view))
{
view_started_loading (self, view);
@ -2657,8 +2637,6 @@ view_is_loading_changed_cb (GObject *object,
{
view_ended_loading (self, view);
}
nautilus_profile_end (NULL);
}
static gboolean

View File

@ -60,7 +60,6 @@
#include "nautilus-mime-actions.h"
#include "nautilus-module.h"
#include "nautilus-pathbar.h"
#include "nautilus-profile.h"
#include "nautilus-progress-indicator.h"
#include "nautilus-scheme.h"
#include "nautilus-signaller.h"
@ -1679,8 +1678,6 @@ nautilus_window_constructed (GObject *self)
window = NAUTILUS_WINDOW (self);
nautilus_profile_start (NULL);
G_OBJECT_CLASS (nautilus_window_parent_class)->constructed (self);
application = NAUTILUS_APPLICATION (g_application_get_default ());
@ -1726,8 +1723,6 @@ nautilus_window_constructed (GObject *self)
"changed",
G_CALLBACK (nautilus_window_sync_bookmarks),
window, G_CONNECT_SWAPPED);
nautilus_profile_end (NULL);
}
static void